From owner-freebsd-stable@FreeBSD.ORG Thu Sep 16 21:46:41 2004 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4709016A4CE for ; Thu, 16 Sep 2004 21:46:41 +0000 (GMT) Received: from out01.grupos.com.br (out01.grupos.com.br [200.203.183.77]) by mx1.FreeBSD.org (Postfix) with ESMTP id 362AE43D2D for ; Thu, 16 Sep 2004 21:46:40 +0000 (GMT) (envelope-from marcus@corp.grupos.com.br) Received: from corp.grupos.com.br (unknown [150.162.166.55]) by out01.grupos.com.br (Postfix) with ESMTP id D752C1A8592 for ; Thu, 16 Sep 2004 18:46:35 -0300 (BRT) Received: from corp.grupos.com.br (localhost [127.0.0.1]) by corp.grupos.com.br (Postfix) with SMTP id 8CE3F20A8D for ; Thu, 16 Sep 2004 18:46:35 -0300 (BRT) Received: from [150.162.166.51] (unknown [150.162.166.51]) by corp.grupos.com.br (Postfix) with ESMTP id 3F04220A8A; Thu, 16 Sep 2004 18:46:35 -0300 (BRT) Message-ID: <414A09BA.3050406@corp.grupos.com.br> Date: Thu, 16 Sep 2004 18:46:34 -0300 From: Marcus Grando User-Agent: Mozilla Thunderbird 0.8 (X11/20040913) X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-stable@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Bug in setrlimit() on FreeBSD 4.10-RELEASE-p2 X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Sep 2004 21:46:41 -0000 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 #include #include 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