Skip site navigation (1)Skip section navigation (2)
Date:      Wed,  7 Dec 2011 23:26:11 +0100 (CET)
From:      Jilles Tjoelker <jilles@stack.nl>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/163116: [PATCH] devel/libtar: text relocations in .so on i386
Message-ID:  <20111207222611.9208828468@snail.stack.nl>
Resent-Message-ID: <201112072230.pB7MU9vs001846@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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 <bsd.port.pre.mk>
 .include "files/manpages"
 
-.if ${ARCH}!="i386"
 CPPFLAGS+=	-fPIC
-.endif
 
 .include <bsd.port.post.mk>
--- devel-libtar-fix-i386-textrel.patch ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



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