[PATCH] Fix LD_ASSUME_KERNEL

Jakub Jelinek jakub@redhat.com
Mon May 30 19:31:00 GMT 2005


Hi!

Now that DL_SYSDEP_OSCHECK is done in rtld.c, after vDSO has been looked
at and more importantly after process_envvars, LD_ASSUME_KERNEL no longer
works, because GLRO(dl_osversion) is first set in process_envvars
and then unconditionally overwritten in DL_SYSDEP_OSCHECK.
The following patch fixes this by not overwriting GLRO(dl_osversion)
if it was set via LD_ASSUME_KERNEL to a value smaller than
_dl_discover_osversion ().

2005-05-30  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/unix/sysv/linux/dl-osinfo.h (DL_SYSDEP_OSCHECK): If
	GLRO(dl_osversion) has been already set to a value smaller than
	_dl_discover_osversion (), don't overwrite it here.

--- libc/sysdeps/unix/sysv/linux/dl-osinfo.h.jj	2005-04-27 12:33:22.000000000 +0200
+++ libc/sysdeps/unix/sysv/linux/dl-osinfo.h	2005-05-30 11:38:08.000000000 +0200
@@ -145,7 +145,9 @@ _dl_discover_osversion (void)
     int version = _dl_discover_osversion ();				      \
     if (__builtin_expect (version >= 0, 1))				      \
       {									      \
-	GLRO(dl_osversion) = version;					      \
+	if (__builtin_expect (GLRO(dl_osversion) == 0, 1)		      \
+	    || GLRO(dl_osversion) > version)				      \
+	  GLRO(dl_osversion) = version;					      \
 									      \
 	/* Now we can test with the required version.  */		      \
 	if (__LINUX_KERNEL_VERSION > 0 && version < __LINUX_KERNEL_VERSION)   \

	Jakub



More information about the Libc-hacker mailing list