|
From: Roland M. <rol...@nr...> - 2012-05-27 00:19:25
|
On Sun, May 27, 2012 at 2:08 AM, Roland Mainz <rol...@nr...> wrote: > Does anyone know why valgrind goes berserk on such a simple shell > builtin like ulimit? > > I tried a simple, plain, innocent ulimit -a within ksh (ksh93 from > 20120504) and got this reply: > ======================= > valgrind ~/bin/ksh -c 'ulimit -a' > ==29376== Memcheck, a memory error detector > ==29376== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al. > ==29376== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info > ==29376== Command: /home/danny/bin/ksh -c ulimit\ -a > ==29376== > > valgrind: m_syswrap/syswrap-linux.c:3655 > (vgSysWrap_linux_sys_fcntl_before): Assertion 'Unimplemented > functionality' failed. > valgrind: valgrind > ==29376== at 0x3804CF26: ??? (in /usr/lib64/valgrind/memcheck-amd64-linux) > ==29376== by 0x3804D0CC: ??? (in /usr/lib64/valgrind/memcheck-amd64-linux) > ==29376== by 0x380A8D8A: ??? (in /usr/lib64/valgrind/memcheck-amd64-linux) > ==29376== by 0x380881A7: ??? (in /usr/lib64/valgrind/memcheck-amd64-linux) > ==29376== by 0x3808501C: ??? (in /usr/lib64/valgrind/memcheck-amd64-linux) > ==29376== by 0x380861C9: ??? (in /usr/lib64/valgrind/memcheck-amd64-linux) > ==29376== by 0x38095C54: ??? (in /usr/lib64/valgrind/memcheck-amd64-linux) > > sched status: > running_tid=1 > > Thread 1: status = VgTs_Runnable > ==29376== at 0x53586B8: do_fcntl (in /lib64/libc-2.14.1.so) > ==29376== by 0x5358837: fcntl (in /lib64/libc-2.14.1.so) > ==29376== by 0x5336724: pathconf (in /lib64/libc-2.14.1.so) > ==29376== by 0x551D7C: print (astconf.c:1115) > ==29376== by 0x553024: astgetconf (astconf.c:1477) > ==29376== by 0x553654: astconf (astconf.c:1555) > ==29376== by 0x4A9B41: b_ulimit (ulimit.c:201) > ==29376== by 0x4815B6: sh_exec (xec.c:1367) > ==29376== by 0x418956: exfile (main.c:600) > ==29376== by 0x417B40: sh_main (main.c:373) > ==29376== by 0x416C28: main (pmain.c:45) > > > Note: see also the FAQ in the source distribution. > It contains workarounds to several common problems. > In particular, if Valgrind aborted or crashed after > identifying problems in your program, there's a good chance > that fixing those problems will prevent Valgrind aborting or > crashing, especially if it happened in m_mallocfree.c. > > If that doesn't help, please report this bug to: www.valgrind.org > > In the bug report, send all the above text, the valgrind > version, and what OS and version you are using. Thanks. > ======================= > > Without valgrind the call to ulimit -a worked as I would expect it: > ======================= > ksh -c 'ulimit -a' > address space limit (kbytes) (-M) unlimited > core file size (blocks) (-c) unlimited > cpu time (seconds) (-t) unlimited > data size (kbytes) (-d) unlimited > file size (blocks) (-f) unlimited > locks (-x) unlimited > locked address space (kbytes) (-l) 64 > message queue size (kbytes) (-q) 800 > nice (-e) 0 > nofile (-n) 1024 > nproc (-u) 5796 > pipe buffer size (bytes) (-p) 4096 > max memory size (kbytes) (-m) unlimited > rtprio (-r) 0 > socket buffer size (bytes) (-b) 4096 > sigpend (-i) 5796 > stack size (kbytes) (-s) 8192 > swap size (kbytes) (-w) not supported > threads (-T) not supported > process size (kbytes) (-v) unlimited > ======================= Grumpf... it's "ulimit -p" which causes this trouble (it uses |pathconf()| to find the pipe buffer size): -- snip -- #0 0x00007ffff769c630 in pathconf () from /lib64/libc.so.6 #1 0x0000000000551d7d in print (sp=0x0, look=0x7fffffffd6b0, name=0x586512 "PIPE_BUF", path=0x7f35c8 "/", listflags=0, conferror=0) at /home/test001/work/ast_ksh_20120518/build_normal_64bit_mamfilefix/src/lib/libast/port/astconf.c:1115 #2 0x0000000000553025 in astgetconf (name=0x586512 "PIPE_BUF", path=0x7f35c8 "/", value=0x0, flags=0, conferror=0) at /home/test001/work/ast_ksh_20120518/build_normal_64bit_mamfilefix/src/lib/libast/port/astconf.c:1477 #3 0x0000000000553655 in astconf (name=0x586512 "PIPE_BUF", path=0x0, value=0x0) at /home/test001/work/ast_ksh_20120518/build_normal_64bit_mamfilefix/src/lib/libast/port/astconf.c:1555 #4 0x00000000004a9b42 in b_ulimit (argc=2, argv=0x7ffff7fb0690, context=0x7f4a08) at /home/test001/work/ast_ksh_20120518/build_normal_64bit_mamfilefix/src/cmd/ksh93/bltins/ulimit.c:201 #5 0x00000000004815b7 in sh_exec (t=0x7ffff7fb0610, flags=5) at /home/test001/work/ast_ksh_20120518/build_normal_64bit_mamfilefix/src/cmd/ksh93/sh/xec.c:1367 #6 0x0000000000418957 in exfile (shp=0x7f4500, iop=0x7ffff7fcb100, fno=-1) at /home/test001/work/ast_ksh_20120518/build_normal_64bit_mamfilefix/src/cmd/ksh93/sh/main.c:600 #7 0x0000000000417b41 in sh_main (ac=3, av=0x7fffffffe238, userinit=0) at /home/test001/work/ast_ksh_20120518/build_normal_64bit_mamfilefix/src/cmd/ksh93/sh/main.c:373 #8 0x0000000000416c29 in main (argc=3, argv=0x7fffffffe238) at /home/test001/work/ast_ksh_20120518/build_normal_64bit_mamfilefix/src/cmd/ksh93/sh/pmain.c:45 (gdb) cont Continuing. Breakpoint 1, 0x00007ffff769c630 in pathconf () from /lib64/libc.so.6 (gdb) where #0 0x00007ffff769c630 in pathconf () from /lib64/libc.so.6 #1 0x0000000000551d7d in print (sp=0x0, look=0x7fffffffd6b0, name=0x586512 "PIPE_BUF", path=0x7f35c8 "/", listflags=0, conferror=0) at /home/test001/work/ast_ksh_20120518/build_normal_64bit_mamfilefix/src/lib/libast/port/astconf.c:1115 #2 0x0000000000553025 in astgetconf (name=0x586512 "PIPE_BUF", path=0x7f35c8 "/", value=0x0, flags=0, conferror=0) at /home/test001/work/ast_ksh_20120518/build_normal_64bit_mamfilefix/src/lib/libast/port/astconf.c:1477 #3 0x0000000000553655 in astconf (name=0x586512 "PIPE_BUF", path=0x0, value=0x0) at /home/test001/work/ast_ksh_20120518/build_normal_64bit_mamfilefix/src/lib/libast/port/astconf.c:1555 #4 0x00000000004a9b42 in b_ulimit (argc=2, argv=0x7ffff7fb0690, context=0x7f4a08) at /home/test001/work/ast_ksh_20120518/build_normal_64bit_mamfilefix/src/cmd/ksh93/bltins/ulimit.c:201 #5 0x00000000004815b7 in sh_exec (t=0x7ffff7fb0610, flags=5) at /home/test001/work/ast_ksh_20120518/build_normal_64bit_mamfilefix/src/cmd/ksh93/sh/xec.c:1367 #6 0x0000000000418957 in exfile (shp=0x7f4500, iop=0x7ffff7fcb100, fno=-1) at /home/test001/work/ast_ksh_20120518/build_normal_64bit_mamfilefix/src/cmd/ksh93/sh/main.c:600 #7 0x0000000000417b41 in sh_main (ac=3, av=0x7fffffffe238, userinit=0) at /home/test001/work/ast_ksh_20120518/build_normal_64bit_mamfilefix/src/cmd/ksh93/sh/main.c:373 #8 0x0000000000416c29 in main (argc=3, argv=0x7fffffffe238) at /home/test001/work/ast_ksh_20120518/build_normal_64bit_mamfilefix/src/cmd/ksh93/sh/pmain.c:45 -- snip -- A shorter testcase (based on Dan's feedback) is this: -- snip -- $ valgrind /usr/bin/getconf PIPE_BUF / <valgrind throws tactical nuke back... =:-) > -- snip -- ---- Bye, Roland -- __ . . __ (o.\ \/ /.o) rol...@nr... \__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer /O /==\ O\ TEL +49 641 3992797 (;O/ \/ \O;) |