Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Dec 2004 16:35:10 +0100 (CET)
From:      Simon Barner <barner@gmx.de>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/75436: [maintainer] devel/valgrind*: Check for kernel option USER_LDT
Message-ID:  <20041223153510.5C3AEC0F7@zi025.glhnet.mhn.de>
Resent-Message-ID: <200412231540.iBNFeKh4010498@freefall.freebsd.org>

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

>Number:         75436
>Category:       ports
>Synopsis:       [maintainer] devel/valgrind*: Check for kernel option USER_LDT
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Thu Dec 23 15:40:19 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Simon Barner
>Release:        FreeBSD 5.3-STABLE i386
>Organization:
>Environment:
FreeBSD zi025.glhnet.mhn.de 5.3-STABLE FreeBSD 5.3-STABLE #0: Fri Nov  5 02:17:53 CET 2004     root@zi025.glhnet.mhn.de:/usr/obj/usr/src/sys/KISTE  i386

>Description:

Valgrind needs a kernel that is built with option USER_LDT to perform some kind of pointer analysis.

The attached patches print a warning in case the running kernel does not
support i386_set_ldt() and advises the user to rebuilt her kernel accordingly.

Please note: These patches are cumulative to
http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/71832

>How-To-Repeat:

N/A

>Fix:

--- valgrind-USER_LDT.patch begins here ---
diff -ruN valgrind.orig/Makefile valgrind/Makefile
--- valgrind.orig/Makefile	Thu Dec 23 16:11:47 2004
+++ valgrind/Makefile	Thu Dec 23 16:12:38 2004
@@ -69,6 +69,16 @@
 	@${INSTALL_DATA} ${WRKSRC}/coregrind/vg_unistd.h \
 		${PREFIX}/include/valgrind
 
+# Check if kernel is built with USER_LDT option (FreeBSD 4 only)
+.if ${OSVERSION} < 500000
+	@${PREFIX}/bin/valgrind --tool=memcheck true 2> ${WRKDIR}/ldt.test
+	@${GREP} i386_set_ldt ${WRKDIR}/ldt.test >/dev/null &&\
+	${ECHO_CMD} !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! && \
+	${ECHO_CMD} Please rebuild your kernel with ``options USER_LDT''! && \
+	${ECHO_CMD} Otherwise, valgrind will not be able to perform pointer analysis! && \
+	${ECHO_CMD} !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! || true
+.endif
+
 	@yes | ${PREFIX}/bin/valgrind --tool=memcheck --gen-suppressions=yes true \
 		| ${SED} -e 's,.*{$$,{,'  \
 		| ${GREP} -v '^=' \
--- valgrind-USER_LDT.patch ends here ---

--- valgrind-snapshot-USER_LDT.patch begins here ---
diff -ruN valgrind-snapshot.orig/Makefile valgrind-snapshot/Makefile
--- valgrind-snapshot.orig/Makefile	Thu Dec 23 16:15:19 2004
+++ valgrind-snapshot/Makefile	Thu Dec 23 16:14:45 2004
@@ -32,18 +32,17 @@
 
 .include <bsd.port.pre.mk>
 
-.if ${OSVERSION} >= 500000 
-PLIST_SUB+=	RELENG_4="@comment"
-PLIST_SUB+=	RELENG_5=""
-.else
-PLIST_SUB+=	RELENG_4=""
-PLIST_SUB+=	PRELENG_5="@comment"
-.endif
-
 .if ${PERL_LEVEL} < 500601
 IGNORE=		"can\'t be built. Your Perl version is too old. Please use lang/perl5.8 port to upgrade your Perl"
 .endif
 
+.if ${OSVERSION} < 500000
+PLIST_SUB+=	RELENG_4="" \
+		RELENG_5="@comment "
+.else
+PLIST_SUB+=	RELENG_4="@comment " \
+		RELENG_5=""
+.endif
 PROCFS!=	/sbin/mount | ${GREP} '^procfs' | ${AWK} '{print $1}'
 
 pre-everything::
@@ -73,6 +72,17 @@
 	@${INSTALL_DATA} ${WRKSRC}/coregrind/vg_unistd.h \
 		${PREFIX}/include/valgrind
 
+# Check if kernel is built with USER_LDT option (FreeBSD 4 only)
+.if ${OSVERSION} < 500000
+	@${PREFIX}/bin/valgrind --tool=memcheck true 2> ${WRKDIR}/ldt.test
+	@${GREP} i386_set_ldt ${WRKDIR}/ldt.test >/dev/null &&\
+	${ECHO_CMD} !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! && \
+	${ECHO_CMD} Please rebuild your kernel with ``options USER_LDT''! && \
+	${ECHO_CMD} Otherwise, valgrind will not be able to perform pointer analysis! && \
+	${ECHO_CMD} !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! || true
+.endif
+
+# Generate suppression files
 	@yes | ${PREFIX}/bin/valgrind --tool=memcheck --gen-suppressions=yes true \
 		| ${SED} -e 's,.*{$$,{,'  \
 		| ${GREP} -v '^=' \
--- valgrind-snapshot-USER_LDT.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?20041223153510.5C3AEC0F7>