Date: Sat, 2 Feb 2002 07:10:02 -0800 (PST) From: Peter Pentchev <roam@ringlet.net> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/34483: wrong execv() call in amd for ${mount} and ${unmount} if mount type:=program in amd.map Message-ID: <200202021510.g12FA2n72257@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/34483; it has been noted by GNATS. From: Peter Pentchev <roam@ringlet.net> To: Artem 'Zazoobr' Ignatjev <timon@memphis.mephi.ru> Cc: bug-followup@FreeBSD.org Subject: Re: bin/34483: wrong execv() call in amd for ${mount} and ${unmount} if mount type:=program in amd.map Date: Sat, 2 Feb 2002 17:00:18 +0200 On Sat, Feb 02, 2002 at 02:40:02AM -0800, Artem 'Zazoobr' Ignatjev wrote: > Hi. > Here is reply from author, Erez Zadok (from amd-dev <amd-dev@cs.columbia.edu> mailing list): > [snip] > > type:=program;mount:="/etc/mount mount /this /here" [snip] > > It's a > > source of unfortunate confusion to programmers who are used to think that > > it's just an argv[] list. It's not. > > But I still think, that in case of hardlinks, this patch will work, and all man have to do > is to write the correct path in map; in other cases there could be no possibility to mount > filesystem "by hands", without writing shell script/tiny program, which will call exec...() on > one path, giving argv[0] with other prog's name. Actually, I now believe Erez to be correct - I no longer think this is a bug. What he is trying to say is that you should provide argv[0] along with the other arguments, *after* the path to the program. This allows you to execute a program, giving it an argv[0] different from the filename of the executable file - exactly the same way that inetd.conf's syntax allows you to do the same. This is done to minimize the need for hardlinks, as you say; even without a hardlink, you are able to invoke, say, /sbin/mount as either 'mount' or 'mount_ffs' or 'mount_msdosfs' or whatever else you like. Just take a look at inetd.conf: it will illustrate this perfectly: ftp stream tcp nowait root /usr/libexec/ftpd ftpd -l This is equivalent to amd's syntax of: type:=program;mount:="/usr/libexec/ftpd ftpd -l" IOW, invoke the program executable file /usr/libexec/ftpd, and pass it an argv[] list of argv[0]="ftpd", argv[1]="-l", argv[2]=NULL. If you do not wish to invoke programs with names other than their executable files' names, you just have to provide the program name twice, as in: type:=program;mount:="mount mount blah" ..though this is both unusable and insecure (think PATH). In an ideal case, you would provide a full path to the executable and just a name for the program, as in: type:=program;mount:="/sbin/mount mount blah" Can you provide an example of an executable/program name, which can NOT be handled by this scheme? If not, I think this PR should be closed.. Still, thanks for your effort to improve FreeBSD by filing a report on what you believed was a genuine problem! G'luck, Peter -- Peter Pentchev roam@ringlet.net roam@FreeBSD.org Hey, out there - is it *you* reading me, or is it someone else? To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200202021510.g12FA2n72257>