All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ell@lists.01.org
Subject: Re: [PATCH] dbus: Message header was not initialized
Date: Thu, 19 Feb 2015 10:13:27 -0600	[thread overview]
Message-ID: <54E60BA7.8080207@gmail.com> (raw)
In-Reply-To: <1424336444-32199-1-git-send-email-jukka.rissanen@linux.intel.com>

[-- Attachment #1: Type: text/plain, Size: 2269 bytes --]

Hi Jukka,

On 02/19/2015 03:00 AM, Jukka Rissanen wrote:
> Saw this valgrind report about the issue
>
>   ==30891== Syscall param sendmsg(msg.msg_iov[0]) points to uninitialised byte(s)
>   ==30891==    at 0x3B8FF01850: __sendmsg_nocancel (syscall-template.S:81)
>   ==30891==    by 0x410602: classic_send_message (dbus.c:561)
>   ==30891==    by 0x40F4A1: message_write_handler (dbus.c:173)
>   ==30891==    by 0x419D56: io_callback (io.c:138)
>   ==30891==    by 0x40BBC2: l_main_run (main.c:346)
>   ==30891==    by 0x401ECF: main (main.c:160)
>   ==30891==  Address 0x4c59304 is 4 bytes inside a block of size 12 alloc'd
>   ==30891==    at 0x4A06BCF: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
>   ==30891==    by 0x4A08A9D: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
>   ==30891==    by 0x409A7D: l_realloc (util.c:92)
>   ==30891==    by 0x413A3E: message_new_common (dbus-message.c:201)
>   ==30891==    by 0x414B73: _dbus_message_new_method_call (dbus-message.c:221)
>   ==30891==    by 0x408A8B: send_request (agent.c:102)
>   ==30891==    by 0x408D28: agent_finalize_pending (agent.c:157)
>   ==30891==    by 0x408F9D: request_timeout (agent.c:241)
>   ==30891==    by 0x40C349: timeout_callback (timeout.c:78)
>   ==30891==    by 0x40BBC2: l_main_run (main.c:346)
>   ==30891==    by 0x401ECF: main (main.c:160)
>   ==30891==
> ---
>   ell/dbus-message.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/ell/dbus-message.c b/ell/dbus-message.c
> index 159df82..8743d66 100644
> --- a/ell/dbus-message.c
> +++ b/ell/dbus-message.c
> @@ -200,6 +200,7 @@ static struct l_dbus_message *message_new_common(uint8_t type, uint8_t flags,
>   	 */
>   	message->header = l_realloc(NULL, 12);
>   	message->header_size = 12;
> +	memset(message->header, 0, 12);
>

This seems bogus.  We set all the parts of the header along the way, so 
there should never be anything uninitialized.  Given the contents of the 
header, this should quickly result in some weird behavior fast.

Valgrind doesn't complain to me on the various examples, so how exactly 
did you trigger this?

>   	hdr = message->header;
>   	hdr->endian = DBUS_NATIVE_ENDIAN;
>

Regards,
-Denis

      reply	other threads:[~2015-02-19 16:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-19  9:00 [PATCH] dbus: Message header was not initialized Jukka Rissanen
2015-02-19 16:13 ` Denis Kenzior [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54E60BA7.8080207@gmail.com \
    --to=denkenz@gmail.com \
    --cc=ell@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.