Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 31 Dec 2011 15:08:34 +0000 (UTC)
From:      Nathan Whitehorn <nwhitehorn@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r229113 - in stable/9/libexec/rtld-elf: powerpc powerpc64
Message-ID:  <201112311508.pBVF8Y4I070041@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: nwhitehorn
Date: Sat Dec 31 15:08:33 2011
New Revision: 229113
URL: http://svn.freebsd.org/changeset/base/229113

Log:
  MFC r228646:
  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.

Modified:
  stable/9/libexec/rtld-elf/powerpc/reloc.c
  stable/9/libexec/rtld-elf/powerpc64/reloc.c
Directory Properties:
  stable/9/libexec/rtld-elf/   (props changed)

Modified: stable/9/libexec/rtld-elf/powerpc/reloc.c
==============================================================================
--- stable/9/libexec/rtld-elf/powerpc/reloc.c	Sat Dec 31 15:03:29 2011	(r229112)
+++ stable/9/libexec/rtld-elf/powerpc/reloc.c	Sat Dec 31 15:08:33 2011	(r229113)
@@ -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: stable/9/libexec/rtld-elf/powerpc64/reloc.c
==============================================================================
--- stable/9/libexec/rtld-elf/powerpc64/reloc.c	Sat Dec 31 15:03:29 2011	(r229112)
+++ stable/9/libexec/rtld-elf/powerpc64/reloc.c	Sat Dec 31 15:08:33 2011	(r229113)
@@ -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);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201112311508.pBVF8Y4I070041>