From 55931a4befd57f17c99c1783c03145f5ef0c7fb194b2e8f94328e2fb258763a8 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Tue, 10 Dec 2013 09:48:05 +0000 Subject: [PATCH] Accepting request 210120 from home:michael-chang:12.3:bnc:851722 - add os-prober-dont-load-all-fs-module-and-dont-test-mount.patch * don't modprobe that many kernel file system modules before mount as mount will take care that for us (bnc#782689) * don't test mount on partitions without any known file system detected (bnc#851722) OBS-URL: https://build.opensuse.org/request/show/210120 OBS-URL: https://build.opensuse.org/package/show/Base:System/os-prober?expand=0&rev=33 --- ...ad-all-fs-module-and-dont-test-mount.patch | 100 ++++++++++++++++++ os-prober.changes | 9 ++ os-prober.spec | 3 + 3 files changed, 112 insertions(+) create mode 100644 os-prober-dont-load-all-fs-module-and-dont-test-mount.patch diff --git a/os-prober-dont-load-all-fs-module-and-dont-test-mount.patch b/os-prober-dont-load-all-fs-module-and-dont-test-mount.patch new file mode 100644 index 0000000..bab3b9e --- /dev/null +++ b/os-prober-dont-load-all-fs-module-and-dont-test-mount.patch @@ -0,0 +1,100 @@ +Index: os-prober-1.61/os-probes/common/50mounted-tests +=================================================================== +--- os-prober-1.61.orig/os-probes/common/50mounted-tests ++++ os-prober-1.61/os-probes/common/50mounted-tests +@@ -40,19 +40,13 @@ elif [ -z "$types" ]; then + debug "$1 is a LUKS partition; skipping" + exit 0 + fi +- for type in $(grep -v nodev /proc/filesystems); do +- # hfsplus filesystems are mountable as hfs. Try hfs last so +- # that we can tell the difference. +- if [ "$type" = hfs ]; then +- delaytypes="${delaytypes:+$delaytypes }$type" +- elif [ "$type" = fuseblk ]; then +- if type ntfs-3g >/dev/null 2>&1; then +- types="${types:+$types }ntfs-3g" +- fi +- else +- types="${types:+$types }$type" +- fi +- done ++ ++ # Simply skip such partition is better than trying to detect ++ # it by blinded test mounts with all kinds of kernel file system, ++ # that would lead to unwanted consequence like kernel oops and ++ # risk to corrupt your system and data. ++ debug "$1 is a partition without file system; skipping" ++ exit 0 + fi + + tmpmnt=/var/lib/os-prober/mount +@@ -144,7 +138,7 @@ if type grub2-mount >/dev/null 2>&1 && \ + fi + else + ro_partition "$partition" +- for type in $types $delaytypes; do ++ for type in $types; do + if mount -o ro -t "$type" "$partition" "$tmpmnt" 2>/dev/null; then + debug "mounted as $type filesystem" + mounted=1 +Index: os-prober-1.61/os-probes/init/common/10filesystems +=================================================================== +--- os-prober-1.61.orig/os-probes/init/common/10filesystems ++++ os-prober-1.61/os-probes/init/common/10filesystems +@@ -1,39 +1,21 @@ + #!/bin/sh + # Make sure filesystems are available. +-set +e # ignore errors from modprobe ++set -e + +-FILESYSTEMS='ext2 ext3 ext4 reiserfs xfs jfs msdos vfat ntfs minix hfs hfsplus qnx4 ufs btrfs' +-# fuse is needed to make grub2-mount work. +-FILESYSTEMS="$FILESYSTEMS fuse" +-# The Ubuntu kernel udebs put a number of filesystem modules in +-# fs-{core,secondary}-modules. It's fairly cheap to check for these too. +-FILESYSTEMS="$FILESYSTEMS fs-core fs-secondary" +- +-if [ ! -e /var/lib/os-prober/modules ]; then +- # Check for anna-install to make it easier to use os-prober outside +- # d-i. +- if type anna-install >/dev/null 2>&1 && [ -d /lib/debian-installer ]; then +- for fs in $FILESYSTEMS; do +- ANNA_QUIET=1 DEBIAN_FRONTEND=none \ +- log-output -t os-prober \ +- anna-install "$fs-modules" || true +- done +- depmod -a >/dev/null 2>&1 || true +- fi ++# Make sure fuse is available for grub2-mount ++# As long as we use grub2-mount, we use grub2's own file system modules ++# to mount the partitiion and the operation don't require kernel support ++# other than fuse. ++if ! cat /proc/filesystems | grep nodev | cut -f2 | grep -qw fuse; then ++ modprobe fuse 2>&1 | logger -t os-prober ++fi + +- for fs in $FILESYSTEMS; do +- case "$fs" in +- fs-*) +- ;; +- *) +- modprobe "$fs" 2>/dev/null | logger -t os-prober +- ;; +- esac +- done ++# Regarding file systems not supported by grub2, or systems simply don't ++# have grub2-mount, will use linux 'mount' utility. This will require ++# kernel file system module to work, but still we don't need to modprobe ++# all of them before mount, because mount() syscall will take care of it ++# by __request_module the needed kernel module and we should leave it do ++# that for us in order to have only needed modules get loaded. ++# ++# Still if you want any kernel module loaded, add them here. + +- # We only want to keep this state inside d-i, so this is as good a +- # check as any. +- if type anna-install >/dev/null 2>&1 && [ -d /lib/debian-installer ]; then +- touch /var/lib/os-prober/modules +- fi +-fi diff --git a/os-prober.changes b/os-prober.changes index 4db0eed..b8d84c0 100644 --- a/os-prober.changes +++ b/os-prober.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Fri Dec 6 09:21:55 UTC 2013 - mchang@suse.com + +- add os-prober-dont-load-all-fs-module-and-dont-test-mount.patch + * don't modprobe that many kernel file system modules before mount + as mount will take care that for us (bnc#782689) + * don't test mount on partitions without any known file system + detected (bnc#851722) + ------------------------------------------------------------------- Thu Nov 7 07:01:44 UTC 2013 - mchang@suse.com diff --git a/os-prober.spec b/os-prober.spec index 73f47d2..b0423dc 100644 --- a/os-prober.spec +++ b/os-prober.spec @@ -47,6 +47,8 @@ Patch9: os-prober-btrfsfix.patch Patch10: os-prober-EFI-openSUSEfy.patch # PATCH-FIX-OPENSUSE: accept ESP on IMSM MD raid (bnc#818871) Patch11: os-prober-accept-ESP-on-IMSM.patch +# PATCH-FIX-OPENSUSE: don't modprobe all file system modules and don't test mount on unknown partition (bnc#851722) +Patch12: os-prober-dont-load-all-fs-module-and-dont-test-mount.patch Requires: /bin/grep Requires: /bin/sed @@ -76,6 +78,7 @@ cp %SOURCE1 . %patch9 -p1 %patch10 -p1 %patch11 -p1 +%patch12 -p1 %build make %{?_smp_mflags} CC="%__cc" CFLAGS="%{optflags}"