Message ID | 20230208065133.220589-1-ebiggers@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3298940wrn; Tue, 7 Feb 2023 22:57:42 -0800 (PST) X-Google-Smtp-Source: AK7set9ztNoqqFLQHTf/Ga+rTcZ1ZSlmEeUuyUSOoEqCulw3h0h2dfXJ7d8g36p28IBtnDa4oDxg X-Received: by 2002:a05:6a20:12c9:b0:af:98cd:7df1 with SMTP id v9-20020a056a2012c900b000af98cd7df1mr8479593pzg.24.1675839462623; Tue, 07 Feb 2023 22:57:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675839462; cv=none; d=google.com; s=arc-20160816; b=qmQtTqWjdMGwyC0F7g0r03HseTvSTJVkwNRw70ngY8DjUi7XWodYOLluy1FJkht13Z 9hWXJ0KY/qxBaOqpGpa6YE9Zgd+JQyiVmE/+yT33p1OxBVhMA8DshtU5cBzidnIVQTbY i+85q8wP9lVn932s8k1Dgh1nsLv/EG5EcMi2x0sjmyT6pw7+SBcX5T5yn2GvFHDUH+7C Gj02IVgFLF8NcJu59PT5XXJimuXLi7sc5tmE6dl+LQhNyRhWv7LtJPlUoKP3H8h/XGjN QZVZm0YXunH9ts33k25KjGzBJh2XAnjfOv/KYfqY7vd8y0C6Efj3OJ0D5FGmDZ392uZy i5uw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=fV0D+hF9Lbj+S0KVYyzGZAuiXpYFi1TRcopBBnfyJJY=; b=XgDBnGZWQx+r8rwU9A2AbpZp/NBalPV0j5j6dRUJF0Ttfc51wPXnLy3+Pd1BpGtQsv ueHyV404koZyx+8b+aKEZLGsdC7yShqvh+8KDiXfKmjHfGzovkch+/LM7MWqFHGywBNA SPiFkCB+qgmpE115GhZsC8LUXRhr7NvEbwCEOAkmZdu6jgopOeLoJw0EQkXchqQEbgtg lh4z31MJBsEnQzJ4RndfxheZ41/ejY4/IDW5mJuB3huCdmdKFuPm1mX11KqSbRQGpTqP 6symYDJEGMcY6psEmqfePtsVCHhGN7ioCctE3w644pXYt0d4/r/3ts+J8W8gy+jHeeXX AgvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RyDU3ix2; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h191-20020a636cc8000000b00476e62744a8si17288001pgc.388.2023.02.07.22.57.28; Tue, 07 Feb 2023 22:57:42 -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=@kernel.org header.s=k20201202 header.b=RyDU3ix2; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230040AbjBHGw0 (ORCPT <rfc822;kmanaouilinux@gmail.com> + 99 others); Wed, 8 Feb 2023 01:52:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229490AbjBHGwZ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 8 Feb 2023 01:52:25 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3057442E5; Tue, 7 Feb 2023 22:52:24 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 55085614A9; Wed, 8 Feb 2023 06:52:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 802ECC433EF; Wed, 8 Feb 2023 06:52:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1675839143; bh=1P71LfU0+7FJhlIeYP8dlsmXxGhh3Acgaywm3d013ZY=; h=From:To:Cc:Subject:Date:From; b=RyDU3ix2lD9bR86sxLas/tTYmH28sDiYAj6aJu6q1z1coHn1ODc7pYp24nYo3EMex XAuMLx/oCkn3UOiv+LgZCzSXDYTBSKPgSNYvtYbg4rFoeHi5lEMvrey8kBp12VBh3B EOHEH+kYvp+Huh18W7A7c9XLb/Wzv/5TfoTMQTobJP1JXCZDKFyOP/F0Ib19L72Hpd 5R7KWA//vxQsXCiKuq1b3vPigUT1JRH3wY2D9K0QlekGSHM0YOfFukMByEi+w8bElH hQH5RuQ6BPTSrzPm2Q/rtC+R7iaYhMYmrVzOWKC5R70Ht0E++MuEKCE8+n0Idt5aYE RtebwbDa60i3w== From: Eric Biggers <ebiggers@kernel.org> To: linux-hardening@vger.kernel.org, Kees Cook <keescook@chromium.org> Cc: Bill Wendling <morbo@google.com>, llvm@lists.linux.dev, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH] randstruct: disable Clang 15 support Date: Tue, 7 Feb 2023 22:51:33 -0800 Message-Id: <20230208065133.220589-1-ebiggers@kernel.org> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 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 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757245040478141756?= X-GMAIL-MSGID: =?utf-8?q?1757245040478141756?= |
Series |
randstruct: disable Clang 15 support
|
|
Commit Message
Eric Biggers
Feb. 8, 2023, 6:51 a.m. UTC
From: Eric Biggers <ebiggers@google.com> The randstruct support released in Clang 15 is unsafe to use due to a bug that can cause miscompilations: "-frandomize-layout-seed inconsistently randomizes all-function-pointers structs" (https://github.com/llvm/llvm-project/issues/60349). It has been fixed on the Clang 16 release branch, so add a Clang version check. Fixes: 035f7f87b729 ("randstruct: Enable Clang support") Cc: stable@vger.kernel.org Signed-off-by: Eric Biggers <ebiggers@google.com> --- security/Kconfig.hardening | 3 +++ 1 file changed, 3 insertions(+) base-commit: 4ec5183ec48656cec489c49f989c508b68b518e3
Comments
On Tue, Feb 07, 2023 at 10:51:33PM -0800, Eric Biggers wrote: > From: Eric Biggers <ebiggers@google.com> > > The randstruct support released in Clang 15 is unsafe to use due to a > bug that can cause miscompilations: "-frandomize-layout-seed > inconsistently randomizes all-function-pointers structs" > (https://github.com/llvm/llvm-project/issues/60349). It has been fixed > on the Clang 16 release branch, so add a Clang version check. > > Fixes: 035f7f87b729 ("randstruct: Enable Clang support") > Cc: stable@vger.kernel.org > Signed-off-by: Eric Biggers <ebiggers@google.com> Reviewed-by: Nathan Chancellor <nathan@kernel.org> > --- > security/Kconfig.hardening | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/security/Kconfig.hardening b/security/Kconfig.hardening > index 53baa95cb644f..0f295961e7736 100644 > --- a/security/Kconfig.hardening > +++ b/security/Kconfig.hardening > @@ -281,6 +281,9 @@ endmenu > > config CC_HAS_RANDSTRUCT > def_bool $(cc-option,-frandomize-layout-seed-file=/dev/null) > + # Randstruct was first added in Clang 15, but it isn't safe to use until > + # Clang 16 due to https://github.com/llvm/llvm-project/issues/60349 > + depends on !CC_IS_CLANG || CLANG_VERSION >= 160000 > > choice > prompt "Randomize layout of sensitive kernel structures" > > base-commit: 4ec5183ec48656cec489c49f989c508b68b518e3 > -- > 2.39.1 > >
On Wed, Feb 8, 2023 at 6:32 AM Nathan Chancellor <nathan@kernel.org> wrote: > > On Tue, Feb 07, 2023 at 10:51:33PM -0800, Eric Biggers wrote: > > From: Eric Biggers <ebiggers@google.com> > > > > The randstruct support released in Clang 15 is unsafe to use due to a > > bug that can cause miscompilations: "-frandomize-layout-seed > > inconsistently randomizes all-function-pointers structs" > > (https://github.com/llvm/llvm-project/issues/60349). It has been fixed > > on the Clang 16 release branch, so add a Clang version check. > > > > Fixes: 035f7f87b729 ("randstruct: Enable Clang support") > > Cc: stable@vger.kernel.org > > Signed-off-by: Eric Biggers <ebiggers@google.com> > > Reviewed-by: Nathan Chancellor <nathan@kernel.org> > Reviewed-by: Bill Wendling <morbo@google.com> > > --- > > security/Kconfig.hardening | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/security/Kconfig.hardening b/security/Kconfig.hardening > > index 53baa95cb644f..0f295961e7736 100644 > > --- a/security/Kconfig.hardening > > +++ b/security/Kconfig.hardening > > @@ -281,6 +281,9 @@ endmenu > > > > config CC_HAS_RANDSTRUCT > > def_bool $(cc-option,-frandomize-layout-seed-file=/dev/null) > > + # Randstruct was first added in Clang 15, but it isn't safe to use until > > + # Clang 16 due to https://github.com/llvm/llvm-project/issues/60349 > > + depends on !CC_IS_CLANG || CLANG_VERSION >= 160000 > > > > choice > > prompt "Randomize layout of sensitive kernel structures" > > > > base-commit: 4ec5183ec48656cec489c49f989c508b68b518e3 > > -- > > 2.39.1 > > > >
On Tue, Feb 7, 2023 at 10:52 PM Eric Biggers <ebiggers@kernel.org> wrote: > > From: Eric Biggers <ebiggers@google.com> > > The randstruct support released in Clang 15 is unsafe to use due to a > bug that can cause miscompilations: "-frandomize-layout-seed > inconsistently randomizes all-function-pointers structs" > (https://github.com/llvm/llvm-project/issues/60349). It has been fixed > on the Clang 16 release branch, so add a Clang version check. > > Fixes: 035f7f87b729 ("randstruct: Enable Clang support") > Cc: stable@vger.kernel.org > Signed-off-by: Eric Biggers <ebiggers@google.com> Thanks for the patch and report. Guessing that wasn't fun to debug. Acked-by: Nick Desaulniers <ndesaulniers@google.com> > --- > security/Kconfig.hardening | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/security/Kconfig.hardening b/security/Kconfig.hardening > index 53baa95cb644f..0f295961e7736 100644 > --- a/security/Kconfig.hardening > +++ b/security/Kconfig.hardening > @@ -281,6 +281,9 @@ endmenu > > config CC_HAS_RANDSTRUCT > def_bool $(cc-option,-frandomize-layout-seed-file=/dev/null) > + # Randstruct was first added in Clang 15, but it isn't safe to use until > + # Clang 16 due to https://github.com/llvm/llvm-project/issues/60349 > + depends on !CC_IS_CLANG || CLANG_VERSION >= 160000 > > choice > prompt "Randomize layout of sensitive kernel structures" > > base-commit: 4ec5183ec48656cec489c49f989c508b68b518e3 > -- > 2.39.1 > >
On Tue, 7 Feb 2023 22:51:33 -0800, Eric Biggers wrote: > From: Eric Biggers <ebiggers@google.com> > > The randstruct support released in Clang 15 is unsafe to use due to a > bug that can cause miscompilations: "-frandomize-layout-seed > inconsistently randomizes all-function-pointers structs" > (https://github.com/llvm/llvm-project/issues/60349). It has been fixed > on the Clang 16 release branch, so add a Clang version check. > > [...] Applied to for-next/hardening, thanks! [1/1] randstruct: disable Clang 15 support https://git.kernel.org/kees/c/7ee3819f2ba9
diff --git a/security/Kconfig.hardening b/security/Kconfig.hardening index 53baa95cb644f..0f295961e7736 100644 --- a/security/Kconfig.hardening +++ b/security/Kconfig.hardening @@ -281,6 +281,9 @@ endmenu config CC_HAS_RANDSTRUCT def_bool $(cc-option,-frandomize-layout-seed-file=/dev/null) + # Randstruct was first added in Clang 15, but it isn't safe to use until + # Clang 16 due to https://github.com/llvm/llvm-project/issues/60349 + depends on !CC_IS_CLANG || CLANG_VERSION >= 160000 choice prompt "Randomize layout of sensitive kernel structures"