From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B02FAC433DF for ; Thu, 18 Jun 2020 02:36:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 905C220720 for ; Thu, 18 Jun 2020 02:36:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592447788; bh=0hZx3zP10Ds1j10gCx37S3rT5JDXBnvUZQIeZ4Q/Jbo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=rA2+6XeuHOoPXh1S+r9lE/8I3x7TYEEX5EtGWeTx4K9nCGI3MOjavnDOblKFHuDTt J+pbOXk1bgbsd9sRvclt1MQamyOEV1r/57jIz566jzlKkFxaoAUt3iNo6+gtHveNa1 mrsvvmO2C0VAl33B4gNEmWOO4UmUrNKpaVqXwpt0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731276AbgFRCg0 (ORCPT ); Wed, 17 Jun 2020 22:36:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:43422 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729241AbgFRBN5 (ORCPT ); Wed, 17 Jun 2020 21:13:57 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (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 EBE9221974; Thu, 18 Jun 2020 01:13:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592442836; bh=0hZx3zP10Ds1j10gCx37S3rT5JDXBnvUZQIeZ4Q/Jbo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sdI9z0YBf/+zOneeLxr+G5IJ9Pof+A0vVAiY92f8fdXDCcoQ0sKtdLS7pE5c6XiqE PhjkkYA4D/XCRn47l/YeB+9zFC9TUX1ZOB7xXdaOSg8djyOxxyhWAHD3i8QhOG4sdg hSEPqxvFBYpyMV/xGNqjOHV26Ui23S83cUm+klTw= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Siddharth Gupta , Masahiro Yamada , Sasha Levin Subject: [PATCH AUTOSEL 5.7 270/388] scripts: headers_install: Exit with error on config leak Date: Wed, 17 Jun 2020 21:06:07 -0400 Message-Id: <20200618010805.600873-270-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200618010805.600873-1-sashal@kernel.org> References: <20200618010805.600873-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Siddharth Gupta [ Upstream commit 5967577231f9b19acd5a59485e9075964065bbe3 ] Misuse of CONFIG_* in UAPI headers should result in an error. These config options can be set in userspace by the user application which includes these headers to control the APIs and structures being used in a kernel which supports multiple targets. Signed-off-by: Siddharth Gupta Signed-off-by: Masahiro Yamada Signed-off-by: Sasha Levin --- scripts/headers_install.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/headers_install.sh b/scripts/headers_install.sh index a07668a5c36b..94a833597a88 100755 --- a/scripts/headers_install.sh +++ b/scripts/headers_install.sh @@ -64,7 +64,7 @@ configs=$(sed -e ' d ' $OUTFILE) -# The entries in the following list are not warned. +# The entries in the following list do not result in an error. # Please do not add a new entry. This list is only for existing ones. # The list will be reduced gradually, and deleted eventually. (hopefully) # @@ -98,18 +98,19 @@ include/uapi/linux/raw.h:CONFIG_MAX_RAW_DEVS for c in $configs do - warn=1 + leak_error=1 for ignore in $config_leak_ignores do if echo "$INFILE:$c" | grep -q "$ignore$"; then - warn= + leak_error= break fi done - if [ "$warn" = 1 ]; then - echo "warning: $INFILE: leak $c to user-space" >&2 + if [ "$leak_error" = 1 ]; then + echo "error: $INFILE: leak $c to user-space" >&2 + exit 1 fi done -- 2.25.1