[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: i386/1842: publicfile and djbdns have a quarel with ld.so
- To: bugs@openbsd.org
- Subject: Re: i386/1842: publicfile and djbdns have a quarel with ld.so
- From: Camiel Dobbelaar <cd@sentia.nl>
- Date: Tue, 29 May 2001 09:21:26 +0200
- Organization: Sentia
I wrote:
>> I wonder what change in -current caused 300000 bytes to no longer be
>> enough for the data segment. This is a hard-coded limit that is supposed
>> to work on all OS's...
David Lebel wrote:
> Actually, I've found that 350000 is required for tinydns and for
> publicfile's httpd and ftpd, the jump went from 50000 to 350000 (give or
> take a few bytes). This is wierd. The change happened before may 14th,
> because I got bitten by it at that time.
I found the commit that causes this behavior:
http://www.openbsd.org/cgi-bin/cvsweb/src/sys/uvm/uvm_mmap.c.diff?r1=1.11&r2=1.12&f=h
Specifically (layout will probably get mangled):
/*
* XXX (in)sanity check. We don't do proper datasize checking
* XXX for anonymous (or private writable) mmap(). However,
* XXX know that if we're trying to allocate more than the amount
* XXX remaining under our current data size limit, _that_ should
* XXX be disallowed.
*/
if ((flags & MAP_ANON) != 0 ||
((flags & MAP_PRIVATE) != 0 && (prot & PROT_WRITE) != 0)) {
if (size >
(p->p_rlimit[RLIMIT_DATA].rlim_cur - ctob(p->p_vmspace->vm_dsize))) {
return (ENOMEM);
}
}
This code originates from NetBSD so I checked tinydns on a NetBSD 1.5.1BETA2
machine. It worked normally.
I'm attaching two traces. I would appreciate it if the UVM gurus could take a
look at it. (*cough* Art *cough* :-)
--
Cam
OpenBSD
=======
6137 ktrace RET ktrace 0
6137 ktrace CALL execve(0xdfbfdc37,0xdfbfdbd8,0xdfbfdbe0)
6137 ktrace NAMI "/usr/local/bin/tinydns"
6137 tinydns EMUL "native"
6137 tinydns RET execve 0
6137 tinydns CALL open(0x10b1,0,0)
6137 tinydns NAMI "/usr/libexec/ld.so"
6137 tinydns RET open 3
6137 tinydns CALL read(0x3,0xdfbfdb88,0x20)
6137 tinydns GIO fd 3 read 32 bytes
"\M-@\M^F\^A\v\0\M-P\0\0\0 \0\0\0\0\0\0\0\0\0\0 \0\0\0\0\0\0\0\0\0\0\0"
6137 tinydns RET read 32/0x20
6137 tinydns CALL mmap(0,0xf000,0x5,0x2,0x3,0,0,0)
6137 tinydns RET mmap 1073770496/0x40007000
6137 tinydns CALL mmap(0x40014000,0x2000,0x3,0x12,0x3,0,0xd000,0)
6137 tinydns RET mmap 1073823744/0x40014000
6137 tinydns CALL getuid
6137 tinydns RET getuid 0
6137 tinydns CALL geteuid
6137 tinydns RET geteuid 0
6137 tinydns CALL getgid
6137 tinydns RET getgid 0
6137 tinydns CALL getegid
6137 tinydns RET getegid 0
6137 tinydns CALL __sysctl(0xdfbfda28,0x2,0x400153c8,0xdfbfda24,0,0)
6137 tinydns RET __sysctl 0
6137 tinydns CALL mmap(0,0x8000,0x3,0x1004,0xffffffff,0,0,0)
6137 tinydns RET mmap 1073831936/0x40016000
6137 tinydns CALL open(0x4000894f,0,0)
6137 tinydns NAMI "/var/run/ld.so.hints"
6137 tinydns RET open 4
6137 tinydns CALL mmap(0,0x1000,0x1,0x4,0x4,0,0,0)
6137 tinydns RET mmap 1073864704/0x4001e000
6137 tinydns CALL mmap(0x4001f000,0x89c,0x1,0x14,0x4,0,0x1000,0)
6137 tinydns RET mmap 1073868800/0x4001f000
6137 tinydns CALL open(0x4001f291,0,0)
6137 tinydns NAMI "/usr/lib/libc.so.27.0"
6137 tinydns RET open 5
6137 tinydns CALL read(0x5,0xdfbfda80,0x20)
6137 tinydns GIO fd 5 read 32 bytes
"\M-@\M^F\^A\v\0\M-p\a\0\0\M^P\0\0|\M-g\^B\0\M-|E\0\0 \0\0\0\0\0\0\0\0\
\0\0\0"
6137 tinydns RET read 32/0x20
6137 tinydns CALL mmap(0,0xb677c,0x5,0x4,0x5,0,0,0)
6137 tinydns RET mmap 1073872896/0x40020000
6137 tinydns CALL mprotect(0x4009f000,0x9000,0x7)
6137 tinydns RET mprotect 0
6137 tinydns CALL mmap(0x400a8000,0x2e77c,0x7,0x1014,0xffffffff,0,0,0)
6137 tinydns RET mmap -1 errno 12 Cannot allocate memory
====>
6137 tinydns CALL close(0x5)
6137 tinydns RET close 0
6137 tinydns CALL write(0x2,0xdfbfd488,0x14)
6137 tinydns GIO fd 2 wrote 20 bytes
"/usr/libexec/ld.so: "
6137 tinydns RET write 20/0x14
6137 tinydns CALL write(0x2,0xdfbfd4b8,0x15)
6137 tinydns GIO fd 2 wrote 21 bytes
"tinydns: libc.so.27.0"
6137 tinydns RET write 21/0x15
6137 tinydns CALL write(0x2,0xdfbfd478,0x2)
6137 tinydns GIO fd 2 wrote 2 bytes
": "
6137 tinydns RET write 2
6137 tinydns CALL issetugid
6137 tinydns RET issetugid 0
6137 tinydns CALL open(0xdfbfd5cc,0,0)
6137 tinydns NAMI "/usr/share/nls/C/libc.cat"
6137 tinydns RET open 5
6137 tinydns CALL fstat(0x5,0xdfbfd52c)
6137 tinydns RET fstat 0
6137 tinydns CALL mmap(0,0xe5a,0x1,0x1,0x5,0,0,0)
6137 tinydns RET mmap 1074622464/0x400d7000
6137 tinydns CALL close(0x5)
6137 tinydns RET close 0
6137 tinydns CALL munmap(0x400d7000,0xe5a)
6137 tinydns RET munmap 0
6137 tinydns CALL write(0x2,0xdfbfd478,0x17)
6137 tinydns GIO fd 2 wrote 23 bytes
"Cannot allocate memory
"
6137 tinydns RET write 23/0x17
6137 tinydns CALL exit(0x1)
NetBSD
======
2582 ktrace EMUL "netbsd"
2582 ktrace RET ktrace 0
2582 ktrace CALL execve(0xbfbfdcc7,0xbfbfdc30,0xbfbfdc38)
2582 ktrace NAMI "/usr/pkg/bin/tinydns"
2582 ktrace NAMI "/usr/libexec/ld.elf_so"
2582 tinydns EMUL "netbsd"
2582 tinydns RET execve JUSTRETURN
2582 tinydns CALL __sysctl(0xbfbfda38,0x2,0x48060280,0xbfbfda34,0,0)
2582 tinydns RET __sysctl 0
2582 tinydns CALL mmap(0,0x8000,0x3,0x1002,0xffffffff,0,0,0)
2582 tinydns RET mmap 1208356864/0x48061000
2582 tinydns CALL geteuid
2582 tinydns RET geteuid 0
2582 tinydns CALL getuid
2582 tinydns RET getuid 0
2582 tinydns CALL getegid
2582 tinydns RET getegid 0
2582 tinydns CALL getgid
2582 tinydns RET getgid 0
2582 tinydns CALL open(0x4805bfcf,0,0x4805f5f4)
2582 tinydns NAMI "/etc/ld.so.conf"
2582 tinydns RET open 3
2582 tinydns CALL __fstat13(0x3,0xbfbfdb6c)
2582 tinydns RET __fstat13 0
2582 tinydns CALL mmap(0,0x37,0x3,0x2,0x3,0,0,0)
2582 tinydns RET mmap 1208389632/0x48069000
2582 tinydns CALL close(0x3)
2582 tinydns RET close 0
2582 tinydns CALL munmap(0x48069000,0x37)
2582 tinydns RET munmap 0
2582 tinydns CALL __stat13(0x48064080,0xbfbfdacc)
2582 tinydns NAMI "/usr/lib/libc.so.12"
2582 tinydns RET __stat13 0
2582 tinydns CALL open(0x48064080,0,0x4805f5f4)
2582 tinydns NAMI "/usr/lib/libc.so.12"
2582 tinydns RET open 3
2582 tinydns CALL read(0x3,0xbfbfda98,0x34)
2582 tinydns GIO fd 3 read 52 bytes
"\^?ELF\^A\^A\^A\0\0\0\0\0\0\0\0\0\^C\0\^C\0\^A\0\0\0\0W\^A\0004\0\0\0\
\M-P\M^L\b\0\0\0\0\0004\0 \0\^D\0(\0=\0:\0"
2582 tinydns RET read 52/0x34
2582 tinydns CALL close(0x3)
2582 tinydns RET close 0
2582 tinydns CALL open(0x48064080,0,0x4805f5f4)
2582 tinydns NAMI "/usr/lib/libc.so.12"
2582 tinydns RET open 3
2582 tinydns CALL __fstat13(0x3,0xbfbfdb08)
2582 tinydns RET __fstat13 0
2582 tinydns CALL read(0x3,0xbfbfcae4,0x1000)
2582 tinydns GIO fd 3 read 4088 bytes
"\^?ELF\^A\^A\^A\0\0\0\0\0\0\0\0\0\^C\0\^C\0\^A\0\0\0\0W\^A\0004\0\0\0\
<snip>
\0\0\0\0\0\0\0\0\0\0'\^B\0\08\a\0\0\M-S\^C\0\0"
2582 tinydns GIO fd 3 read 8 bytes
"\M-.\^E\0\0\M-=\^D\0\0"
2582 tinydns RET read 4096/0x1000
2582 tinydns CALL mmap(0,0x8b000,0x5,0x2,0x3,0,0,0)
2582 tinydns RET mmap 1208389632/0x48069000
2582 tinydns CALL mmap(0x480e5000,0x4000,0x3,0x12,0x3,0,0x7b000,0)
2582 tinydns RET mmap 1208897536/0x480e5000
2582 tinydns CALL mmap(0x480e9000,0xb000,0x3,0x1012,0xffffffff,0,0,0)
2582 tinydns RET mmap 1208913920/0x480e9000
2582 tinydns CALL close(0x3)
2582 tinydns RET close 0
2582 tinydns CALL socket(0x2,0x2,0)
2582 tinydns RET socket 3
2582 tinydns CALL fcntl(0x3,0x3,0)
2582 tinydns RET fcntl 2
2582 tinydns CALL fcntl(0x3,0x4,0x6)
2582 tinydns RET fcntl 0
2582 tinydns CALL setsockopt(0x3,0xffff,0x4,0xbfbfdbd4,0x4)
2582 tinydns RET setsockopt 0
2582 tinydns CALL bind(0x3,0xbfbfdb90,0x10)
2582 tinydns RET bind 0
2582 tinydns CALL chdir(0xbfbfde14)
2582 tinydns NAMI "/var/tinydns/root"
2582 tinydns RET chdir 0
2582 tinydns CALL chroot(0x804c03a)
2582 tinydns NAMI "."
2582 tinydns RET chroot 0
2582 tinydns CALL setgroups(0x1,0xbfbfdbc4)
2582 tinydns RET setgroups 0
2582 tinydns CALL setgid(0x3e9)
2582 tinydns RET setgid 0
2582 tinydns CALL setuid(0x3e9)
2582 tinydns RET setuid 0
2582 tinydns CALL gettimeofday(0xbfbfdb94,0)
2582 tinydns RET gettimeofday 0
2582 tinydns CALL getpid
2582 tinydns RET getpid 2582/0xa16
2582 tinydns CALL getppid
2582 tinydns RET getppid 1667/0x683
2582 tinydns CALL fcntl(0x3,0x3,0)
2582 tinydns RET fcntl 6
2582 tinydns CALL fcntl(0x3,0x4,0x2)
2582 tinydns RET fcntl 0
2582 tinydns CALL setsockopt(0x3,0xffff,0x1002,0xbfbfdbe0,0x4)
2582 tinydns RET setsockopt 0
2582 tinydns CALL write(0x2,0x804bf78,0x11)
2582 tinydns GIO fd 2 wrote 17 bytes
"starting tinydns
"
2582 tinydns RET write 17/0x11
2582 tinydns CALL recvfrom(0x3,0x804daa0,0x201,0,0xbfbfdbc0,0xbfbfdbbc)
<hit ctrl-c>
2582 tinydns PSIG SIGINT SIG_DFL