diff options
| author | Khem Raj <raj.khem@gmail.com> | 2021-07-31 09:36:03 -0700 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2021-08-03 08:53:03 -0700 |
| commit | d94bafe1f91457d272cc87224a359abf7ea9d364 (patch) | |
| tree | 4c55c414e82f3dcb55b98dc51e88c95727093afe | |
| parent | 37afc556c203b350f8012c0570e8eb93677bc136 (diff) | |
| download | meta-openembedded-d94bafe1f91457d272cc87224a359abf7ea9d364.tar.gz | |
autofs: Fix build with glibc 2.34+
Signed-off-by: Khem Raj <raj.khem@gmail.com>
3 files changed, 116 insertions, 14 deletions
diff --git a/meta-networking/recipes-daemons/autofs/autofs/0001-Define-__SWORD_TYPE-if-undefined.patch b/meta-networking/recipes-daemons/autofs/autofs/0001-Define-__SWORD_TYPE-if-undefined.patch index 117b1e58a9..f16ae5277e 100644 --- a/meta-networking/recipes-daemons/autofs/autofs/0001-Define-__SWORD_TYPE-if-undefined.patch +++ b/meta-networking/recipes-daemons/autofs/autofs/0001-Define-__SWORD_TYPE-if-undefined.patch | |||
| @@ -13,8 +13,6 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
| 13 | lib/log.c | 6 +++++- | 13 | lib/log.c | 6 +++++- |
| 14 | 3 files changed, 24 insertions(+), 7 deletions(-) | 14 | 3 files changed, 24 insertions(+), 7 deletions(-) |
| 15 | 15 | ||
| 16 | diff --git a/daemon/automount.c b/daemon/automount.c | ||
| 17 | index e476f6b..3a1514b 100644 | ||
| 18 | --- a/daemon/automount.c | 16 | --- a/daemon/automount.c |
| 19 | +++ b/daemon/automount.c | 17 | +++ b/daemon/automount.c |
| 20 | @@ -1,7 +1,7 @@ | 18 | @@ -1,7 +1,7 @@ |
| @@ -50,7 +48,7 @@ index e476f6b..3a1514b 100644 | |||
| 50 | #include "automount.h" | 48 | #include "automount.h" |
| 51 | #if defined(LIBXML2_WORKAROUND) || defined(TIRPC_WORKAROUND) | 49 | #if defined(LIBXML2_WORKAROUND) || defined(TIRPC_WORKAROUND) |
| 52 | #include <dlfcn.h> | 50 | #include <dlfcn.h> |
| 53 | @@ -282,7 +290,7 @@ int rmdir_path(struct autofs_point *ap, const char *path, dev_t dev) | 51 | @@ -282,7 +290,7 @@ int rmdir_path(struct autofs_point *ap, |
| 54 | dev, buf, st.st_dev); | 52 | dev, buf, st.st_dev); |
| 55 | return -1; | 53 | return -1; |
| 56 | } | 54 | } |
| @@ -59,7 +57,7 @@ index e476f6b..3a1514b 100644 | |||
| 59 | /* | 57 | /* |
| 60 | * Last element of path may be a symbolic link; all others | 58 | * Last element of path may be a symbolic link; all others |
| 61 | * are directories (and the last directory element is | 59 | * are directories (and the last directory element is |
| 62 | @@ -455,7 +463,7 @@ int count_mounts(struct autofs_point *ap, const char *path, dev_t dev) | 60 | @@ -455,7 +463,7 @@ int count_mounts(struct autofs_point *ap |
| 63 | 61 | ||
| 64 | counter.count = 0; | 62 | counter.count = 0; |
| 65 | counter.dev = dev; | 63 | counter.dev = dev; |
| @@ -68,7 +66,7 @@ index e476f6b..3a1514b 100644 | |||
| 68 | if (walk_tree(path, counter_fn, 1, ap, &counter) == -1) | 66 | if (walk_tree(path, counter_fn, 1, ap, &counter) == -1) |
| 69 | return -1; | 67 | return -1; |
| 70 | 68 | ||
| 71 | @@ -811,7 +819,7 @@ static char *automount_path_to_fifo(unsigned logopt, const char *path) | 69 | @@ -811,7 +819,7 @@ static char *automount_path_to_fifo(unsi |
| 72 | /* | 70 | /* |
| 73 | * An automount path can be made up of subdirectories. So, to | 71 | * An automount path can be made up of subdirectories. So, to |
| 74 | * create the fifo name, we will just replace instances of '/' with | 72 | * create the fifo name, we will just replace instances of '/' with |
| @@ -77,7 +75,7 @@ index e476f6b..3a1514b 100644 | |||
| 77 | */ | 75 | */ |
| 78 | p = fifo_name + strlen(fifodir); | 76 | p = fifo_name + strlen(fifodir); |
| 79 | while (*p != '\0') { | 77 | while (*p != '\0') { |
| 80 | @@ -1640,7 +1648,7 @@ static void return_start_status(void *arg) | 78 | @@ -1640,7 +1648,7 @@ static void return_start_status(void *ar |
| 81 | sc->done = 1; | 79 | sc->done = 1; |
| 82 | 80 | ||
| 83 | /* | 81 | /* |
| @@ -86,8 +84,6 @@ index e476f6b..3a1514b 100644 | |||
| 86 | * the startup process. | 84 | * the startup process. |
| 87 | */ | 85 | */ |
| 88 | status = pthread_cond_signal(&sc->cond); | 86 | status = pthread_cond_signal(&sc->cond); |
| 89 | diff --git a/include/hash.h b/include/hash.h | ||
| 90 | index 2447f29..6f0dee6 100644 | ||
| 91 | --- a/include/hash.h | 87 | --- a/include/hash.h |
| 92 | +++ b/include/hash.h | 88 | +++ b/include/hash.h |
| 93 | @@ -5,6 +5,11 @@ | 89 | @@ -5,6 +5,11 @@ |
| @@ -102,11 +98,9 @@ index 2447f29..6f0dee6 100644 | |||
| 102 | 98 | ||
| 103 | /* | 99 | /* |
| 104 | * The "GOLDEN_RATIO_PRIME" is used in ifs/btrfs/brtfs_inode.h and | 100 | * The "GOLDEN_RATIO_PRIME" is used in ifs/btrfs/brtfs_inode.h and |
| 105 | diff --git a/lib/log.c b/lib/log.c | ||
| 106 | index 0cb47d7..39b1e3b 100644 | ||
| 107 | --- a/lib/log.c | 101 | --- a/lib/log.c |
| 108 | +++ b/lib/log.c | 102 | +++ b/lib/log.c |
| 109 | @@ -38,7 +38,11 @@ static char *prepare_attempt_prefix(const char *msg) | 103 | @@ -38,7 +38,11 @@ static char *prepare_attempt_prefix(cons |
| 110 | char buffer[ATTEMPT_ID_SIZE + 1]; | 104 | char buffer[ATTEMPT_ID_SIZE + 1]; |
| 111 | char *prefixed_msg = NULL; | 105 | char *prefixed_msg = NULL; |
| 112 | 106 | ||
| @@ -119,6 +113,3 @@ index 0cb47d7..39b1e3b 100644 | |||
| 119 | if (attempt_id) { | 113 | if (attempt_id) { |
| 120 | int len = sizeof(buffer) + 1 + strlen(msg) + 1; | 114 | int len = sizeof(buffer) + 1 + strlen(msg) + 1; |
| 121 | 115 | ||
| 122 | -- | ||
| 123 | 2.32.0 | ||
| 124 | |||
diff --git a/meta-networking/recipes-daemons/autofs/autofs/autofs-5.1.7-use-default-stack-size-for-threads.patch b/meta-networking/recipes-daemons/autofs/autofs/autofs-5.1.7-use-default-stack-size-for-threads.patch new file mode 100644 index 0000000000..b21e7c03bf --- /dev/null +++ b/meta-networking/recipes-daemons/autofs/autofs/autofs-5.1.7-use-default-stack-size-for-threads.patch | |||
| @@ -0,0 +1,110 @@ | |||
| 1 | autofs-5.1.7 - use default stack size for threads | ||
| 2 | |||
| 3 | From: Ian Kent <raven@themaw.net> | ||
| 4 | |||
| 5 | autofs uses PTHREAD_STACK_MIN to set the stack size for threads it | ||
| 6 | creates. | ||
| 7 | |||
| 8 | In two cases it is used to reduce the stack size for long running | ||
| 9 | service threads while it's used to allocate a larger stack for worker | ||
| 10 | threads that can have larger memory requirements. | ||
| 11 | |||
| 12 | In recent glibc releases PTHREAD_STACK_MIN is no longer a constant | ||
| 13 | which can lead to unexpectedly different stack sizes on different | ||
| 14 | architectures and the autofs assumption it's a constant causes a | ||
| 15 | compile failure. | ||
| 16 | |||
| 17 | The need to alter the stack size was due to observed stack overflow | ||
| 18 | which was thought to be due the thread stack being too small for autofs | ||
| 19 | and glibc alloca(3) usage. | ||
| 20 | |||
| 21 | Quite a bit of that alloca(3) usage has been eliminated from autofs now, | ||
| 22 | particularly those that might be allocating largish amounts of storage, | ||
| 23 | and there has been a lot of change in glibc too so using the thread | ||
| 24 | default stack should be ok. | ||
| 25 | |||
| 26 | Signed-off-by: Ian Kent <raven@themaw.net> | ||
| 27 | --- | ||
| 28 | CHANGELOG | 1 + | ||
| 29 | daemon/automount.c | 29 ----------------------------- | ||
| 30 | daemon/state.c | 6 +----- | ||
| 31 | lib/alarm.c | 6 +----- | ||
| 32 | 4 files changed, 3 insertions(+), 39 deletions(-) | ||
| 33 | |||
| 34 | --- a/daemon/automount.c | ||
| 35 | +++ b/daemon/automount.c | ||
| 36 | @@ -92,7 +92,6 @@ static size_t kpkt_len; | ||
| 37 | /* Attributes for creating detached and joinable threads */ | ||
| 38 | pthread_attr_t th_attr; | ||
| 39 | pthread_attr_t th_attr_detached; | ||
| 40 | -size_t detached_thread_stack_size = PTHREAD_STACK_MIN * 144; | ||
| 41 | |||
| 42 | struct master_readmap_cond mrc = { | ||
| 43 | PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0, NULL, 0, 0, 0, 0}; | ||
| 44 | @@ -2617,34 +2616,6 @@ int main(int argc, char *argv[]) | ||
| 45 | if (start_pipefd[1] != -1) { | ||
| 46 | res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); | ||
| 47 | close(start_pipefd[1]); | ||
| 48 | - } | ||
| 49 | - release_flag_file(); | ||
| 50 | - macro_free_global_table(); | ||
| 51 | - exit(1); | ||
| 52 | - } | ||
| 53 | - | ||
| 54 | -#ifdef _POSIX_THREAD_ATTR_STACKSIZE | ||
| 55 | - if (pthread_attr_setstacksize( | ||
| 56 | - &th_attr_detached, detached_thread_stack_size)) { | ||
| 57 | - logerr("%s: failed to set stack size thread attribute!", | ||
| 58 | - program); | ||
| 59 | - if (start_pipefd[1] != -1) { | ||
| 60 | - res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); | ||
| 61 | - close(start_pipefd[1]); | ||
| 62 | - } | ||
| 63 | - release_flag_file(); | ||
| 64 | - macro_free_global_table(); | ||
| 65 | - exit(1); | ||
| 66 | - } | ||
| 67 | -#endif | ||
| 68 | - | ||
| 69 | - if (pthread_attr_getstacksize( | ||
| 70 | - &th_attr_detached, &detached_thread_stack_size)) { | ||
| 71 | - logerr("%s: failed to get detached thread stack size!", | ||
| 72 | - program); | ||
| 73 | - if (start_pipefd[1] != -1) { | ||
| 74 | - res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); | ||
| 75 | - close(start_pipefd[1]); | ||
| 76 | } | ||
| 77 | release_flag_file(); | ||
| 78 | macro_free_global_table(); | ||
| 79 | --- a/daemon/state.c | ||
| 80 | +++ b/daemon/state.c | ||
| 81 | @@ -1173,12 +1173,8 @@ int st_start_handler(void) | ||
| 82 | status = pthread_attr_init(pattrs); | ||
| 83 | if (status) | ||
| 84 | pattrs = NULL; | ||
| 85 | - else { | ||
| 86 | + else | ||
| 87 | pthread_attr_setdetachstate(pattrs, PTHREAD_CREATE_DETACHED); | ||
| 88 | -#ifdef _POSIX_THREAD_ATTR_STACKSIZE | ||
| 89 | - pthread_attr_setstacksize(pattrs, PTHREAD_STACK_MIN*4); | ||
| 90 | -#endif | ||
| 91 | - } | ||
| 92 | |||
| 93 | status = pthread_create(&thid, pattrs, st_queue_handler, NULL); | ||
| 94 | |||
| 95 | --- a/lib/alarm.c | ||
| 96 | +++ b/lib/alarm.c | ||
| 97 | @@ -270,12 +270,8 @@ int alarm_start_handler(void) | ||
| 98 | status = pthread_attr_init(pattrs); | ||
| 99 | if (status) | ||
| 100 | pattrs = NULL; | ||
| 101 | - else { | ||
| 102 | + else | ||
| 103 | pthread_attr_setdetachstate(pattrs, PTHREAD_CREATE_DETACHED); | ||
| 104 | -#ifdef _POSIX_THREAD_ATTR_STACKSIZE | ||
| 105 | - pthread_attr_setstacksize(pattrs, PTHREAD_STACK_MIN*4); | ||
| 106 | -#endif | ||
| 107 | - } | ||
| 108 | |||
| 109 | status = pthread_condattr_init(&condattrs); | ||
| 110 | if (status) | ||
diff --git a/meta-networking/recipes-daemons/autofs/autofs_5.1.7.bb b/meta-networking/recipes-daemons/autofs/autofs_5.1.7.bb index 019b453c2c..fd49e53bbd 100644 --- a/meta-networking/recipes-daemons/autofs/autofs_5.1.7.bb +++ b/meta-networking/recipes-daemons/autofs/autofs_5.1.7.bb | |||
| @@ -26,6 +26,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/daemons/autofs/v5/autofs-${PV}.tar.gz \ | |||
| 26 | file://0001-Do-not-hardcode-path-for-pkg.m4.patch \ | 26 | file://0001-Do-not-hardcode-path-for-pkg.m4.patch \ |
| 27 | file://0001-Bug-fix-for-pid_t-not-found-on-musl.patch \ | 27 | file://0001-Bug-fix-for-pid_t-not-found-on-musl.patch \ |
| 28 | file://0001-Define-__SWORD_TYPE-if-undefined.patch \ | 28 | file://0001-Define-__SWORD_TYPE-if-undefined.patch \ |
| 29 | file://autofs-5.1.7-use-default-stack-size-for-threads.patch \ | ||
| 29 | " | 30 | " |
| 30 | SRC_URI[sha256sum] = "a18619e5ad18960fe382354eef33f070e57e4e5711d484b010acde080a003312" | 31 | SRC_URI[sha256sum] = "a18619e5ad18960fe382354eef33f070e57e4e5711d484b010acde080a003312" |
| 31 | 32 | ||
