Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp3900608rwl; Tue, 27 Dec 2022 17:46:28 -0800 (PST) X-Google-Smtp-Source: AMrXdXtqCPN31Ul06Ar4QgpjjrUbMysmCxAmIvKeKTBxSWZ6nyORk+GAuQ3OhkJ3p4E7LF87OPmu X-Received: by 2002:aa7:9e11:0:b0:576:c2f0:d6a1 with SMTP id y17-20020aa79e11000000b00576c2f0d6a1mr27142627pfq.8.1672191988020; Tue, 27 Dec 2022 17:46:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672191988; cv=none; d=google.com; s=arc-20160816; b=y5iQpTg+Tw4Mjpl8hfv1nZn/xZDDLpvk1jBFsOXRfJe99bdEqGjFRwsR4n9X3mOABm 6Rpvs/wGolK9FPPReQFJGwT+gAcQ5rD/lUUN6W1UW9PouhjGK8TVNa865B85BboZ4OWy zVx44fHSR3bfthgqxLoGRMMRNqOcz4jK65ISb/0dStVRNI2ptjzTRsPsLBv2i03Zvgmx bJR6IRouwT3ixpzpetYVn1N1/OYkcaqmCGnSGNVMy+hGFgumfBWmDmxUHZ4iaD1QNti6 5KlH+sWxJr4Xxp0MkEismx9HnFlpHw319/MQEBuQxyXvKnS1oW2mSMQ8dIqnVU73EHMW EKRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=g6bjfzIsOTMHvB0nO+i4beQ5Ky8CnGEgnwaSzt1eO1w=; b=clMsE/U+gWHuCaoM/1SHD+trneceOGbN72QRfHt6T/OVZypmkEmDhqc06dQlwIOTB4 Lce0eLhKt+DLDgdikUJ6TF6+dQc1EW5fgweNbiOzK4yDa5pru9v1tzleQiRerffI3RFY 0YIDCZXMc58i0LV3LVoh6t3BJT6h9CxsnOBsMN80z+HvqBx4HIvo3EL5tp34W/BQ+0Ut XPMgOuH3jNnNjR8gLKkd4UzOz+0feHyX3X/j17EPQPLTc8eNdvQMxUdfmALRicAJmscY xrg8DU7QnaGLFwQw4B8/sC0tcy4BrPt82R4n1VJRbbw5d1WQG3YsvVr4gPqzy9yFmQly wpuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=glOWut5A; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y2-20020aa793c2000000b0056b81818621si14850996pff.157.2022.12.27.17.46.05; Tue, 27 Dec 2022 17:46:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-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=@google.com header.s=20210112 header.b=glOWut5A; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231945AbiL1Bmh (ORCPT + 99 others); Tue, 27 Dec 2022 20:42:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231736AbiL1Bmg (ORCPT ); Tue, 27 Dec 2022 20:42:36 -0500 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52B6EDE82 for ; Tue, 27 Dec 2022 17:42:33 -0800 (PST) Received: by mail-pl1-x62d.google.com with SMTP id m4so14762890pls.4 for ; Tue, 27 Dec 2022 17:42:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=g6bjfzIsOTMHvB0nO+i4beQ5Ky8CnGEgnwaSzt1eO1w=; b=glOWut5AkVu+Koo4rLs/qj4V37l+tRBeeir9MhYk/NSQOecfiGnY5wdlQVhTcZrTjl GHhTA+wX6oXi5gfQU3nn+ds7IngrXKA68BHyKgIUgHCPZYmcCbE4h3q/oZ481oEsAbfD w/vISmmDIZovcR4wwChoJXpZEojz43H/3Db0CDOSKL4d72S/qmu/LGW3lMt20Uhedqaw VydHS0bk9ivcinxJqaEofKrCBVciq0W+koKRjaF3GdyWwni1hTH42OqwWS1qUgDHIdtx 8RdToxei/XMKx+t+1LedFahihjM4mTRB4h2e5Y8MkjL39pZm/CDltsLXQFAMsRtzwmlj L2zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=g6bjfzIsOTMHvB0nO+i4beQ5Ky8CnGEgnwaSzt1eO1w=; b=gUAceoR2oZpWnS3mIVzJKGFCnownrBG2FP4tTNoY/8hu1ouFTGGbN6l9x7DZFUwqOo HN3fKI7kS+cPJAnh6XcT136qhiB3aJiEYWFi3B56vN9fyrlOh5gA7EPu1MB7IY50L19C sa4dx/1iLX5oKW+qEQYqceufKyOv1LF3jkcQIxPoFl53S6Y2kPkP0iMyuKHpyg+R5GZQ Q9075lD+yuaG7PAe5ZIYoCfojEY6C+K9E+maOAgpwW8O0N1pP7EM2o9XG7wJ4R8ofEfb NxkPSGRQ7hixDJO5q8LW4liN7JDUKewYfR6/y38DW8dmegMIke3/v9gyyzGY5vD4XiFP G71A== X-Gm-Message-State: AFqh2kpHO3RHob/+9sCmaXXIOLHsBBHtuqkmkHl+el/L4cxp3qO9yyLr ODnlbmDwNb4/EKtOnrF2hagTKw== X-Received: by 2002:a05:6a20:7f59:b0:ac:af5c:2970 with SMTP id e25-20020a056a207f5900b000acaf5c2970mr1637909pzk.3.1672191752691; Tue, 27 Dec 2022 17:42:32 -0800 (PST) Received: from [2620:15c:29:203:93f7:84:3b7b:8294] ([2620:15c:29:203:93f7:84:3b7b:8294]) by smtp.gmail.com with ESMTPSA id n8-20020a654cc8000000b00478dad38eacsm8545514pgt.38.2022.12.27.17.42.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Dec 2022 17:42:31 -0800 (PST) Date: Tue, 27 Dec 2022 17:42:31 -0800 (PST) From: David Rientjes To: Herbert Xu cc: Peter Gonda , Andy Nguyen , stable@vger.kernel.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, John Allen , "Thomas . Lendacky" Subject: Re: [PATCH] crypto: ccp - Limit memory allocation in SEV_GET_ID2 ioctl In-Reply-To: Message-ID: <762d33dc-b5fd-d1ef-848c-7de3a6695557@google.com> References: <20221214202046.719598-1-pgonda@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable 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-crypto@vger.kernel.org On Thu, 15 Dec 2022, Herbert Xu wrote: > On Wed, Dec 14, 2022 at 12:20:46PM -0800, Peter Gonda wrote: > > Currently userspace can ask for any uint32 size allocation for the > > SEV_GET_ID2. Limit this allocation size to the max physically > > contiguously allocation: MAX_ORDER. > > This is just to silence the alloc_pages warning, right? If so > how about adding __GFP_NOWARN instead? > The goal was to be more explicit about that, but setting __GFP_NOWARN would result in the same functional behavior. If we're to go that route, it would likely be best to add a comment about the limitation. That said, if AMD would prefer this to be an EINVAL instead of a ENOMEM by introducing a more formal limitation on the length that can be used, that would be preferred so that we don't need to rely on the page allocator's max length to enforce this arbitrarily.