From patchwork Thu Apr 11 19:28:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 10896747 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 193371708 for ; Thu, 11 Apr 2019 19:31:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A0DB28DA3 for ; Thu, 11 Apr 2019 19:31:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F21E528DA7; Thu, 11 Apr 2019 19:31:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B319D28DA3 for ; Thu, 11 Apr 2019 19:31:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726615AbfDKTbV (ORCPT ); Thu, 11 Apr 2019 15:31:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:44864 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726137AbfDKTbV (ORCPT ); Thu, 11 Apr 2019 15:31:21 -0400 Received: from ebiggers-linuxstation.mtv.corp.google.com (unknown [104.132.1.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AB8EF206BA; Thu, 11 Apr 2019 19:31:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555011081; bh=ycO9yGHUX+7rVRcrLCRFLTp3y2AZo4I1kFRK4y83NAI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pZIr1QirXMr4zf+bzOukody9xmdqxnZchuRy+QI6v8+BiE7dmuYuHFWtIPu9kil/O iPaS6bhOwJO3+Gqij8dxjmVJPJws8N7e1dosXN62V0pI2D7qNo4qYQ4x/W6w6V7kN+ USubL0sTI/DSOWcu4x+kb6/lz/B6gSIeSgrWXKHc= From: Eric Biggers To: linux-crypto@vger.kernel.org, Herbert Xu Cc: Kees Cook , Dmitry Vyukov , Geert Uytterhoeven , linux-security-module , Linux ARM , Linux Kernel Mailing List , Laura Abbott , Rik van Riel Subject: [PATCH] crypto: testmgr - allocate buffers with __GFP_COMP Date: Thu, 11 Apr 2019 12:28:27 -0700 Message-Id: <20190411192827.72551-1-ebiggers@kernel.org> X-Mailer: git-send-email 2.21.0.392.gf8f6787159e-goog In-Reply-To: <20190411192607.GD225654@gmail.com> References: <20190411192607.GD225654@gmail.com> MIME-Version: 1.0 Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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); if (!buf[i]) goto err_free_buf; }