[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#21016: circular symlinks make libc6 segfaults



On Sun, Apr 12, 1998 at 02:20:59PM -0400, Dale Scheetz wrote:
> Can you outline a simple little test I can perform to determine whether or
> not this has been fixed? I'm working on the pre3 release of libc6 this
> weekend, so it would be a useful test to have in hand.
> 

Ok, sorry for not having supplied it before.
I already mentioned the realpath(1) command that you find in dwww package.

Now, create a circular symlink using absolute filenames (works good with
relative filenames).

$ ln -s /tmp/dd /tmp/cc   
$ ln -s /tmp/cc /tmp/dd
$ cat p.c
#include <sys/param.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>

main( int argc, char **argv)
{
        char rp[1024];
        char *res, *pt;
        int j;

        for ( j=1; j < argc; j++ )
        {
                pt = argv[j];
                fprintf (stderr, "%d  %s =", j, pt);
                res = realpath( pt, rp);
                fprintf (stderr, "==>");
                fprintf (stderr, "%s\n", rp);
        }
}


(note the include of stdlib.h, which is not needed according to the manpage,
but if you omit it you'll get the warning for the assignement to "res",
because the prototype isn't loaded: another bug, maybe in the includes, maybe
in the docs :-)


Then:

$ make p
$ p /tmp/cc
1  /tmp/cc =Segmentation fault (core dumped)
$ ls -la core 
-rw-------   1 fab      fab       8482816 Apr 13 00:49 core


To test the manpages, I do:

$ find `manpath | tr ':' ' '` -type l | xargs file | awk -F: '/broken/{ print $1 }' | xargs p
1  /usr/local/man/man4/pluto.4.gz ===>/usr/local/man/man4/pippo.4.gz
2  /usr/local/man/man4/pippo.4.gz ===>/usr/local/man/man4/pluto.4.gz
3  /usr/man/man1/editor.1 ===>/etc/alternatives/editor.1
4  /usr/man/man1/vi.1.gz ===>/etc/alternatives/vi.1.gz
5  /usr/man/man1/ctags.1.gz ===>/etc/alternatives/ctags.1.gz
6  /usr/man/man1/show.1 ===>/usr/man/man8/run-mailcap.8
7  /usr/man/man1/view.1.gz ===>/etc/alternatives/view.1.gz
8  /usr/man/man1/b2m.1.gz ===>/etc/alternatives/b2m.1.gz
9  /usr/man/man1/emacsclient.1.gz ===>/etc/alternatives/emacsclient.1.gz
10  /usr/man/man1/rcs-checkin.1.gz ===>/etc/alternatives/rcs-checkin.1.gz
11  /usr/man/man1/xemacs.1.gz ===>/usr/man/man1/xemacs20.gz
12  /usr/man/man1/uurecode.1.gz =xargs: p: terminated by signal 11


(only the last broken symlink is a circular symlink: 

$ p /usr/man/man1/uurecode.1.gz 
1  /usr/man/man1/uurecode.1.gz =Segmentation fault (core dumped)

(that manpage is a fake page I created to exploit this bug)

and also:

$ realpath /usr/man/man1/uurecode.1.gz 
Segmentation fault (core dumped)



Hope this helps.
fab
-- 
| fpolacco@icenet.fi    fpolacco@debian.org    fpolacco@pluto.linux.it
| Líder Minimo del Pluto    -     Debian Developer & Happy Debian User
| 6F7267F5 fingerprint 57 16 C4 ED C9 86 40 7B 1A 69 A1 66 EC FB D2 5E
> support the open-source initiative! http://www.opensource.org/


--
To UNSUBSCRIBE, email to debian-devel-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org


Reply to: