* .tmp_depmod owned by root after modules_install
@ 2011-07-04 9:49 Christian Kujau
2011-07-08 20:26 ` Christian Kujau
2011-07-12 11:39 ` [PATCH] kbuild: Do not write to builddir in modules_install Michal Marek
0 siblings, 2 replies; 7+ messages in thread
From: Christian Kujau @ 2011-07-04 9:49 UTC (permalink / raw)
To: LKML; +Cc: mmarek
Hi,
when building a kernel with O=$DIR, I noticed that "modules_install" now
creates files under $DIR as root:
$ sudo make -C /usr/local/src/linux-2.6-git O=$HOME/trash/tmp/. modules_install
[...]
When trying to build a new kernel, removing $DIR as a normal user does no
longer work as everything under $HOME/trash/tmp/.tmp_depmod/ is now owned
by root (because of the "sudo"). This did not occur before and may be a
consequence of:
commit bfe5424a8b31624e7a476f959d552999f931e7c7
Author: Michal Marek <mmarek@suse.cz>
Date: Thu Jun 9 16:35:41 2011 +0200
kbuild: Hack for depmod not handling X.Y versions
Can this be changed somehow so that "make modules_install" does not write
anything under $DIR, as before?
Thanks,
Christian.
--
BOFH excuse #274:
It was OK before you touched it.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: .tmp_depmod owned by root after modules_install
2011-07-04 9:49 .tmp_depmod owned by root after modules_install Christian Kujau
@ 2011-07-08 20:26 ` Christian Kujau
2011-07-12 11:39 ` [PATCH] kbuild: Do not write to builddir in modules_install Michal Marek
1 sibling, 0 replies; 7+ messages in thread
From: Christian Kujau @ 2011-07-08 20:26 UTC (permalink / raw)
To: LKML; +Cc: mmarek
ping?
On Mon, 4 Jul 2011 at 02:49, Christian Kujau wrote:
> Hi,
>
> when building a kernel with O=$DIR, I noticed that "modules_install" now
> creates files under $DIR as root:
>
> $ sudo make -C /usr/local/src/linux-2.6-git O=$HOME/trash/tmp/. modules_install
> [...]
>
> When trying to build a new kernel, removing $DIR as a normal user does no
> longer work as everything under $HOME/trash/tmp/.tmp_depmod/ is now owned
> by root (because of the "sudo"). This did not occur before and may be a
> consequence of:
>
> commit bfe5424a8b31624e7a476f959d552999f931e7c7
> Author: Michal Marek <mmarek@suse.cz>
> Date: Thu Jun 9 16:35:41 2011 +0200
>
> kbuild: Hack for depmod not handling X.Y versions
>
> Can this be changed somehow so that "make modules_install" does not write
> anything under $DIR, as before?
>
> Thanks,
> Christian.
> --
> BOFH excuse #274:
>
> It was OK before you touched it.
>
--
BOFH excuse #188:
..disk or the processor is on fire.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] kbuild: Do not write to builddir in modules_install
2011-07-04 9:49 .tmp_depmod owned by root after modules_install Christian Kujau
2011-07-08 20:26 ` Christian Kujau
@ 2011-07-12 11:39 ` Michal Marek
2011-07-13 1:05 ` Américo Wang
1 sibling, 1 reply; 7+ messages in thread
From: Michal Marek @ 2011-07-12 11:39 UTC (permalink / raw)
To: Christian Kujau; +Cc: linux-kernel, linux-kbuild
Let depmod.sh create a temporary directory in /tmp instead of writing to
the build directory as root. The mktemp utility should be available on
any recent system (and there is already scripts/gen_initramfs_list.sh
relying on it).
Reported-by: Christian Kujau <lists@nerdbynature.de>
Signed-off-by: Michal Marek <mmarek@suse.cz>
---
scripts/depmod.sh | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/scripts/depmod.sh b/scripts/depmod.sh
index 3b029cb..a272356 100755
--- a/scripts/depmod.sh
+++ b/scripts/depmod.sh
@@ -21,13 +21,15 @@ fi
# older versions of depmod require the version string to start with three
# numbers, so we cheat with a symlink here
depmod_hack_needed=true
-mkdir -p .tmp_depmod/lib/modules/$KERNELRELEASE
-if "$DEPMOD" -b .tmp_depmod $KERNELRELEASE 2>/dev/null; then
- if test -e .tmp_depmod/lib/modules/$KERNELRELEASE/modules.dep -o \
- -e .tmp_depmod/lib/modules/$KERNELRELEASE/modules.dep.bin; then
+tmp_dir=$(mktemp -d ${TMPDIR:-/tmp}/depmod.XXXXXX)
+mkdir -p "$tmp_dir/lib/modules/$KERNELRELEASE"
+if "$DEPMOD" -b "$tmp_dir" $KERNELRELEASE 2>/dev/null; then
+ if test -e "$tmp_dir/lib/modules/$KERNELRELEASE/modules.dep" -o \
+ -e "$tmp_dir/lib/modules/$KERNELRELEASE/modules.dep.bin"; then
depmod_hack_needed=false
fi
fi
+rm -rf "$tmp_dir"
if $depmod_hack_needed; then
symlink="$INSTALL_MOD_PATH/lib/modules/99.98.$KERNELRELEASE"
ln -s "$KERNELRELEASE" "$symlink"
--
1.7.5.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] kbuild: Do not write to builddir in modules_install
2011-07-12 11:39 ` [PATCH] kbuild: Do not write to builddir in modules_install Michal Marek
@ 2011-07-13 1:05 ` Américo Wang
2011-07-13 9:21 ` Michal Marek
0 siblings, 1 reply; 7+ messages in thread
From: Américo Wang @ 2011-07-13 1:05 UTC (permalink / raw)
To: Michal Marek; +Cc: Christian Kujau, linux-kernel, linux-kbuild
On Tue, Jul 12, 2011 at 7:39 PM, Michal Marek <mmarek@suse.cz> wrote:
> Let depmod.sh create a temporary directory in /tmp instead of writing to
> the build directory as root. The mktemp utility should be available on
> any recent system (and there is already scripts/gen_initramfs_list.sh
> relying on it).
>
Hmm, why not use $objtree/.tmp_depmod?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] kbuild: Do not write to builddir in modules_install
2011-07-13 1:05 ` Américo Wang
@ 2011-07-13 9:21 ` Michal Marek
2011-07-13 11:22 ` Américo Wang
0 siblings, 1 reply; 7+ messages in thread
From: Michal Marek @ 2011-07-13 9:21 UTC (permalink / raw)
To: Américo Wang; +Cc: Christian Kujau, linux-kernel, linux-kbuild
On 13.7.2011 03:05, Américo Wang wrote:
> On Tue, Jul 12, 2011 at 7:39 PM, Michal Marek<mmarek@suse.cz> wrote:
>> Let depmod.sh create a temporary directory in /tmp instead of writing to
>> the build directory as root. The mktemp utility should be available on
>> any recent system (and there is already scripts/gen_initramfs_list.sh
>> relying on it).
>>
>
> Hmm, why not use $objtree/.tmp_depmod?
That's how it was done before and it's broken. make modules_install is
usually ran as root and there is no guarantee that root has write access
to the build directory (it can be on nfs).
Michal
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] kbuild: Do not write to builddir in modules_install
2011-07-13 9:21 ` Michal Marek
@ 2011-07-13 11:22 ` Américo Wang
2011-07-13 22:19 ` Christian Kujau
0 siblings, 1 reply; 7+ messages in thread
From: Américo Wang @ 2011-07-13 11:22 UTC (permalink / raw)
To: Michal Marek; +Cc: Christian Kujau, linux-kernel, linux-kbuild
On Wed, Jul 13, 2011 at 5:21 PM, Michal Marek <mmarek@suse.cz> wrote:
> On 13.7.2011 03:05, Américo Wang wrote:
>>
>> On Tue, Jul 12, 2011 at 7:39 PM, Michal Marek<mmarek@suse.cz> wrote:
>>>
>>> Let depmod.sh create a temporary directory in /tmp instead of writing to
>>> the build directory as root. The mktemp utility should be available on
>>> any recent system (and there is already scripts/gen_initramfs_list.sh
>>> relying on it).
>>>
>>
>> Hmm, why not use $objtree/.tmp_depmod?
>
> That's how it was done before and it's broken. make modules_install is
> usually ran as root and there is no guarantee that root has write access to
> the build directory (it can be on nfs).
Hmm, this is reasonable. Then I am fine with this patch.
Thanks for explanation!
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] kbuild: Do not write to builddir in modules_install
2011-07-13 11:22 ` Américo Wang
@ 2011-07-13 22:19 ` Christian Kujau
0 siblings, 0 replies; 7+ messages in thread
From: Christian Kujau @ 2011-07-13 22:19 UTC (permalink / raw)
To: Américo Wang; +Cc: Michal Marek, linux-kernel, linux-kbuild
On Wed, 13 Jul 2011 at 19:22, Américo Wang wrote:
> >> Hmm, why not use $objtree/.tmp_depmod?
> >
> > That's how it was done before and it's broken. make modules_install is
> > usually ran as root and there is no guarantee that root has write access to
> > the build directory (it can be on nfs).
>
> Hmm, this is reasonable. Then I am fine with this patch.
Tested here, works fine, even with a noexec-mounted $TMPDIR. Thanks!
Christian.
--
BOFH excuse #62:
need to wrap system in aluminum foil to fix problem
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-07-13 22:19 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-04 9:49 .tmp_depmod owned by root after modules_install Christian Kujau
2011-07-08 20:26 ` Christian Kujau
2011-07-12 11:39 ` [PATCH] kbuild: Do not write to builddir in modules_install Michal Marek
2011-07-13 1:05 ` Américo Wang
2011-07-13 9:21 ` Michal Marek
2011-07-13 11:22 ` Américo Wang
2011-07-13 22:19 ` Christian Kujau
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox