[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1398437808-9263-1-git-send-email-mmarek@suse.cz>
Date: Fri, 25 Apr 2014 16:56:48 +0200
From: Michal Marek <mmarek@...e.cz>
To: linux-kernel@...r.kernel.org, linux-kbuild@...r.kernel.org
Cc: David Howells <dhowells@...hat.com>
Subject: [RFC] UAPI: Prevent kernel modules from using the exported headers
Mandriva/Mageia and SUSE have been adding an #error statement to the
/usr/include/linux/version.h header and it does trigger with broken out
of tree modules occasionally. Adding it to all exported headers should
not hurt and is easier to implement.
Signed-off-by: Michal Marek <mmarek@...e.cz>
---
scripts/headers_install.sh | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/scripts/headers_install.sh b/scripts/headers_install.sh
index 5de5660..1c787da 100644
--- a/scripts/headers_install.sh
+++ b/scripts/headers_install.sh
@@ -30,16 +30,19 @@ trap 'rm -f "$OUTDIR/$FILE" "$OUTDIR/$FILE.sed"' EXIT
for i in "$@"
do
FILE="$(basename "$i")"
+ scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ "$SRCDIR/$i" \
+ > "$OUTDIR/$FILE.sed"
sed -r \
+ -e '1i #ifdef __KERNEL__' \
+ -e '1i #error Kernel modules must not include files from /usr/include/' \
+ -e '1i #endif' \
-e 's/([ \t(])(__user|__force|__iomem)[ \t]/\1/g' \
-e 's/__attribute_const__([ \t]|$)/\1/g' \
-e 's@...nclude <linux/compiler.h>@@' \
-e 's/(^|[^a-zA-Z0-9])__packed([^a-zA-Z0-9_]|$)/\1__attribute__((packed))\2/g' \
-e 's/(^|[ \t(])(inline|asm|volatile)([ \t(]|$)/\1__\2__\3/g' \
-e 's@#(ifndef|define|endif[ \t]*/[*])[ \t]*_UAPI@#\1 @' \
- "$SRCDIR/$i" > "$OUTDIR/$FILE.sed" || exit 1
- scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ "$OUTDIR/$FILE.sed" \
- > "$OUTDIR/$FILE"
+ "$OUTDIR/$FILE.sed" >"$OUTDIR/$FILE" || exit 1
[ $? -gt 1 ] && exit 1
rm -f "$OUTDIR/$FILE.sed"
done
--
1.8.4.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists