Red Hat Bugzilla – Bug 857948
Usage of partial unitialized structure in call to sendmsg
Last modified: 2014-01-12 19:14:46 EST
Description of problem:
bash uses a partial uninitialized structure passed to the sendmsg syscall.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. run valgrind -q bash
==3332== Syscall param socketcall.sendmsg(msg.msg_name) points to uninitialised byte(s)
==3332== at 0x5563200: __sendmsg_nocancel (syscall-template.S:82)
==3332== by 0x489A77: readline (readline.c:346)
==3332== by 0x41E5AB: yy_readline_get (parse.y:1443)
==3332== by 0x4204F8: shell_getc (parse.y:1376)
==3332== by 0x422E95: read_token.constprop.8 (parse.y:2908)
==3332== by 0x4258BF: yyparse (parse.y:2517)
==3332== by 0x41DE69: parse_command (eval.c:229)
==3332== by 0x41DF35: read_command (eval.c:273)
==3332== by 0x41E182: reader_loop (eval.c:138)
==3332== by 0x41C8EE: main (shell.c:759)
==3332== Address 0x7feffece2 is on thread 1's stack
No output from valgrind.
Valgrind is right that there is uninitialized data used in the sendmsg syscall. When using nl_family = AF_NETLINK the nl_pad field should be initialized to zero and it isn't. This is unlikely to cause real problems in practice since this field is currently unused. But in the unlikely event that field does get used in the future it could be an issue that it isn't explicitly set to zero. Also it makes valgrind happy :)
It looks like the audit.patch is fedora local and not upstream. If it is already upstream please do let me know and I'll post patch there.
Patch (against the audit patch) is simple:
index 8de4980..f0e0ec4 100644
@@ -44,7 +44,7 @@ diff -up bash-4.0/lib/readline/readline.c.audit bash-4.0/lib/r
/* System-specific feature definitions and include files. */
-@@ -297,7 +303,47 @@ rl_set_prompt (prompt)
+@@ -297,7 +303,48 @@ rl_set_prompt (prompt)
rl_visible_prompt_length = rl_expand_prompt (rl_prompt);
@@ -76,6 +76,7 @@ diff -up bash-4.0/lib/readline/readline.c.audit bash-4.0/lib/r
+ iov.iov_base = string;
+ iov.iov_len = size;
+ addr.nl_family = AF_NETLINK;
++ addr.nl_pad = 0;
+ addr.nl_pid = 0;
+ addr.nl_groups = 0;
+ msg.msg_name = &addr;
Thanks for the report.
You're right, that patch is local. I will check and apply your patch. Thanks.
bash-4.2.42-3.fc18 has been submitted as an update for Fedora 18.
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing bash-4.2.42-3.fc18'
as soon as you are able to.
Please go to the following url:
then log in and leave karma (feedback).
bash-4.2.42-3.fc18 has been pushed to the Fedora 18 stable repository. If problems still persist, please make note of it in this bug report.