diff options
author | nwhitehorn <nwhitehorn@FreeBSD.org> | 2011-12-17 16:20:27 +0000 |
---|---|---|
committer | nwhitehorn <nwhitehorn@FreeBSD.org> | 2011-12-17 16:20:27 +0000 |
commit | f8b4a766de2be2a507d2dd0f699a5b2926c67df8 (patch) | |
tree | 6afd24f0b93d40c991c7bd1103fd2ce2f1851472 /libexec | |
parent | 270e7ed83a884df4d028c42cfd58a5ec4dc10c8e (diff) | |
download | FreeBSD-src-f8b4a766de2be2a507d2dd0f699a5b2926c67df8.zip FreeBSD-src-f8b4a766de2be2a507d2dd0f699a5b2926c67df8.tar.gz |
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
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/rtld-elf/powerpc/reloc.c | 4 | ||||
-rw-r--r-- | libexec/rtld-elf/powerpc64/reloc.c | 7 |
2 files changed, 9 insertions, 2 deletions
diff --git a/libexec/rtld-elf/powerpc/reloc.c b/libexec/rtld-elf/powerpc/reloc.c index c8967b6..d0637f4 100644 --- a/libexec/rtld-elf/powerpc/reloc.c +++ b/libexec/rtld-elf/powerpc/reloc.c @@ -317,6 +317,10 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, RtldLockState *lockstate) done: if (cache != NULL) free(cache); + + /* Synchronize icache for text seg in case we made any changes */ + __syncicache(obj->mapbase, obj->textsize); + return (r); } diff --git a/libexec/rtld-elf/powerpc64/reloc.c b/libexec/rtld-elf/powerpc64/reloc.c index 7476a1e..47368a8 100644 --- a/libexec/rtld-elf/powerpc64/reloc.c +++ b/libexec/rtld-elf/powerpc64/reloc.c @@ -313,9 +313,12 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, RtldLockState *lockstate) } 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); } |