From owner-freebsd-ports-bugs@FreeBSD.ORG Wed Dec 7 22:30:10 2011 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 54080106566B for ; Wed, 7 Dec 2011 22:30:10 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 16C388FC16 for ; Wed, 7 Dec 2011 22:30:10 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id pB7MU9MI001848 for ; Wed, 7 Dec 2011 22:30:09 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id pB7MU9vs001846; Wed, 7 Dec 2011 22:30:09 GMT (envelope-from gnats) Resent-Date: Wed, 7 Dec 2011 22:30:09 GMT Resent-Message-Id: <201112072230.pB7MU9vs001846@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Jilles Tjoelker Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA2D51065672 for ; Wed, 7 Dec 2011 22:26:12 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) by mx1.freebsd.org (Postfix) with ESMTP id 65FB18FC0C for ; Wed, 7 Dec 2011 22:26:12 +0000 (UTC) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id B89F4359D9F for ; Wed, 7 Dec 2011 23:26:11 +0100 (CET) Received: by snail.stack.nl (Postfix, from userid 1677) id 9208828468; Wed, 7 Dec 2011 23:26:11 +0100 (CET) Message-Id: <20111207222611.9208828468@snail.stack.nl> Date: Wed, 7 Dec 2011 23:26:11 +0100 (CET) From: Jilles Tjoelker To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: ports/163116: [PATCH] devel/libtar: text relocations in .so on i386 X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Jilles Tjoelker List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 22:30:10 -0000 >Number: 163116 >Category: ports >Synopsis: [PATCH] devel/libtar: text relocations in .so on i386 >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Dec 07 22:30:09 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Jilles Tjoelker >Release: FreeBSD 8.2-STABLE i386 >Organization: The FreeBSD Project >Environment: libtar-1.2.11_2 >Description: The library libtar.so.0 has text relocations, meaning relocations in the program code that should be read-only. Text relocations cause unnecessary load on the VM system and may affect security negatively. >How-To-Repeat: There is a DT_TEXTREL entry: % objdump -p /usr/local/lib/libtar.so.0 | grep TEXTREL There are many relocations in the text segment (mostly R_386_PC32 on i386): % objdump -R /usr/local/lib/libtar.so.0 | less It is expected on i386 to have mainly R_386_RELATIVE, R_386_GLOB_DAT and R_386_JUMP_SLOT relocations plus some R_386_32. >Fix: The build process generates libtar.so.0 from objects that were not compiled with -fPIC. The below patch adds this. While it works to add non-PIC objects to a shared object on i386 (different from amd64 where it does not work), this is not a good idea. --- devel-libtar-fix-i386-textrel.patch begins here --- --- ports/devel/libtar/Makefile.orig 2011-09-24 00:22:07.000000000 +0200 +++ ports/devel/libtar/Makefile 2011-12-07 23:14:20.000000000 +0100 @@ -25,8 +25,6 @@ .include .include "files/manpages" -.if ${ARCH}!="i386" CPPFLAGS+= -fPIC -.endif .include --- devel-libtar-fix-i386-textrel.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted: