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
This commit is contained in:
Nathan Whitehorn 2011-12-17 16:20:27 +00:00
parent 8ee4178c4c
commit 4b51c69976
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=228646
2 changed files with 9 additions and 2 deletions

View file

@ -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);
}

View file

@ -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);
}