From nobody Sun May 5 10:56:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1614352140; cv=none; d=zohomail.com; s=zohoarc; b=SawkaHili3qvltSYKrYfjcNyWLXinQPdG1o/ev8oPOFo9kGZmrxLha9QlX1Ysi4fGwwnTNEJLXT9m1E0caKig5kDZoWmRZdChkc4kFX8vsGx8qI0WDvkw+OKwlq3Qu1fBVOlqSVa5CKCR95u4DmwMRePE67Qpb6Dllfuv36BiuM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614352140; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=x+UT5oe5lNbLyAE6e6Zv15GL0RHN4l6DYQIIJarNa28=; b=Rt2R7ABA0fn0Us7Pr36iSGe5IPBbXG43f1EN1lAYNDQ3Ra7PXAaq50mOK+mmjDTg97BuSJ36DVm7K8lOVVBvnKDOgeamSJWQAOKERMziQtWWMO9e5JycHtR2DH01oKfLy57DTYi0j8NGqNHEKuIjeuHPOiidrMJKAkWrcqZhZqQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1614352140256511.9710368080947; Fri, 26 Feb 2021 07:09:00 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.90391.171076 (Exim 4.92) (envelope-from ) id 1lFejN-0006e3-0Z; Fri, 26 Feb 2021 15:08:37 +0000 Received: by outflank-mailman (output) from mailman id 90391.171076; Fri, 26 Feb 2021 15:08:36 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lFejM-0006dw-Sj; Fri, 26 Feb 2021 15:08:36 +0000 Received: by outflank-mailman (input) for mailman id 90391; Fri, 26 Feb 2021 15:08:35 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lFejL-0006dr-1U for xen-devel@lists.xenproject.org; Fri, 26 Feb 2021 15:08:35 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 614ce6ce-a827-43ea-8fa2-428a65765be7; Fri, 26 Feb 2021 15:08:33 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 1FBA1AD57; Fri, 26 Feb 2021 15:08:33 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 614ce6ce-a827-43ea-8fa2-428a65765be7 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1614352113; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=x+UT5oe5lNbLyAE6e6Zv15GL0RHN4l6DYQIIJarNa28=; b=ur3kDYEO4Mcs2GQ3c0qc6I0sN+JXwDs4JuxNqlYDYNAeemMyuy8OX4O2923Wd2JgZ4vbQG u4gOL6bLTaxmDIVDeRGzf/7cb0ctbKF9DVX0FAxR7MFyinxXCdam5TZIUCMnoXyea5Fsxh 5d23kLaIyf4itAGpC96/jId4PbgcJow= To: "xen-devel@lists.xenproject.org" Cc: Tim Deegan , George Dunlap , Andrew Cooper , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= , Ian Jackson From: Jan Beulich Subject: [PATCH][4.15] x86/shadow: replace bogus return path in shadow_get_page_from_l1e() Message-ID: Date: Fri, 26 Feb 2021 16:08:33 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Prior to be640b1800bb ("x86: make get_page_from_l1e() return a proper error code") a positive return value did indicate an error. Said commit failed to adjust this return path, but luckily the only caller has always been inside a shadow_mode_refcounts() conditional. Subsequent changes caused 1 to end up at the default (error) label in the caller's switch() again, but the returning of 1 (=3D=3D _PAGE_PRESENT) is still rather confusing here, and a latent risk. Convert to an ASSERT() instead, just in case any new caller would appear. Signed-off-by: Jan Beulich Acked-by: Tim Deegan Reviewed-by: Andrew Cooper --- a/xen/arch/x86/mm/shadow/multi.c +++ b/xen/arch/x86/mm/shadow/multi.c @@ -802,9 +802,7 @@ shadow_get_page_from_l1e(shadow_l1e_t sl struct domain *owner; =20 ASSERT(!sh_l1e_is_magic(sl1e)); - - if ( !shadow_mode_refcounts(d) ) - return 1; + ASSERT(shadow_mode_refcounts(d)); =20 res =3D get_page_from_l1e(sl1e, d, d); =20