Patchwork libnetfilter_queue: Fix Valgrind errors of unitialized byte(s) during call to nfq_unbind_pf

login
register
mail settings
Submitter Tamas Lengyel
Date May 31, 2013, 10:20 p.m.
Message ID <CABfawhm7V6htNehkNrf-pCSsHt-gjZCOgBhAMAoCh7UyY=rapQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/248031/
State Accepted
Headers show

Comments

Tamas Lengyel - May 31, 2013, 10:20 p.m.
Valgrind generates error reports of unitialized byte(s) during a call
to the nfq_unbind_pf function:

==00:00:00:08.662 22111== 4 errors in context 1 of 1:
==00:00:00:08.662 22111== Syscall param socketcall.sendto(msg) points
to uninitialised byte(s)
...
==00:00:00:08.662 22111== Uninitialised value was created by a stack allocation
==00:00:00:08.662 22111== at 0x679C30B: __build_send_cfg_msg
(libnetfilter_queue.c:178

The following (tiny) patch gets rid of the issue. I made the patch
available on github as well at
git://github.com/tklengyel/libnetfilter_queue.git

Signed-off-by: Tamas K Lengyel <tamas.k.lengyel@gmail.com>
---

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Florian Westphal - June 1, 2013, 9:34 a.m.
Tamas Lengyel <tamas.k.lengyel@gmail.com> wrote:
> Valgrind generates error reports of unitialized byte(s) during a call
> to the nfq_unbind_pf function:
> ==00:00:00:08.662 22111== 4 errors in context 1 of 1:
> ==00:00:00:08.662 22111== Syscall param socketcall.sendto(msg) points
> to uninitialised byte(s)

Since the kernel doesn't use this value nothing bad will happen.
But, since __send_cgf_msg is hardly a fastpath I've applied the patch,
thanks.

For your next patch submission, please

> The following (tiny) patch gets rid of the issue. I made the patch
> available on github as well at
> git://github.com/tklengyel/libnetfilter_queue.git

move this snippet
> ---

Here, so that git-am can remove the non-changelog part
automatically.

Also, please send a copy of the patch to yourself
and try to apply the patch yourself with git-am.

Your mailer program mangled the tabs in the patch so it didn't apply
without manual editing.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/src/libnetfilter_queue.c b/src/libnetfilter_queue.c
index 2894ccd..bf944f0 100644
--- a/src/libnetfilter_queue.c
+++ b/src/libnetfilter_queue.c
@@ -186,6 +186,7 @@  __build_send_cfg_msg(struct nfq_handle *h, u_int8_t command,
  nfnl_fill_hdr(h->nfnlssh, &u.nmh, 0, AF_UNSPEC, queuenum,
  NFQNL_MSG_CONFIG, NLM_F_REQUEST|NLM_F_ACK);

+ cmd._pad = 0;
  cmd.command = command;
  cmd.pf = htons(pf);
  nfnl_addattr_l(&u.nmh, sizeof(u), NFQA_CFG_CMD, &cmd, sizeof(cmd));