ports/163116: [PATCH] devel/libtar: text relocations in .so on i386

Jilles Tjoelker jilles at stack.nl
Wed Dec 7 22:30:10 UTC 2011


>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:



More information about the freebsd-ports-bugs mailing list