Dr. Werner Fink 2011-11-11 15:29:47 +00:00 committed by Git OBS Bridge
parent 8cc46344d2
commit acde7fa1ce
3 changed files with 57 additions and 0 deletions

49
bash-4.2-nscdunmap.dif Normal file
View File

@ -0,0 +1,49 @@
--- shell.c
+++ shell.c 2011-11-11 15:08:39.479158014 +0000
@@ -39,8 +39,8 @@
#include <errno.h>
#include "filecntl.h"
#include <pwd.h>
-
#if defined (HAVE_UNISTD_H)
+# include <sys/types.h>
# include <unistd.h>
#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 ();
}
}

View File

@ -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 Fri Nov 11 13:45:40 UTC 2011 - werner@suse.de

View File

@ -66,6 +66,7 @@ Patch9: bash-4.0-extended_quote.patch
Patch10: bash-3.2-printf.patch Patch10: bash-3.2-printf.patch
Patch11: bash-4.0-loadables.dif Patch11: bash-4.0-loadables.dif
Patch12: bash-4.1-completion.dif Patch12: bash-4.1-completion.dif
Patch13: bash-4.2-nscdunmap.dif
Patch14: bash-4.2-sigrestart.patch Patch14: bash-4.2-sigrestart.patch
Patch15: bash-3.2-longjmp.dif Patch15: bash-3.2-longjmp.dif
Patch16: bash-4.0-setlocale.dif Patch16: bash-4.0-setlocale.dif
@ -279,6 +280,7 @@ unset p
%patch10 -p0 -b .printf %patch10 -p0 -b .printf
%patch11 -p0 -b .plugins %patch11 -p0 -b .plugins
%patch12 -p0 -b .completion %patch12 -p0 -b .completion
%patch13 -p0 -b .nscdunmap
%patch14 -p0 -b .sigrestart %patch14 -p0 -b .sigrestart
%patch15 -p0 -b .longjmp %patch15 -p0 -b .longjmp
%patch16 -p0 -b .setlocale %patch16 -p0 -b .setlocale