svn commit: r228646 - in head/libexec/rtld-elf: powerpc powerpc64

Nathan Whitehorn nwhitehorn at FreeBSD.org
Sat Dec 17 16:20:27 UTC 2011


Author: nwhitehorn
Date: Sat Dec 17 16:20:27 2011
New Revision: 228646
URL: http://svn.freebsd.org/changeset/base/228646

Log:
  Additional icache paranoia: non-PLT relocations can modify the text segment.
  It is then important to make sure the icache is synchronized again to
  prevent (rare) random seg faults and illegal instructions.
  
  MFC after:	3 days

Modified:
  head/libexec/rtld-elf/powerpc/reloc.c
  head/libexec/rtld-elf/powerpc64/reloc.c

Modified: head/libexec/rtld-elf/powerpc/reloc.c
==============================================================================
--- head/libexec/rtld-elf/powerpc/reloc.c	Sat Dec 17 16:10:14 2011	(r228645)
+++ head/libexec/rtld-elf/powerpc/reloc.c	Sat Dec 17 16:20:27 2011	(r228646)
@@ -317,6 +317,10 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry 
 done:
 	if (cache != NULL)
 		free(cache);
+
+	/* Synchronize icache for text seg in case we made any changes */
+	__syncicache(obj->mapbase, obj->textsize);
+
 	return (r);
 }
 

Modified: head/libexec/rtld-elf/powerpc64/reloc.c
==============================================================================
--- head/libexec/rtld-elf/powerpc64/reloc.c	Sat Dec 17 16:10:14 2011	(r228645)
+++ head/libexec/rtld-elf/powerpc64/reloc.c	Sat Dec 17 16:20:27 2011	(r228646)
@@ -313,9 +313,12 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry 
 	}
 	r = 0;
 done:
-	if (cache) {
+	if (cache)
 		munmap(cache, bytes);
-	}
+
+	/* Synchronize icache for text seg in case we made any changes */
+	__syncicache(obj->mapbase, obj->textsize);
+
 	return (r);
 }
 


More information about the svn-src-head mailing list