From acde7fa1ce2dd048218412b3752884472348476c Mon Sep 17 00:00:00 2001 From: "Dr. Werner Fink" Date: Fri, 11 Nov 2011 15:29:47 +0000 Subject: [PATCH] . OBS-URL: https://build.opensuse.org/package/show/Base:System/bash?expand=0&rev=92 --- bash-4.2-nscdunmap.dif | 49 ++++++++++++++++++++++++++++++++++++++++++ bash.changes | 6 ++++++ bash.spec | 2 ++ 3 files changed, 57 insertions(+) create mode 100644 bash-4.2-nscdunmap.dif diff --git a/bash-4.2-nscdunmap.dif b/bash-4.2-nscdunmap.dif new file mode 100644 index 00000000..a39f6e64 --- /dev/null +++ b/bash-4.2-nscdunmap.dif @@ -0,0 +1,49 @@ +--- shell.c ++++ shell.c 2011-11-11 15:08:39.479158014 +0000 +@@ -39,8 +39,8 @@ + #include + #include "filecntl.h" + #include +- + #if defined (HAVE_UNISTD_H) ++# include + # include + #endif + +@@ -1630,6 +1630,28 @@ init_interactive_script () + expand_aliases = interactive_shell = startup_state = 1; + } + ++static void ++maybe_unmap_nscd (void) ++{ ++ unsigned long start, end, off; ++ char path[PATH_MAX]; ++ FILE *maps; ++ ++ if (getppid() != 1) ++ return; ++ if ((maps = fopen("/proc/self/maps", "r")) == NULL) ++ return; ++ ++ while (fscanf(maps, "%lx-%lx %*s %lx %*x:%*x %*lu %s", &start, &end, &off, &path[0]) == 4) ++ { ++ if (strncmp(path, "/var/run/nscd/", 14) != 0) ++ continue; ++ munmap((void*)start, end - start); ++ } ++ ++ fclose(maps); ++} ++ + void + get_current_user_info () + { +@@ -1655,6 +1677,7 @@ get_current_user_info () + current_user.home_dir = savestring ("/"); + } + endpwent (); ++ maybe_unmap_nscd (); + } + } + diff --git a/bash.changes b/bash.changes index 53caed12..a362fb16 100644 --- a/bash.changes +++ b/bash.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Nov 11 15:27:12 UTC 2011 - werner@suse.de + +- Avoid memory mapped /var/run/nscd/passwd at shutdown by simply + unmapping this only used area if parent is systemd or SysVinit + ------------------------------------------------------------------- Fri Nov 11 13:45:40 UTC 2011 - werner@suse.de diff --git a/bash.spec b/bash.spec index 246efb9b..ff088d36 100644 --- a/bash.spec +++ b/bash.spec @@ -66,6 +66,7 @@ Patch9: bash-4.0-extended_quote.patch Patch10: bash-3.2-printf.patch Patch11: bash-4.0-loadables.dif Patch12: bash-4.1-completion.dif +Patch13: bash-4.2-nscdunmap.dif Patch14: bash-4.2-sigrestart.patch Patch15: bash-3.2-longjmp.dif Patch16: bash-4.0-setlocale.dif @@ -279,6 +280,7 @@ unset p %patch10 -p0 -b .printf %patch11 -p0 -b .plugins %patch12 -p0 -b .completion +%patch13 -p0 -b .nscdunmap %patch14 -p0 -b .sigrestart %patch15 -p0 -b .longjmp %patch16 -p0 -b .setlocale