1
0
Fork 0

scripts: headers_install: Exit with error on config leak

[ Upstream commit 5967577231 ]

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 <sidgup@codeaurora.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
5.4-rM2-2.2.x-imx-squashed
Siddharth Gupta 2020-05-05 18:52:37 -07:00 committed by Greg Kroah-Hartman
parent c707e18796
commit 4c8a62c939
1 changed files with 6 additions and 5 deletions

View File

@ -64,7 +64,7 @@ configs=$(sed -e '
d d
' $OUTFILE) ' $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. # Please do not add a new entry. This list is only for existing ones.
# The list will be reduced gradually, and deleted eventually. (hopefully) # 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 for c in $configs
do do
warn=1 leak_error=1
for ignore in $config_leak_ignores for ignore in $config_leak_ignores
do do
if echo "$INFILE:$c" | grep -q "$ignore$"; then if echo "$INFILE:$c" | grep -q "$ignore$"; then
warn= leak_error=
break break
fi fi
done done
if [ "$warn" = 1 ]; then if [ "$leak_error" = 1 ]; then
echo "warning: $INFILE: leak $c to user-space" >&2 echo "error: $INFILE: leak $c to user-space" >&2
exit 1
fi fi
done done