Bug 7261 - astest in "scripts/Kbuild.include" in 2.6.18-mmx kernels causing sandbox violations
Summary: astest in "scripts/Kbuild.include" in 2.6.18-mmx kernels causing sandbox viol...
Status: CLOSED CODE_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: Other (show other bugs)
Hardware: i386 Linux
: P2 low
Assignee: Sam Ravnborg
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-04 04:53 UTC by Jan Peter den Heijer
Modified: 2007-05-31 11:38 UTC (History)
2 users (show)

See Also:
Kernel Version: 2.6.18-mm1, 2.6.18-mm2, 2.6.18-mm3
Subsystem:
Regression: ---
Bisected commit-id:


Attachments
proposed patch to send output of astest to /dev/null instead of a file (649 bytes, patch)
2006-10-04 04:57 UTC, Jan Peter den Heijer
Details | Diff
Patch to put astest$$$$.out files in module source tree when building external modules (769 bytes, patch)
2006-10-06 01:50 UTC, Jan Peter den Heijer
Details | Diff
Patch to put astest$$$$.out files in module source tree when building external modules (769 bytes, patch)
2006-10-06 01:50 UTC, Jan Peter den Heijer
Details | Diff
proposed patch: kbuild puts astest$$$$.out files in modules source dir when building external modules (746 bytes, patch)
2006-10-06 04:31 UTC, Jan Peter den Heijer
Details | Diff

Description Jan Peter den Heijer 2006-10-04 04:53:55 UTC
Most recent kernel where this bug did not occur: 2.6.18-rc7-mm1 (and 2.6.18 vanilla)
Distribution: Gentoo
Hardware Environment:
Software Environment:
Problem Description:
 Gentoo uses a sandbox to compile kernel-modules from source. Recent mm-kernel
introduced astest in "scripts/Kbuild.include". This test write a file in the
kernel tree for which the module is being compiled. This causes the "emerge" to
fail because of a sandbox violation.

Steps to reproduce:
 "emerge" any kernel-module in portage when "/usr/src/linux" is a symlink to any
2.6.18-mm tree
Comment 1 Jan Peter den Heijer 2006-10-04 04:57:30 UTC
Created attachment 9151 [details]
proposed patch to send output of astest to /dev/null instead of a file

This is a patch for 2.6.18-mm1
Should work for mm2 and mm3 as well, I hope...
Comment 2 Andrew Morton 2006-10-04 09:07:40 UTC
Could you please test the patch I just committed to -mm?
Comment 3 Jan Peter den Heijer 2006-10-05 02:45:49 UTC
--- snippet from ${KERNELTREE}/Makefile: ---

# When compiling out-of-tree modules, put MODVERDIR in the module
# tree rather than in the kernel tree. The kernel tree might
# even be read-only.
export MODVERDIR := $(if $(KBUILD_EXTMOD),$(firstword
$(KBUILD_EXTMOD))/).tmp_versions

--- End snippet ---

Is it in any way possible to do something like this for as$$$$.tmp files?

Something like:

+ASTMP = $(KBUILD_EXTMOD)/as$$$$.tmp

Seems to me like this would write the files into the sources-directory of the
module being compiled, which is of course inside the sandbox?
Comment 4 Jan Peter den Heijer 2006-10-06 01:50:21 UTC
Created attachment 9168 [details]
Patch to put astest$$$$.out files in module source tree when building external modules

Tested with 2.6.18-mm3 and is working.
I'm not sure if i've done it correctly, but I hope someone has the time to
review.
Comment 5 Jan Peter den Heijer 2006-10-06 01:50:40 UTC
Created attachment 9169 [details]
Patch to put astest$$$$.out files in module source tree when building external modules

Tested with 2.6.18-mm3 and is working.
I'm not sure if i've done it correctly, but I hope someone has the time to
review.
Comment 6 Jan Peter den Heijer 2006-10-06 03:18:30 UTC
Comment on attachment 9169 [details]
Patch to put astest$$$$.out files in module source tree when building external modules

Doesn't work... very sorry
Comment 7 Jan Peter den Heijer 2006-10-06 04:31:30 UTC
Created attachment 9170 [details]
proposed patch: kbuild puts astest$$$$.out files in modules source dir when building external modules

First off: I'm very sorry for the mess i've made of this bugreport!

Second: 
I verified that this patch actualy creates the files in the proper directory by
commenting out "rm -f $(ASTMP)astest$$$$.out".
When building in-tree modules, files are created in ${KERNEL_DIR}/
When building external modules, files are created in ${M||SUBDIRS}/ specified
in the make-commandline
Comment 8 Andrew Morton 2006-10-06 07:17:17 UTC
On Fri, 6 Oct 2006 02:01:51 -0700
bugme-daemon@bugzilla.kernel.org wrote:

> Patch to put astest$$$$.out files in module source tree when building external
> modules

please email it as per http://www.zip.com.au/~akpm/linux/patches/stuff/tpp.txt
I'd suggest the addition of a comment explaining what's going on in there.

Comment 9 Dave Jones 2007-05-31 11:34:25 UTC
.. time passes.

Did this get resolved ?
Comment 10 Sam Ravnborg 2007-05-31 11:36:37 UTC
There has been no news on this bug lately so I assume it is indeed solved.
If not please open a new bug and assign it to me.
I will close this bug for now.
Comment 11 Sam Ravnborg 2007-05-31 11:38:06 UTC
Several changes were made in the kernel build for handling tmp files and this
should be solved by that.
This was all done in my kbuild absense period but I assume it is fixed - so bug
is hereby closed.

Note You need to log in before you can comment on or make changes to this bug.