Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp6167868yba; Thu, 11 Apr 2019 13:33:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqyBJSWS0yK2IE7S6iSs4ikSGoey+ZDWStB6jhXsEDIzXuolz6AEiYWFfC0fpLC5+q387Qwk X-Received: by 2002:aa7:85cc:: with SMTP id z12mr51914395pfn.142.1555014828801; Thu, 11 Apr 2019 13:33:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555014828; cv=none; d=google.com; s=arc-20160816; b=klq+3wOiuqd+ne8x5Fjyo+uUcZpLSspUYY9tHqD8UGQHxZDfGde1GeLxBJX8AsgJ/H xD1q+vy9VncoURppWh3TtN4qpb755GOp3dCONnL+5FwpXYY5Thgv64+4AMwPW656wZ0b 6VIbPxLKtpVpAoSCvkUR1YGM8DGm0N8R+xEcj8sLLq0lmAoLhYUMR8cDkuYBtZBZCrBD TFIvlfnL7onfyX6tEscFc+x+ldag50YWnUBaxx8EREW8Afnw14iNyIOGIMEmwDyV0Y6S hYBYN9gIijqyaS93MeLH7MFov8uBkL4VXjtEYlJVWXUHVQVobp6lAk2HfqzLENa7fGgo YlKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Y9ffPpZWZSFDmzqrYJMKaghLmxEb8zkLpb7Gwn9WbSQ=; b=Q8Vau3xaXXzW7K0WOe21b8h5f9OKumMr4x7r5Nh4ERdC0aQasQ+4f92TP39hog0MDw QV04qdVqc6Bg74DstN5TCuWihnhz8m9H+CAR/yHbYC6hIuEbPRLe7m69nF7OIsmsP6eO LWeu4Wdh6QX7mIdtY14aixtu0XMW7wwRLqH8GpveVWKZrJPCBSCycYgV/5ZW4fVL3/cx QuE0cJ2iy6/o/NUNl2YXN6vY3RvuLeRMzK5WmIhSC+XFQNrrMQfbHhky2+blTMRfKCcu /VHw8MHXKxhLVZ4ai/V9/CCx8AINfHct1fimxB1cP1LM5kCpX4hbmJME8JOjyQLdWcW7 FAIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=VVGyhNv9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e14si35556885pfn.203.2019.04.11.13.33.32; Thu, 11 Apr 2019 13:33:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=VVGyhNv9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726898AbfDKUcs (ORCPT + 99 others); Thu, 11 Apr 2019 16:32:48 -0400 Received: from mail-vs1-f65.google.com ([209.85.217.65]:44124 "EHLO mail-vs1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726783AbfDKUcs (ORCPT ); Thu, 11 Apr 2019 16:32:48 -0400 Received: by mail-vs1-f65.google.com with SMTP id j184so4264903vsd.11 for ; Thu, 11 Apr 2019 13:32:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Y9ffPpZWZSFDmzqrYJMKaghLmxEb8zkLpb7Gwn9WbSQ=; b=VVGyhNv9UWJe+P4Vs1rphtpfW9mk7prj5YNPHiZvXGxx5PehFCsl/5HRpis6fQ3ad7 wBH/H6QveUhnARroIKDQPnwoI4PHL4gI508PXcMUxZmzJW7SBAe3JRP3RNosAiA94TOf nO7RC7PJeGT8GKT0dn4jH1uXwysyOiO+nFvB0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Y9ffPpZWZSFDmzqrYJMKaghLmxEb8zkLpb7Gwn9WbSQ=; b=ug7xzq0YCtRLDczN7S7w814Z8GDyDM6OR7ZM0+difaTQ8rbr9a6HpQ6B//5Qe79lsq nPHATaO0elINiIdNwN1E0gh2QIQH4IJkueOS5l0gyWBgN/Fk9vHYsHpye547StnNPpyb Q426iy/6ZBlBt3pk2co1SO9qRBPa9A7lvT8/qQTVGbgvgPWPuEJGs/vD5KZVqFY+hkzy hDZivEtlQGuOWAwbW/pEnLl0YIBtUa+4IvMBwRqlzau7X1FEqEVezRWcJReZWNtvG2Mh 6Xqq8T9BEtOxxmDHY5k21ybJk0sRg9swxO4rknKy+qUYNyAdaIjF5pQvenoa7Iv/AlKB 9dDg== X-Gm-Message-State: APjAAAWVos09/WOcKqMXemJZmV7tI00GUvDvjV/p9zW+CcbgDtOGBn3x Q/RS7RJpoE0xNpv/XKi/ZcyCfM0+z/I= X-Received: by 2002:a67:f693:: with SMTP id n19mr29062127vso.89.1555014766158; Thu, 11 Apr 2019 13:32:46 -0700 (PDT) Received: from mail-ua1-f47.google.com (mail-ua1-f47.google.com. [209.85.222.47]) by smtp.gmail.com with ESMTPSA id w79sm13482566vkw.51.2019.04.11.13.32.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Apr 2019 13:32:45 -0700 (PDT) Received: by mail-ua1-f47.google.com with SMTP id l17so2502822uar.4 for ; Thu, 11 Apr 2019 13:32:44 -0700 (PDT) X-Received: by 2002:ab0:60cd:: with SMTP id g13mr27523621uam.85.1555014764346; Thu, 11 Apr 2019 13:32:44 -0700 (PDT) MIME-Version: 1.0 References: <20190411192607.GD225654@gmail.com> <20190411192827.72551-1-ebiggers@kernel.org> In-Reply-To: <20190411192827.72551-1-ebiggers@kernel.org> From: Kees Cook Date: Thu, 11 Apr 2019 13:32:32 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] crypto: testmgr - allocate buffers with __GFP_COMP To: Eric Biggers , Rik van Riel , Matthew Wilcox Cc: linux-crypto , Herbert Xu , Kees Cook , Dmitry Vyukov , Geert Uytterhoeven , linux-security-module , Linux ARM , Linux Kernel Mailing List , Laura Abbott Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 11, 2019 at 12:31 PM Eric Biggers wrote: > > From: Eric Biggers > > This is needed so that CONFIG_HARDENED_USERCOPY_PAGESPAN=y doesn't > incorrectly report a buffer overflow when the destination of > copy_from_iter() spans the page boundary in the 2-page buffer. > > Fixes: 3f47a03df6e8 ("crypto: testmgr - add testvec_config struct and helper functions") > Signed-off-by: Eric Biggers Reviewed-by: Kees Cook > --- > crypto/testmgr.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/crypto/testmgr.c b/crypto/testmgr.c > index 0f6bfb6ce6a46..3522c0bed2492 100644 > --- a/crypto/testmgr.c > +++ b/crypto/testmgr.c > @@ -156,7 +156,8 @@ static int __testmgr_alloc_buf(char *buf[XBUFSIZE], int order) > int i; > > for (i = 0; i < XBUFSIZE; i++) { > - buf[i] = (char *)__get_free_pages(GFP_KERNEL, order); > + buf[i] = (char *)__get_free_pages(GFP_KERNEL | __GFP_COMP, > + order); Is there a reason __GFP_COMP isn't automatically included in all page allocations? (Or rather, it seems like the exception is when things should NOT be considered part of the same allocation, so something like __GFP_SINGLE should exist?.) -Kees > if (!buf[i]) > goto err_free_buf; > } > -- > 2.21.0.392.gf8f6787159e-goog > -- Kees Cook