From owner-svn-src-all@FreeBSD.ORG Sat Dec 17 16:20:27 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 99BBA1065670; Sat, 17 Dec 2011 16:20:27 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 87ED68FC1C; Sat, 17 Dec 2011 16:20:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBHGKRs3067111; Sat, 17 Dec 2011 16:20:27 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBHGKRiC067108; Sat, 17 Dec 2011 16:20:27 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201112171620.pBHGKRiC067108@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 17 Dec 2011 16:20:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228646 - in head/libexec/rtld-elf: powerpc powerpc64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Dec 2011 16:20:27 -0000 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); }