Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp208367pxp; Fri, 11 Mar 2022 02:41:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJzVRibQnxry/S/SbmQ0sDcK9jvFqcMrkySc9muQS7xPdJjqzaAEKOtCQ9q+j2Dyd/9lcmOe X-Received: by 2002:a17:90a:a58e:b0:1bd:4752:90cf with SMTP id b14-20020a17090aa58e00b001bd475290cfmr10028549pjq.54.1646995270008; Fri, 11 Mar 2022 02:41:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646995270; cv=none; d=google.com; s=arc-20160816; b=m6sq6+SC45XQefZkcT79HC4nHqrwPCPvNTx0Vhs+fQj+4bVUQhhSdk9aNqVgJRY+OV Noyvpt22524Bf9D4ZynVY9IzwrPLd7muRk2flS2qdrsnjZUPlVC+GKIyeRIEQ9x+qXwS TYGkt5l03wXnmWvmUBuX91XOUwcXpcQT4gtqmBD0erjj1w9GILJ/6NZYsB0r/wMYpOW4 x0rzQNAnKMrfqVTKze5JfTvf+h3hevuHqFpCNri/d7WQso1YHvUT5ACNH8oNKZze21mA QlPPtPc+sF2Ya73PCtcxdWblYlLdCvUKpu1KyrtA3YHEM8ZsmEYMtXL9bHQFl9BELUci 8bfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=s5ny7G8fUw85VNlu1HxikRJ6/nzoR+nLPHCEp7gFWaI=; b=GJzOznwtZWRJvnd3GHMkDmfv/kt5s3SbLFA+tTf/9kRUnbq7ZjM4Z5e8O7hoPHbwLY TfKcYCQDpcFo1Lw2ECgfwZx/p54GL5auVAtxM89feF3kpswTfsU5FYPkF5V758pGiLhR VdGhPpaB3QrrfWHL1ulMQPBjwOmCMIwQQadz4XvtqrVHSjVGnjqJv4cxSGXy6eubULgT 1vUWLOp1aL5PWZZxL0cno148tnQ+8bI1wKDFFSJomaegLLiliYTRi2YX27TUBbCfQDVD Uxb9cLdmVBgI4kIt0f25IRDyVQZgEINT4NhSkoY9G0bWy+50fFKYbjNDTr8Zd8WSp9Td 5tsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nJx9bp65; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f77-20020a623850000000b004f6fc3734f2si3763995pfa.173.2022.03.11.02.40.54; Fri, 11 Mar 2022 02:41:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nJx9bp65; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244388AbiCJOdX (ORCPT + 99 others); Thu, 10 Mar 2022 09:33:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244086AbiCJO22 (ORCPT ); Thu, 10 Mar 2022 09:28:28 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95F79BD2F9; Thu, 10 Mar 2022 06:23:14 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C439BB82676; Thu, 10 Mar 2022 14:23:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05D6EC340E8; Thu, 10 Mar 2022 14:23:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646922185; bh=uwDr3cv7AGRRm8ArEDBYRUPoxrkysORCSNU0BMP31ug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nJx9bp65aNKA3h45xi2OrH9yPwVP9YqdTzpe7fdpJJwSZdkaW9R8xzBknnmCuY70a AaMBVafDR8n5SHkLSMSFwF8hLqlnU3RXC2cU9wZk5O6vukW2JgQQioWCBbBp/DfqWR 4+yJvKG620vVeS8H0Z/d8MM08fob67//pFvjibp4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Simon Gaiser , Juergen Gross , Jan Beulich Subject: [PATCH 4.19 31/33] xen/pvcalls: use alloc/free_pages_exact() Date: Thu, 10 Mar 2022 15:18:58 +0100 Message-Id: <20220310140808.662126017@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220310140807.749164737@linuxfoundation.org> References: <20220310140807.749164737@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Juergen Gross Commit b0576cc9c6b843d99c6982888d59a56209341888 upstream. Instead of __get_free_pages() and free_pages() use alloc_pages_exact() and free_pages_exact(). This is in preparation of a change of gnttab_end_foreign_access() which will prohibit use of high-order pages. This is part of CVE-2022-23041 / XSA-396. Reported-by: Simon Gaiser Signed-off-by: Juergen Gross Reviewed-by: Jan Beulich Signed-off-by: Greg Kroah-Hartman --- drivers/xen/pvcalls-front.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/xen/pvcalls-front.c +++ b/drivers/xen/pvcalls-front.c @@ -346,8 +346,8 @@ static void free_active_ring(struct sock if (!map->active.ring) return; - free_pages((unsigned long)map->active.data.in, - map->active.ring->ring_order); + free_pages_exact(map->active.data.in, + PAGE_SIZE << map->active.ring->ring_order); free_page((unsigned long)map->active.ring); } @@ -361,8 +361,8 @@ static int alloc_active_ring(struct sock goto out; map->active.ring->ring_order = PVCALLS_RING_ORDER; - bytes = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, - PVCALLS_RING_ORDER); + bytes = alloc_pages_exact(PAGE_SIZE << PVCALLS_RING_ORDER, + GFP_KERNEL | __GFP_ZERO); if (!bytes) goto out;