Message ID | 1310470780-12330-1-git-send-email-mmarek@suse.cz (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
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? -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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 -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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! -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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.
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"
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(-)