Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Aug 2007 07:47:27 +0200
From:      Wolfram Fenske <Wolfram.Fenske@Student.Uni-Magdeburg.DE>
To:        mailto:chuck@pkix.net
Cc:        ports@FreeBSD.org, Andy Polyakov <appro@fy.chalmers.se>
Subject:   FreeBSD Port: dvd+rw-tools-7.0: growisofs -version dumps core
Message-ID:  <86veb0jjm8.fsf@hondo.cadr.de>

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

Hello!

On my system [1],

  growisofs -version

causes a core dump in mkisofs (8).  The exact output is:

  * growisofs by <appro@fy.chalmers.se>, version 7.0.1,
    front-ending to mkisofs: Bus error(coredump)

(It says growisofs version 7.0.1, not 7.0, because I also use another
patch [2].  The problem occurs with or without this patch, though.)

I don't usually call growisofs like that myself, but k3b, for example,
does.

I can't say I understand the cause of the bug completely, but I
believe the problem is simply that growisofs calls setuid (2) and
munlockall (2) in the wrong order.  The attached patch fixes the
problem for me.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline; filename=patch-growisofs2.c
Content-Description: Patch to fix core dump in mkisofs when calling
	growisofs with the -version option

--- growisofs.c.orig	Tue Aug 28 06:30:16 2007
+++ growisofs.c	Tue Aug 28 07:10:32 2007
@@ -2924,10 +2924,16 @@
 		printf ("  front-ending to %s: ",mkisofs_argv[0]);
 		fflush (stdout);
 #if defined(__unix) || defined(__unix__)
-		setuid(getuid());
 # ifdef __FreeBSD__
 		munlockall();
-#endif
+# endif
+		/* Calling [setuid] before [munlockall] on FreeBSD
+		 * causes [munlockall] to fail.  This, in turn, leads
+		 * to a bus error in mkisofs and it dumps core.
+		 * However, calling [setuid] after [munlockall] works
+		 * just fine.
+		 */
+		setuid(getuid());
 		execlp (mkisofs_argv[0],mkisofs_argv[0],"-version",NULL);
 #elif defined(_WIN32)
 		if (_spawnl (_P_WAIT,mkisofs_argv[0],

--=-=-=



Greetings
Wolfram Fenske


Footnotes: 
[1]  $ uname -a
        FreeBSD hondo 6.1-RELEASE-p3 FreeBSD 6.1-RELEASE-p3 #1: Mon Jul  9 03:49:32 CEST 2007     wfenske@hondo:/usr/obj/usr/src/sys/NVE_RELEASE_6_1  i386

     The kernel is only slightly customized.  The only real difference
     is that I use the nve (4) driver from -CURRENT because my network
     adapter didn't work properly at the time I built the kernel.

[2]  <http://www.freebsd.org/cgi/cvsweb.cgi/ports/sysutils/dvd%2Brw-tools/files/patch-growisofs.c?rev=1.5>;


--=-=-=--



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