- Update to the Improve bash $RANDOM pseudo RNG (bug #234906) now works
with subshells and make $RANDOM on demand thus reducing the amount of
    AVCs thrown.
			
			
This commit is contained in:
		
							parent
							
								
									a2a31879cb
								
							
						
					
					
						commit
						eeaaae09ac
					
				| @ -1,6 +1,30 @@ | ||||
| --- bash-3.2/configure.in.rng	2007-04-05 11:07:40.000000000 +0200
 | ||||
| +++ bash-3.2/configure.in	2007-04-05 11:07:41.000000000 +0200
 | ||||
| @@ -111,6 +111,7 @@
 | ||||
| diff -up bash-3.2/config.h.in.rng.patch bash-3.2/config.h.in
 | ||||
| --- bash-3.2/config.h.in.rng.patch	2007-08-20 13:42:49.000000000 +0200
 | ||||
| +++ bash-3.2/config.h.in	2007-08-20 13:42:49.000000000 +0200
 | ||||
| @@ -203,6 +203,8 @@
 | ||||
|   | ||||
|  #define DEFAULT_MAIL_DIRECTORY "/var/spool/mail" | ||||
|   | ||||
| +#undef PATH_RANDOMDEV
 | ||||
| +
 | ||||
|  /* Characteristics of the system's header files and libraries that affect | ||||
|     the compilation environment. */ | ||||
|   | ||||
| @@ -817,6 +819,10 @@
 | ||||
|  /* Define if you have the wcwidth function.  */ | ||||
|  #undef HAVE_WCWIDTH | ||||
|   | ||||
| +#undef HAVE_RANDOM
 | ||||
| +
 | ||||
| +#undef HAVE_SRANDOM
 | ||||
| +
 | ||||
|  /* Presence of certain system include files. */ | ||||
|   | ||||
|  /* Define if you have the <arpa/inet.h> header file. */ | ||||
| diff -up bash-3.2/configure.in.rng.patch bash-3.2/configure.in
 | ||||
| --- bash-3.2/configure.in.rng.patch	2007-08-20 13:42:49.000000000 +0200
 | ||||
| +++ bash-3.2/configure.in	2007-08-20 13:42:49.000000000 +0200
 | ||||
| @@ -111,6 +111,7 @@ AC_ARG_WITH(gnu-malloc, AC_HELP_STRING([
 | ||||
|  AC_ARG_WITH(installed-readline, AC_HELP_STRING([--with-installed-readline], [use a version of the readline library that is already installed]), opt_with_installed_readline=$withval) | ||||
|  AC_ARG_WITH(purecov, AC_HELP_STRING([--with-purecov], [configure to postprocess with pure coverage]), opt_purecov=$withval) | ||||
|  AC_ARG_WITH(purify, AC_HELP_STRING([--with-purify], [configure to postprocess with purify]), opt_purify=$withval) | ||||
| @ -8,7 +32,7 @@ | ||||
|   | ||||
|  if test "$opt_bash_malloc" = yes; then | ||||
|  	MALLOC_TARGET=malloc | ||||
| @@ -152,6 +153,15 @@
 | ||||
| @@ -152,6 +153,15 @@ if test -z "${DEBUGGER_START_FILE}"; the
 | ||||
|  	DEBUGGER_START_FILE=${ac_default_prefix}/share/bashdb/bashdb-main.inc | ||||
|  fi | ||||
|   | ||||
| @ -24,7 +48,7 @@ | ||||
|  dnl optional shell features in config.h.in | ||||
|  opt_minimal_config=no | ||||
|   | ||||
| @@ -708,6 +718,8 @@
 | ||||
| @@ -708,6 +718,8 @@ AC_CHECK_FUNCS(bcopy bzero confstr fnmat
 | ||||
|  		setenv setlinebuf setlocale setvbuf siginterrupt strchr \ | ||||
|  		sysconf tcgetattr times ttyname tzset unsetenv) | ||||
|   | ||||
| @ -33,30 +57,9 @@ | ||||
|  AC_CHECK_FUNCS(vsnprintf snprintf vasprintf asprintf) | ||||
|  AC_CHECK_FUNCS(isascii isblank isgraph isprint isspace isxdigit) | ||||
|  AC_CHECK_FUNCS(getpwent getpwnam getpwuid) | ||||
| --- bash-3.2/config.h.in.rng	2007-04-05 11:07:40.000000000 +0200
 | ||||
| +++ bash-3.2/config.h.in	2007-04-05 11:07:41.000000000 +0200
 | ||||
| @@ -203,6 +203,8 @@
 | ||||
|   | ||||
|  #define DEFAULT_MAIL_DIRECTORY "/var/spool/mail" | ||||
|   | ||||
| +#undef PATH_RANDOMDEV
 | ||||
| +
 | ||||
|  /* Characteristics of the system's header files and libraries that affect | ||||
|     the compilation environment. */ | ||||
|   | ||||
| @@ -815,6 +817,10 @@
 | ||||
|  /* Define if you have the wcwidth function.  */ | ||||
|  #undef HAVE_WCWIDTH | ||||
|   | ||||
| +#undef HAVE_RANDOM
 | ||||
| +
 | ||||
| +#undef HAVE_SRANDOM
 | ||||
| +
 | ||||
|  /* Presence of certain system include files. */ | ||||
|   | ||||
|  /* Define if you have the <arpa/inet.h> header file. */ | ||||
| --- bash-3.2/variables.c.rng	2006-09-08 19:33:32.000000000 +0200
 | ||||
| +++ bash-3.2/variables.c	2007-04-05 11:53:03.000000000 +0200
 | ||||
| diff -up bash-3.2/variables.c.rng.patch bash-3.2/variables.c
 | ||||
| --- bash-3.2/variables.c.rng.patch	2006-09-08 19:33:32.000000000 +0200
 | ||||
| +++ bash-3.2/variables.c	2007-08-20 16:16:56.000000000 +0200
 | ||||
| @@ -42,6 +42,11 @@
 | ||||
|  #include "bashansi.h" | ||||
|  #include "bashintl.h" | ||||
| @ -69,7 +72,7 @@ | ||||
|  #include "shell.h" | ||||
|  #include "flags.h" | ||||
|  #include "execute_cmd.h" | ||||
| @@ -182,7 +187,8 @@
 | ||||
| @@ -182,7 +187,8 @@ static SHELL_VAR *get_seconds __P((SHELL
 | ||||
|  static SHELL_VAR *init_seconds_var __P((void)); | ||||
|   | ||||
|  static int brand __P((void)); | ||||
| @ -79,16 +82,17 @@ | ||||
|  static SHELL_VAR *assign_random __P((SHELL_VAR *, char *, arrayind_t)); | ||||
|  static SHELL_VAR *get_random __P((SHELL_VAR *)); | ||||
|   | ||||
| @@ -495,7 +501,7 @@
 | ||||
| @@ -494,9 +500,6 @@ initialize_shell_variables (env, privmod
 | ||||
|      } | ||||
|  #endif /* HISTORY */ | ||||
|   | ||||
|    /* Seed the random number generator. */ | ||||
| -  /* Seed the random number generator. */
 | ||||
| -  sbrand (dollar_dollar_pid + shell_start_time);
 | ||||
| +  seed_random();
 | ||||
|   | ||||
| -
 | ||||
|    /* Handle some "special" variables that we may have inherited from a | ||||
|       parent shell. */ | ||||
| @@ -1143,7 +1149,9 @@
 | ||||
|    if (interactive_shell) | ||||
| @@ -1143,9 +1146,11 @@ init_seconds_var ()
 | ||||
|  } | ||||
|        | ||||
|  /* The random number seed.  You can change this by setting RANDOM. */ | ||||
| @ -96,9 +100,12 @@ | ||||
|  static unsigned long rseed = 1; | ||||
| +#endif
 | ||||
|  static int last_random_value; | ||||
|  static int seeded_subshell = 0; | ||||
| -static int seeded_subshell = 0;
 | ||||
| +static int seeded_subshell = -1;
 | ||||
|   | ||||
| @@ -1155,26 +1163,56 @@
 | ||||
|  /* A linear congruential random number generator based on the example | ||||
|     one in the ANSI C standard.  This one isn't very good, but a more | ||||
| @@ -1155,28 +1160,58 @@ static int seeded_subshell = 0;
 | ||||
|  static int | ||||
|  brand () | ||||
|  { | ||||
| @ -110,7 +117,7 @@ | ||||
| +#endif
 | ||||
|    return ((unsigned int)((rseed >> 16) & 32767));	/* was % 32768 */ | ||||
|  } | ||||
| -
 | ||||
|   | ||||
|  /* Set the random number generator seed to SEED. */ | ||||
|  static void | ||||
|  sbrand (seed) | ||||
| @ -154,16 +161,24 @@ | ||||
|       arrayind_t unused; | ||||
|  { | ||||
| -  sbrand (strtoul (value, (char **)NULL, 10));
 | ||||
| -  if (subshell_environment)
 | ||||
| -    seeded_subshell = 1;
 | ||||
| +  sbrand ((unsigned int)strtoul (value, (char **)NULL, 10));
 | ||||
|    if (subshell_environment) | ||||
|      seeded_subshell = 1; | ||||
| +  seeded_subshell = subshell_level;
 | ||||
|    return (self); | ||||
| @@ -1188,7 +1226,7 @@
 | ||||
|  } | ||||
|   | ||||
| @@ -1186,10 +1221,10 @@ get_random_number ()
 | ||||
|    int rv; | ||||
|   | ||||
|    /* Reset for command and process substitution. */ | ||||
|    if (subshell_environment && seeded_subshell == 0) | ||||
| -  if (subshell_environment && seeded_subshell == 0)
 | ||||
| +  if (seeded_subshell < subshell_level)
 | ||||
|      { | ||||
| -      sbrand (rseed + getpid() + NOW);
 | ||||
| -      seeded_subshell = 1;
 | ||||
| +      seed_random ();
 | ||||
|        seeded_subshell = 1; | ||||
| +      seeded_subshell = subshell_level;
 | ||||
|      } | ||||
|   | ||||
|    do | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| Version: 3.2 | ||||
| Name: bash | ||||
| Summary: The GNU Bourne Again shell (bash) version %{version} | ||||
| Release: 14%{?dist} | ||||
| Release: 15%{?dist} | ||||
| Group: System Environment/Shells | ||||
| License: GPLv2+ | ||||
| Url: http://www.gnu.org/software/bash | ||||
| @ -240,12 +240,12 @@ fi | ||||
| %doc doc/*.ps doc/*.0 doc/*.html doc/article.txt | ||||
| 
 | ||||
| %changelog | ||||
| * Mon Aug 20 2007 Pete Graner <pgraner@redhat.com> - 3.2-14 | ||||
| * Mon Aug 20 2007 Pete Graner <pgraner@redhat.com> - 3.2-15 | ||||
| - Update to the Improve bash $RANDOM pseudo RNG (bug #234906)  | ||||
|   now works with subshells and make $RANDOM on demand thus reducing the  | ||||
|   amount of AVCs thrown. | ||||
| 
 | ||||
| * Thu Aug 16 2007 Pete Graner <pgraner@redhat.com> - 3.2-14 | ||||
| * Thu Aug 16 2007 Pete Graner <pgraner@redhat.com> - 3.2-15 | ||||
| - Changed spec file License to GPLv2+ | ||||
| 
 | ||||
| * Wed Aug 15 2007 Pete Graner <pgraner@redhat.com> - 3.2-13 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user