Hello community, here is the log from the commit of package autofs for openSUSE:Factory checked in at 2016-03-29 09:55:51 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/autofs (Old) and /work/SRC/openSUSE:Factory/.autofs.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "autofs" Changes: -------- --- /work/SRC/openSUSE:Factory/autofs/autofs.changes 2015-12-14 11:09:00.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.autofs.new/autofs.changes 2016-03-29 09:55:52.000000000 +0200 @@ -1,0 +2,9 @@ +Thu Mar 24 14:47:04 UTC 2016 - [email protected] + +- improve scalability of direct mount path component creation (bsc#966573). + * Added autofs-improve-scalability-of-direct-mount-path-comp.patch + * Refreshed autofs-5.1.1-dbus-udisks-monitor.patch +- Use libldap_r instead of libldap for thread safety (bsc#955477). + * Added autofs-use-libldap_r-instead-of-libldap-for-thread-safety.patch + +------------------------------------------------------------------- New: ---- autofs-improve-scalability-of-direct-mount-path-comp.patch autofs-use-libldap_r-instead-of-libldap-for-thread-safety.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ autofs.spec ++++++ --- /var/tmp/diff_new_pack.uAgGPJ/_old 2016-03-29 09:55:53.000000000 +0200 +++ /var/tmp/diff_new_pack.uAgGPJ/_new 2016-03-29 09:55:53.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package autofs # -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -79,6 +79,8 @@ Source100: autofs-rpmlintrc # PATCH-FIX-UPSTREAM autofs-task-use-after-free.patch [bnc#727392] Patch82: autofs-5.1.1-task-use-after-free.patch +# PATCH-FIX-UPSTREAM autofs-improve-scalability-of-direct-mount-path-comp.patch [bsc#966573] +Patch83: autofs-improve-scalability-of-direct-mount-path-comp.patch # PATCH-FIX-OPENSUSE autofs-suse-auto_master_default.patch Patch100: autofs-5.1.1-suse-auto_master_default.patch # PATCH-FIX-OPENSUSE autofs-debuginfo-fix.patch @@ -87,6 +89,8 @@ Patch102: autofs-5.1.1-dbus-udisks-monitor.patch # PATCH-FIX-OPENSUSE autofs-5.1.1-leave_auth_destroy.patch Patch103: autofs-5.1.1-leave_auth_destroy.patch +# PATCH-FIX-OPENSUSE autofs-use-libldap_r-instead-of-libldap-for-thread-safety.patch [bsc#955477] +Patch104: autofs-use-libldap_r-instead-of-libldap-for-thread-safety.patch Requires(pre): %fillup_prereq Requires(pre): aaa_base %if %{with_systemd} @@ -109,12 +113,15 @@ cp %{SOURCE5} . # %patch82 -p1 +%patch83 -p1 %patch100 -p1 %patch101 -p1 -%patch102 -p0 -b .udisks +%patch102 -p1 %patch103 -p0 +%patch104 -p1 %build +autoreconf -fiv SUSE_ASNEEDED=0 %configure %{_target_cpu}-suse-linux \ ++++++ autofs-5.1.1-dbus-udisks-monitor.patch ++++++ --- /var/tmp/diff_new_pack.uAgGPJ/_old 2016-03-29 09:55:53.000000000 +0200 +++ /var/tmp/diff_new_pack.uAgGPJ/_new 2016-03-29 09:55:53.000000000 +0200 @@ -1,7 +1,19 @@ -Index: Makefile.conf.in -=================================================================== ---- Makefile.conf.in.orig -+++ Makefile.conf.in +--- + Makefile.conf.in | 3 + daemon/lookup.c | 4 + include/lookup_udisks.h | 381 +++++++ + lib/master_tok.l | 2 + lib/parse_subs.c | 2 + man/autofs.udisks.5.in | 121 ++ + modules/Makefile | 12 + modules/lookup_multi.c | 2 + modules/lookup_udisks.c | 2449 ++++++++++++++++++++++++++++++++++++++++++++++++ + modules/parse_sun.c | 1 + samples/autofs.udisks | 28 + 11 files changed, 3004 insertions(+), 1 deletion(-) + +--- a/Makefile.conf.in ++++ b/Makefile.conf.in @@ -40,6 +40,9 @@ KRB5_FLAGS=@KRB5_FLAGS@ # NIS+ support: yes (1) no (0) NISPLUS = @HAVE_NISPLUS@ @@ -12,52 +24,21 @@ # SMBFS support: yes (1) no (0) SMBFS = @HAVE_SMBMOUNT@ -Index: daemon/automount.c -=================================================================== ---- daemon/automount.c.orig -+++ daemon/automount.c -@@ -120,7 +120,8 @@ static int do_mkdir(const char *parent, - status = -1; - if (*parent) - status = statfs(parent, &fs); -- if ((status != -1 && fs.f_type == (__SWORD_TYPE) AUTOFS_SUPER_MAGIC) || -+ if ((status != -1 && (fs.f_type == (__SWORD_TYPE) AUTOFS_SUPER_MAGIC || -+ fs.f_type == (__SWORD_TYPE) TMPFS_MAGIC)) || - contained_in_local_fs(path)) { - mode_t mask = umask(0022); - int ret = mkdir(path, mode); -Index: include/automount.h -=================================================================== ---- include/automount.h.orig -+++ include/automount.h -@@ -23,6 +23,7 @@ - #include "list.h" - - #include <linux/auto_fs4.h> -+#include <linux/magic.h> - - #include "defaults.h" - #include "state.h" -@@ -72,9 +73,15 @@ int load_autofs4_module(void); - #define SLOPPY - #endif - -+#ifndef AUTOFS_SUPER_MAGIC - #define AUTOFS_SUPER_MAGIC 0x00000187L -+#endif -+#ifndef SMB_SUPER_MAGIC - #define SMB_SUPER_MAGIC 0x0000517BL -+#endif -+#ifndef CIFS_MAGIC_NUMBER - #define CIFS_MAGIC_NUMBER 0xFF534D42L -+#endif - - /* This sould be enough for at least 20 host aliases */ - #define HOST_ENT_BUF_SIZE 2048 -Index: include/lookup_udisks.h -=================================================================== +--- a/daemon/lookup.c ++++ b/daemon/lookup.c +@@ -239,6 +239,10 @@ int lookup_nss_read_master(struct master + (name[3] == ',' || name[3] == ':')) || + (!strncmp(name, "nisplus", 7) && + (name[7] == ',' || name[7] == ':')) || ++ (!strncmp(name, "udisks", 6) && ++ (name[6] == ',' || name[6] == ':')) || ++ (!strncmp(name, "udisks2", 7) && ++ (name[7] == ',' || name[7] == ':')) || + (!strncmp(name, "ldap", 4) && + (name[4] == ',' || name[4] == ':')) || + (!strncmp(name, "ldaps", 5) && --- /dev/null -+++ include/lookup_udisks.h ++++ b/include/lookup_udisks.h @@ -0,0 +1,381 @@ +/* + * loopup_udisks.h - Header file for lookup_udisks automount module @@ -440,10 +421,8 @@ +} cnfxml_t; + +#endif -Index: lib/master_tok.l -=================================================================== ---- lib/master_tok.l.orig -+++ lib/master_tok.l +--- a/lib/master_tok.l ++++ b/lib/master_tok.l @@ -119,7 +119,7 @@ DNNAMESTR2 ([[:alnum:]_.\-]+) INTMAP (-hosts|-null) MULTI ((multi)(,(sun|hesiod))?(:{OPTWS}|{WS})) @@ -453,10 +432,8 @@ OPTTOUT (-t{OPTWS}|-t{OPTWS}={OPTWS}|--timeout{OPTWS}|--timeout{OPTWS}={OPTWS}) -Index: lib/parse_subs.c -=================================================================== ---- lib/parse_subs.c.orig -+++ lib/parse_subs.c +--- a/lib/parse_subs.c ++++ b/lib/parse_subs.c @@ -98,6 +98,8 @@ static struct types map_type[] = { { "yp", 2 }, { "nis", 3 }, @@ -466,10 +443,8 @@ { "ldap", 4 }, { "ldaps", 5 }, { "hesiod", 6 }, -Index: man/autofs.udisks.5.in -=================================================================== --- /dev/null -+++ man/autofs.udisks.5.in ++++ b/man/autofs.udisks.5.in @@ -0,0 +1,121 @@ +.\" t +.TH AUTOFS.UDISKS 5 "22 Aug 2012" @@ -592,10 +567,8 @@ +.BR udisks\-daemon (8) +.SH AUTHOR +This manual page was written by Werner Fink <[email protected]>. -Index: modules/Makefile -=================================================================== ---- modules/Makefile.orig -+++ modules/Makefile +--- a/modules/Makefile ++++ b/modules/Makefile @@ -62,6 +62,14 @@ ifeq ($(SSSD), 1) MODS += lookup_sss.so endif @@ -622,10 +595,8 @@ mount_nfs.so: mount_nfs.c replicated.o $(CC) $(LDFLAGS) $(SOLDFLAGS) $(CFLAGS) -o mount_nfs.so \ mount_nfs.c replicated.o $(AUTOFS_LIB) $(LIBS) -Index: modules/lookup_multi.c -=================================================================== ---- modules/lookup_multi.c.orig -+++ modules/lookup_multi.c +--- a/modules/lookup_multi.c ++++ b/modules/lookup_multi.c @@ -56,6 +56,8 @@ static struct lookup_mod *nss_open_looku if (!strncmp(argv[0], "file", 4) || !strncmp(argv[0], "yp", 2) || @@ -635,10 +606,8 @@ !strncmp(argv[0], "nis", 3) || !strncmp(argv[0], "ldaps", 5) || !strncmp(argv[0], "ldap", 4)) { -Index: modules/lookup_udisks.c -=================================================================== --- /dev/null -+++ modules/lookup_udisks.c ++++ b/modules/lookup_udisks.c @@ -0,0 +1,2449 @@ +/* + * lookup_udisks.c - Module for Linux automount to access removable devices @@ -3089,10 +3058,8 @@ +out: + return ret; +} -Index: modules/parse_sun.c -=================================================================== ---- modules/parse_sun.c.orig -+++ modules/parse_sun.c +--- a/modules/parse_sun.c ++++ b/modules/parse_sun.c @@ -847,6 +847,7 @@ static int validate_location(unsigned in ((esc = strchr(ptr, '\\')) && *(esc + 1) == ':') || !strncmp(ptr, "file:", 5) || !strncmp(ptr, "yp:", 3) || @@ -3101,10 +3068,8 @@ !strncmp(ptr, "ldap:", 5) || !strncmp(ptr, "ldaps:", 6) || !strncmp(ptr, "sss:", 4) || !strncmp(ptr, "dir:", 4)) return 1; -Index: samples/autofs.udisks -=================================================================== --- /dev/null -+++ samples/autofs.udisks ++++ b/samples/autofs.udisks @@ -0,0 +1,28 @@ +<?xml version="1.0" ?> +<!-- @@ -3134,18 +3099,3 @@ + <FSType>ro,nosuid,nodev,noexec</FSType> + </MountOptions> +</AutofsUdisks> -Index: daemon/lookup.c -=================================================================== ---- daemon/lookup.c.orig -+++ daemon/lookup.c -@@ -239,6 +239,10 @@ int lookup_nss_read_master(struct master - (name[3] == ',' || name[3] == ':')) || - (!strncmp(name, "nisplus", 7) && - (name[7] == ',' || name[7] == ':')) || -+ (!strncmp(name, "udisks", 6) && -+ (name[6] == ',' || name[6] == ':')) || -+ (!strncmp(name, "udisks2", 7) && -+ (name[7] == ',' || name[7] == ':')) || - (!strncmp(name, "ldap", 4) && - (name[4] == ',' || name[4] == ':')) || - (!strncmp(name, "ldaps", 5) && ++++++ autofs-improve-scalability-of-direct-mount-path-comp.patch ++++++ From: Jeff Mahoney <[email protected]> Subject: autofs: improve scalability of direct mount path component creation References: bsc#966573 Patch-mainline: Queued by maintainer; no recent online archive of the autofs list exists With direct mounts, we want to avoid creating path components on remote file systems unless that file system is the root file system. The check boils down to allowing the mkdir if: 1/ If it's the root directory, or 2/ If it's not a remote file system, or 3/ If it's a remote file system that's the root file system We can do that without parsing the mount table and can improve startup time for all cases. Signed-off-by: Jeff Mahoney <[email protected]> --- daemon/automount.c | 56 +++++++++++++++++++++++++++++++++++++++-------------- include/automount.h | 2 ++ include/mounts.h | 1 - lib/mounts.c | 45 ------------------------------------------ 4 files changed, 44 insertions(+), 60 deletions(-) diff --git a/daemon/automount.c b/daemon/automount.c index 74e62a1..9d07425 100644 --- a/daemon/automount.c +++ b/daemon/automount.c @@ -98,10 +98,25 @@ static int umount_all(struct autofs_point *ap, int force); extern struct master *master_list; +static int is_remote_fstype(unsigned int fs_type) +{ + int ret = 0; + switch (fs_type) { + case SMB_SUPER_MAGIC: + case CIFS_MAGIC_NUMBER: + case NCP_SUPER_MAGIC: + case NFS_SUPER_MAGIC: + ret = 1; + break; + }; + return ret; +} + static int do_mkdir(const char *parent, const char *path, mode_t mode) { int status; - struct stat st; + mode_t mask; + struct stat st, root; struct statfs fs; /* If path exists we're done */ @@ -114,24 +129,37 @@ static int do_mkdir(const char *parent, const char *path, mode_t mode) } /* - * If we're trying to create a directory within an autofs fs - * or the path is contained in a localy mounted fs go ahead. + * We don't want to create the path on a remote file system + * unless it's the root file system. + * An empty parent means it's the root directory and always ok. */ - status = -1; - if (*parent) + if (*parent) { status = statfs(parent, &fs); - if ((status != -1 && fs.f_type == (__SWORD_TYPE) AUTOFS_SUPER_MAGIC) || - contained_in_local_fs(path)) { - mode_t mask = umask(0022); - int ret = mkdir(path, mode); - (void) umask(mask); - if (ret == -1) { - errno = EACCES; - return 0; + if (status == -1) + goto fail; + + if (is_remote_fstype(fs.f_type)) { + status = stat(parent, &st); + if (status == -1) + goto fail; + + status = stat("/", &root); + if (status == -1) + goto fail; + + if (st.st_dev != root.st_dev) + goto fail; } - return 1; } + mask = umask(0022); + status = mkdir(path, mode); + (void) umask(mask); + if (status == -1) + goto fail; + + return 1; +fail: errno = EACCES; return 0; } diff --git a/include/automount.h b/include/automount.h index 2cf0611..c0f5fbf 100644 --- a/include/automount.h +++ b/include/automount.h @@ -75,6 +75,8 @@ int load_autofs4_module(void); #define AUTOFS_SUPER_MAGIC 0x00000187L #define SMB_SUPER_MAGIC 0x0000517BL #define CIFS_MAGIC_NUMBER 0xFF534D42L +#define NCP_SUPER_MAGIC 0x0000564CL +#define NFS_SUPER_MAGIC 0x00006969L /* This sould be enough for at least 20 host aliases */ #define HOST_ENT_BUF_SIZE 2048 diff --git a/include/mounts.h b/include/mounts.h index cce646a..489025c 100644 --- a/include/mounts.h +++ b/include/mounts.h @@ -101,7 +101,6 @@ int ext_mount_remove(struct list_head *, const char *); struct mnt_list *get_mnt_list(const char *table, const char *path, int include); struct mnt_list *reverse_mnt_list(struct mnt_list *list); void free_mnt_list(struct mnt_list *list); -int contained_in_local_fs(const char *path); int is_mounted(const char *table, const char *path, unsigned int type); int has_fstab_option(const char *opt); void tree_free_mnt_tree(struct mnt_list *tree); diff --git a/lib/mounts.c b/lib/mounts.c index 455bdca..1d1b4da 100644 --- a/lib/mounts.c +++ b/lib/mounts.c @@ -941,51 +941,6 @@ void free_mnt_list(struct mnt_list *list) } } -int contained_in_local_fs(const char *path) -{ - struct mnt_list *mnts, *this; - size_t pathlen = strlen(path); - int ret; - - if (!path || !pathlen || pathlen > PATH_MAX) - return 0; - - mnts = get_mnt_list(_PATH_MOUNTED, "/", 1); - if (!mnts) - return 0; - - ret = 0; - - for (this = mnts; this != NULL; this = this->next) { - size_t len = strlen(this->path); - - if (!strncmp(path, this->path, len)) { - if (len > 1 && pathlen > len && path[len] != '/') - continue; - else if (len == 1 && this->path[0] == '/') { - /* - * always return true on rootfs, we don't - * want to break diskless clients. - */ - ret = 1; - } else if (this->fs_name[0] == '/') { - if (strlen(this->fs_name) > 1) { - if (this->fs_name[1] != '/') - ret = 1; - } else - ret = 1; - } else if (!strncmp("LABEL=", this->fs_name, 6) || - !strncmp("UUID=", this->fs_name, 5)) - ret = 1; - break; - } - } - - free_mnt_list(mnts); - - return ret; -} - static int table_is_mounted(const char *table, const char *path, unsigned int type) { struct mntent *mnt; -- 2.7.1 ++++++ autofs-use-libldap_r-instead-of-libldap-for-thread-safety.patch ++++++ From: Jeff Mahoney <[email protected]> Subject: autofs: use libldap_r instead of libldap for thread safety References: bsc#955477 In order for OpenSSL to be threadsafe, CRYPTO_set_locking_callback needs to be used to set the locking function. That's only done with libldap_r, not plain libldap. >From the openldap source: ** The preprocessor flag LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE ** can be used to determine if -lldap_r is available at compile ** time. You must define LDAP_THREAD_SAFE if and only if you ** link with -lldap_r. ** ** If you fail to define LDAP_THREAD_SAFE when linking with ** -lldap_r or define LDAP_THREAD_SAFE when linking with -lldap, ** provided header definations and declarations may be incorrect. The autofs Makefile defines LDAP_THREAD_SAFE and then links with -lldap. This patch links with -lldap_r instead and fixes observed crashes. Signed-off-by: Jeff Mahoney <[email protected]> --- aclocal.m4 | 8 ++++---- configure.in | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) --- a/aclocal.m4 +++ b/aclocal.m4 @@ -344,11 +344,11 @@ dnl dnl Check for function ldap_create_page_control dnl -------------------------------------------------------------------------- AC_DEFUN([AF_CHECK_FUNC_LDAP_CREATE_PAGE_CONTROL], -[AC_MSG_CHECKING(for ldap_create_page_control in -lldap) +[AC_MSG_CHECKING(for ldap_create_page_control in -lldap_r) # save current libs af_check_ldap_create_page_control_save_libs="$LIBS" -LIBS="$LIBS -lldap" +LIBS="$LIBS -lldap_r" AC_TRY_LINK( [ #include <ldap.h> ], @@ -377,11 +377,11 @@ dnl dnl Check for function ldap_parse_page_control dnl -------------------------------------------------------------------------- AC_DEFUN([AF_CHECK_FUNC_LDAP_PARSE_PAGE_CONTROL], -[AC_MSG_CHECKING(for ldap_parse_page_control in -lldap) +[AC_MSG_CHECKING(for ldap_parse_page_control in -lldap_r) # save current libs af_check_ldap_parse_page_control_save_libs="$LIBS" -LIBS="$LIBS -lldap" +LIBS="$LIBS -lldap_r" AC_TRY_LINK( [ #include <ldap.h> ], --- a/configure.in +++ b/configure.in @@ -259,7 +259,7 @@ AC_ARG_WITH(openldap, if test -z "$HAVE_LDAP" -o "$HAVE_LDAP" != "0"; then HAVE_LDAP=0 LDAP_FLAGS="$LDAP_FLAGS -DLDAP_DEPRECATED=1" - AC_CHECK_LIB(ldap, ldap_initialize, HAVE_LDAP=1 LIBLDAP="$LIBLDAP -lldap -llber -lresolv", , + AC_CHECK_LIB(ldap_r, ldap_initialize, HAVE_LDAP=1 LIBLDAP="$LIBLDAP -lldap_r -llber -lresolv", , -llber -lresolv $LIBS) if test "$HAVE_LDAP" = "1"; then AC_DEFINE(WITH_LDAP,1,
