Date: Thu, 16 Sep 2004 18:46:34 -0300 From: Marcus Grando <marcus@corp.grupos.com.br> To: freebsd-stable@freebsd.org Subject: Bug in setrlimit() on FreeBSD 4.10-RELEASE-p2 Message-ID: <414A09BA.3050406@corp.grupos.com.br>
next in thread | raw e-mail | index | archive | help
Hi list, I discovered one bug in setrlimit on 4.10-RELEASE-p2. When setting rlim_cur < 1474268*1024, system return SIGBUS, but rlim_cur=1474268*1024 work. On 4.10-RELEASE this issue not occurs. Example and strace above... --example.c-- #include <sys/types.h> #include <sys/time.h> #include <sys/resource.h> int main() { struct rlimit limit; limit.rlim_cur=1474267*1024; limit.rlim_max=1536000*1024; setrlimit(RLIMIT_STACK , &limit); exit(0); } -- --strace on 4.10-RELEASE-p2-- execve("./setrlimit-bug", ["./setrlimit-bug"], [/* 14 vars */]) = 0 mmap(0, 2048, PROT_READ|PROT_WRITE, MAP_ANON, -1, 0) = 0x65c65000 munmap(0x65c65000, 2048) = 0 __sysctl([hw.pagesize], 2, "\0\20\0\0", [4], NULL, 0) = 0 mmap(0, 32768, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0) = 0x65c65000 geteuid(0xbfbffca4) = 0 getuid() = 0 (euid 0) getegid(0xbfbffca4) = 0 getgid() = 0 (egid 0) open("/etc/libmap.conf", O_RDONLY) = -1 ENOENT (No such file or directory) open("/var/run/ld-elf.so.hints", O_RDONLY) = 3 read(3, "Ehnt\1\0\0\0\200\0\0\0=\0\0\0\0\0\0\0<\0\0\0\0\0\0\0\0"..., 128) = 128 lseek(3, 128, SEEK_SET) = 128 read(3, "/usr/lib:/usr/lib/compat:/usr/lo"..., 61) = 61 close(3) = 0 access("/usr/lib/libc.so.4", F_OK) = 0 open("/usr/lib/libc.so.4", O_RDONLY) = 3 fstat(3, {st_mode=S_IFREG|0444, st_size=677180, ...}) = 0 read(3, "\177ELF\1\1\1\t\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\254$\1"..., 4096) = 4096 mmap(0, 724992, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_NOCORE, 3, 0) = 0x65c6d000 mprotect(0x65d06000, 4096, PROT_READ|PROT_WRITE|PROT_EXEC) = 0 mprotect(0x65d06000, 4096, PROT_READ|PROT_EXEC) = 0 mmap(0x65d07000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x99000) = 0x65d07000 mmap(0x65d0b000, 77824, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANON, -1, 0) = 0x65d0b000 close(3) = 0 mmap(0, 128, PROT_READ|PROT_WRITE, MAP_ANON, -1, 0) = 0x65d1e000 munmap(0x65d1e000, 128) = 0 mmap(0, 13360, PROT_READ|PROT_WRITE, MAP_ANON, -1, 0) = 0x65d1e000 munmap(0x65d1e000, 13360) = 0 sigaction(SIGILL, {0x65c4f520, [], 0}, {SIG_DFL}) = 0 sigprocmask(SIG_BLOCK, NULL, []) = 0 sigaction(SIGILL, {SIG_DFL}, NULL) = 0 sigprocmask(SIG_BLOCK, ~[ILL TRAP ABRT EMT FPE BUS SEGV SYS], []) = 0 sigprocmask(SIG_SETMASK, [], NULL) = 0 setrlimit(RLIMIT_STACK, {rlim_cur=1474267*1024, rlim_max=1536000*1024}) = 0 --- SIGBUS (Bus error) --- --- SIGBUS (Bus error) --- -- --strace on 4.10-RELEASE-- execve("./setrlimit-bug", ["./setrlimit-bug"], [/* 17 vars */]) = 0 mmap(0, 2048, PROT_READ|PROT_WRITE, MAP_ANON, -1, 0) = 0x46865000 munmap(0x46865000, 2048) = 0 __sysctl([hw.pagesize], 2, "\0\20\0\0", [4], NULL, 0) = 0 mmap(0, 32768, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0) = 0x46865000 geteuid(0xbfbffc44) = 0 getuid() = 0 (euid 0) getegid(0xbfbffc44) = 0 getgid() = 0 (egid 0) open("/etc/libmap.conf", O_RDONLY) = -1 ENOENT (No such file or directory) open("/var/run/ld-elf.so.hints", O_RDONLY) = 3 read(3, "Ehnt\1\0\0\0\200\0\0\0<\3\0\0\0\0\0\0;\3\0\0\0\0\0\0\0"..., 128) = 128 lseek(3, 128, SEEK_SET) = 128 read(3, "/usr/lib:/usr/lib/compat:/usr/lo"..., 828) = 828 close(3) = 0 access("/usr/lib/libc.so.4", F_OK) = 0 open("/usr/lib/libc.so.4", O_RDONLY) = 3 fstat(3, {st_mode=S_IFREG|0444, st_size=677180, ...}) = 0 read(3, "\177ELF\1\1\1\t\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\254$\1"..., 4096) = 4096 mmap(0, 724992, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_NOCORE, 3, 0) = 0x4686d000 mprotect(0x46906000, 4096, PROT_READ|PROT_WRITE|PROT_EXEC) = 0 mprotect(0x46906000, 4096, PROT_READ|PROT_EXEC) = 0 mmap(0x46907000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x99000) = 0x46907000 mmap(0x4690b000, 77824, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANON, -1, 0) = 0x4690b000 close(3) = 0 mmap(0, 128, PROT_READ|PROT_WRITE, MAP_ANON, -1, 0) = 0x4691e000 munmap(0x4691e000, 128) = 0 mmap(0, 13360, PROT_READ|PROT_WRITE, MAP_ANON, -1, 0) = 0x4691e000 munmap(0x4691e000, 13360) = 0 sigaction(SIGILL, {0x4684f520, [], 0}, {SIG_DFL}) = 0 sigprocmask(SIG_BLOCK, NULL, []) = 0 sigaction(SIGILL, {SIG_DFL}, NULL) = 0 sigprocmask(SIG_BLOCK, ~[ILL TRAP ABRT EMT FPE BUS SEGV SYS], []) = 0 sigprocmask(SIG_SETMASK, [], NULL) = 0 setrlimit(RLIMIT_STACK, {rlim_cur=1024*1024, rlim_max=1536000*1024}) = 0 exit(0) = ? -- Regards -- Marcus Grando Grupos Internet S/A marcus(at)corp.grupos.com.br
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?414A09BA.3050406>