From: "Murilo Opsfelder Araújo" <muriloo@linux.vnet.ibm.com>
To: Eric Blake <eblake@redhat.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
qemu-ppc@nongnu.org, qemu-block@nongnu.org,
qemu-stable <qemu-stable@nongnu.org>,
Max Reitz <mreitz@redhat.com>,
R Nageswara Sastry <nasastry@in.ibm.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 1/1] block/nbd: fix segmentation fault when .desc is not null-terminated
Date: Fri, 5 Jan 2018 12:47:10 -0200 [thread overview]
Message-ID: <fb11ac10-0b17-b9d6-0e2a-540cac882900@linux.vnet.ibm.com> (raw)
In-Reply-To: <07c8789d-bebb-deed-b64c-806edf17f99c@redhat.com>
On 01/05/2018 11:57 AM, Eric Blake wrote:
> On 01/05/2018 07:32 AM, Murilo Opsfelder Araujo wrote:
>> The find_desc_by_name() from util/qemu-option.c relies on the .name not being
>> NULL to call strcmp(). This check becomes unsafe when the list is not
>> NULL-terminated, which is the case of nbd_runtime_opts in block/nbd.c, and can
>> result in segmentation fault when strcmp() tries to access an invalid memory:
>
> Thanks for the report and patch. Adding qemu-stable in cc.
>
>>
>> This patch fixes the segmentation fault in strcmp() by adding a NULL element at
>> the end of nbd_runtime_opts.desc list, which is the common practice to most of
>> other structs like runtime_opts in block/null.c. Thus, the desc[i].name != NULL
>> check becomes safe because it will not evaluate to true when .desc list reached
>> its end.
>>
>> Reported-by: R. Nageswara Sastry <nasastry@in.ibm.com>
>> Buglink: https://bugs.launchpad.net/qemu/+bug/1727259
>> Signed-off-by: Murilo Opsfelder Araujo <muriloo@linux.vnet.ibm.com>
>
> I'll update the commit message to add in the commit id that introduced
> the problem, as well as check that other QemuOptsList do not have a
> similar problem; I'm queueing this on the NBD tree and will submit a
> pull request soon.
>
> Reviewed-by: Eric Blake <eblake@redhat.com>
Hi, Eric.
A quick look brought my attention to:
block/ssh.c
530:static QemuOptsList ssh_runtime_opts = {
I've sent a patch to fix it too.
Thanks.
--
Murilo
next prev parent reply other threads:[~2018-01-05 14:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-05 13:32 [Qemu-devel] [PATCH 0/1] qemu/nbd: fix segmentation fault when .desc is not null-terminated Murilo Opsfelder Araujo
2018-01-05 13:32 ` [Qemu-devel] [PATCH 1/1] block/nbd: " Murilo Opsfelder Araujo
2018-01-05 13:57 ` Eric Blake
2018-01-05 14:47 ` Murilo Opsfelder Araújo [this message]
2018-01-05 17:08 ` Eric Blake
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=fb11ac10-0b17-b9d6-0e2a-540cac882900@linux.vnet.ibm.com \
--to=muriloo@linux.vnet.ibm.com \
--cc=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=nasastry@in.ibm.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=qemu-stable@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).