From: Daniel Drake <dsd@gentoo.org>
To: sam@ravnborg.org
Cc: linux-kernel@vger.kernel.org
Cc: miraze@web.de
Subject: [PATCH] kbuild: Write astest files to $(KBUILD_EXTMOD) directory
Date: Sat, 2 Dec 2006 19:45:44 +0000 (GMT) [thread overview]
Message-ID: <20061202194544.D9F057B40A0@zog.reactivated.net> (raw)
The astest code in 2.6.19 causes problems for Gentoo and other distributions
building external kernel modules in sandboxes. kbuild has generally been
pretty good at not violating the sandbox for quite a while, I hope we can
keep it that way.
Right now it writes to a temporary astest file in the current directory
(i.e. /usr/src/linux), this is because it is found that writing to /dev/null
is not safe because as deletes its output file on failure.
To clarify what a sandbox is: Gentoo's package system compiles the package
in /var/tmp/portage and while that package is building it restricts writes
to parts of the filesystem outside of /var/tmp/portage and /tmp. If the
external module tries to write to another location on the real filesystem such
as /usr/src/linux, the build is aborted due to sandbox violation.
This patch prefixes the astest file path with the KBUILD_EXTMOD path if
an external kernel module is being built. The behaviour in other situations
is unmodified.
Signed-off-by: Daniel Drake <dsd@gentoo.org>
Index: linux-2.6.19/scripts/Kbuild.include
===================================================================
--- linux-2.6.19.orig/scripts/Kbuild.include
+++ linux-2.6.19/scripts/Kbuild.include
@@ -66,9 +66,11 @@ as-option = $(shell if $(CC) $(CFLAGS) $
# as-instr
# Usage: cflags-y += $(call as-instr, instr, option1, option2)
-as-instr = $(shell if echo -e "$(1)" | $(AS) >/dev/null 2>&1 -W -Z -o astest$$$$.out ; \
+as-instr = $(shell if echo -e "$(1)" | $(AS) >/dev/null 2>&1 -W -Z -o \
+ $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/)astest$$$$.out ; \
then echo "$(2)"; else echo "$(3)"; fi; \
- rm -f astest$$$$.out)
+ rm -f \
+ $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/)astest$$$$.out)
# cc-option
# Usage: cflags-y += $(call cc-option, -march=winchip-c6, -march=i586)
next reply other threads:[~2006-12-02 19:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-02 19:45 Daniel Drake [this message]
2006-12-04 8:45 ` Andrew Morton
2006-12-04 14:11 ` Daniel Drake
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061202194544.D9F057B40A0@zog.reactivated.net \
--to=dsd@gentoo.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sam@ravnborg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®