Chet Ramey <[email protected]> writes:
> On 1/30/12 4:41 AM, Jeremy Hall wrote:
>> Hi
>>
>> readline 6.2
>>
>> This is after a single call to readline()
>>
>> ==5441== Syscall param socketcall.sendmsg(msg.msg_name) points to
>> uninitialised byte(s)
>> ==5441== at 0x41E1FA1: sendmsg (socket.S:64)
>> ==5441== by 0x40C0E1C: readline (readline.c:346)
>
> That's interesting. Readline doesn't call sendmsg().
I see the same thing. RHEL 6.3, glibc 2.12, readline 6.0.
$ cat rlsm.c
#include <stdio.h>
#include <stdlib.h>
#include <readline/readline.h>
int main(void) {
char *line;
while ((line = readline("type stuff: ")) != NULL) {
printf("You wrote '%s'\n", line);
free(line);
}
return 0;
}
$ gcc -o rlsm rlsm.c -lreadline
$ strace -e trace=desc,network,file -o rlsm.strace ./rlsm
type stuff:
You wrote ''
type stuff:
You wrote ''
type stuff: <C-d>
$ grep -C5 sendmsg rlsm.strace
write(1, "type stuff: ", 12) = 12
read(0, "\r", 1) = 1
write(1, "\n", 1) = 1
ioctl(0, SNDCTL_TMR_STOP or TCSETSW, {B38400 opost isig icanon echo ...}) = 0
socket(PF_NETLINK, SOCK_RAW, 9) = 3
sendmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000},
msg_iov(2)=[{"\21\0\0\0d\4\1\0\0\0\0\0\0\0\0\0", 16}, {"\0", 1}],
msg_controllen=0, msg_flags=0}, 0) = 17
close(3) = 0
ioctl(0, TIOCGWINSZ, {ws_row=33, ws_col=127, ws_xpixel=1162, ws_ypixel=499}) = 0
ioctl(0, TIOCSWINSZ, {ws_row=33, ws_col=127, ws_xpixel=1162, ws_ypixel=499}) = 0
ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(0, SNDCTL_TMR_STOP or TCSETSW, {B38400 opost isig -icanon -echo ...}) = 0
As you say, readline does not call sendmsg(), so readline is obviously
not the problem. The socket()/sendmsg() calls disappear when I download
readline 6.0
(or 6.1), compile it and link statically against it. On my ubuntu
machine (which has readline 6.1), the socket()/sendmsg() calls do not
appear at all. I tried using gdb to catch the sendmsg system call and
give me a stack trace, but the necessary debugging symbols are
missing, so it appeared as in the valgrind output above.
--
Rasmus Villemoes
<http://rasmusvillemoes.dk/>
_______________________________________________
Bug-readline mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-readline