* [Qemu-devel] [Bug 1240669] [NEW] sd_init() generates SIGSEGV when passed NULL
@ 2013-10-16 19:18 Devin Boyer
2013-10-16 20:10 ` [Qemu-devel] [Bug 1240669] " Devin Boyer
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Devin Boyer @ 2013-10-16 19:18 UTC (permalink / raw)
To: qemu-devel
Public bug reported:
Ran into a bug following the following tutorial:
http://balau82.wordpress.com/2010/03/10/u-boot-for-arm-on-qemu/
I built QEMU from a clone of master and became stuck at the beginning
part of the tutorial where only u-boot.bin is exectuted.
http://git.qemu.org/?p=qemu.git;a=commitdiff;h=4f8a066b5fc254eeaabbbde56ba4f5b29cc68fdf
See the modifications to sd.c specifically.
When sd_init (sd.c) is called from pl181_init(), bs is potentially null:
s->card = sd_init(dinfo ? dinfo->bdrv : NULL, false);
sd_init() :
SDState *sd_init(BlockDriverState *bs, bool is_spi)
{
SDState *sd;
sd = (SDState *) g_malloc0(sizeof(SDState));
sd->buf = qemu_blockalign(bs, 512);
sd->spi = is_spi;
sd->enable = true;
sd_reset(sd, bs);
if (sd->bdrv) {
bdrv_attach_dev_nofail(sd->bdrv, sd);
bdrv_set_dev_ops(sd->bdrv, &sd_block_ops, sd);
}
vmstate_register(NULL, -1, &sd_vmstate, sd);
return sd;
}
Line 497 calls bdrv_is_read_only(bs) (from block.c)and this generates a
SEGSIGV.
int bdrv_is_read_only(BlockDriverState *bs)
{
return bs->read_only;
}
Checking out tag v1.6.1 reverted the problem. Thanks!
** Affects: qemu
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1240669
Title:
sd_init() generates SIGSEGV when passed NULL
Status in QEMU:
New
Bug description:
Ran into a bug following the following tutorial:
http://balau82.wordpress.com/2010/03/10/u-boot-for-arm-on-qemu/
I built QEMU from a clone of master and became stuck at the beginning
part of the tutorial where only u-boot.bin is exectuted.
http://git.qemu.org/?p=qemu.git;a=commitdiff;h=4f8a066b5fc254eeaabbbde56ba4f5b29cc68fdf
See the modifications to sd.c specifically.
When sd_init (sd.c) is called from pl181_init(), bs is potentially null:
s->card = sd_init(dinfo ? dinfo->bdrv : NULL, false);
sd_init() :
SDState *sd_init(BlockDriverState *bs, bool is_spi)
{
SDState *sd;
sd = (SDState *) g_malloc0(sizeof(SDState));
sd->buf = qemu_blockalign(bs, 512);
sd->spi = is_spi;
sd->enable = true;
sd_reset(sd, bs);
if (sd->bdrv) {
bdrv_attach_dev_nofail(sd->bdrv, sd);
bdrv_set_dev_ops(sd->bdrv, &sd_block_ops, sd);
}
vmstate_register(NULL, -1, &sd_vmstate, sd);
return sd;
}
Line 497 calls bdrv_is_read_only(bs) (from block.c)and this generates
a SEGSIGV.
int bdrv_is_read_only(BlockDriverState *bs)
{
return bs->read_only;
}
Checking out tag v1.6.1 reverted the problem. Thanks!
To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1240669/+subscriptions
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Qemu-devel] [Bug 1240669] Re: sd_init() generates SIGSEGV when passed NULL
2013-10-16 19:18 [Qemu-devel] [Bug 1240669] [NEW] sd_init() generates SIGSEGV when passed NULL Devin Boyer
@ 2013-10-16 20:10 ` Devin Boyer
2013-10-17 5:09 ` Stefan Weil
2013-10-22 1:23 ` Devin Boyer
2016-06-28 14:43 ` T. Huth
2 siblings, 1 reply; 5+ messages in thread
From: Devin Boyer @ 2013-10-16 20:10 UTC (permalink / raw)
To: qemu-devel
** Description changed:
Ran into a bug following the following tutorial:
- http://balau82.wordpress.com/2010/03/10/u-boot-for-arm-on-qemu/
+ http://balau82.wordpress.com/2010/03/10/u-boot-for-arm-on-qemu/
I built QEMU from a clone of master and became stuck at the beginning
part of the tutorial where only u-boot.bin is exectuted.
- http://git.qemu.org/?p=qemu.git;a=commitdiff;h=4f8a066b5fc254eeaabbbde56ba4f5b29cc68fdf
- See the modifications to sd.c specifically.
+ http://git.qemu.org/?p=qemu.git;a=commitdiff;h=4f8a066b5fc254eeaabbbde56ba4f5b29cc68fdf
+ See the modifications to sd.c specifically.
When sd_init (sd.c) is called from pl181_init(), bs is potentially null:
- s->card = sd_init(dinfo ? dinfo->bdrv : NULL, false);
+ s->card = sd_init(dinfo ? dinfo->bdrv : NULL, false);
- sd_init() :
+ sd_init():
+
SDState *sd_init(BlockDriverState *bs, bool is_spi)
{
SDState *sd;
+
+ if (bdrv_is_read_only(bs)) {
+ fprintf(stderr, "sd_init: Cannot use read-only drive\n");
+ return NULL;
+ }
sd = (SDState *) g_malloc0(sizeof(SDState));
sd->buf = qemu_blockalign(bs, 512);
sd->spi = is_spi;
sd->enable = true;
sd_reset(sd, bs);
if (sd->bdrv) {
bdrv_attach_dev_nofail(sd->bdrv, sd);
bdrv_set_dev_ops(sd->bdrv, &sd_block_ops, sd);
}
vmstate_register(NULL, -1, &sd_vmstate, sd);
return sd;
}
- Line 497 calls bdrv_is_read_only(bs) (from block.c)and this generates a
- SEGSIGV.
- int bdrv_is_read_only(BlockDriverState *bs)
- {
- return bs->read_only;
- }
+ Line 497 calls bdrv_is_read_only(bs) (from block.c)and this generates a SEGSIGV.
+
+ int bdrv_is_read_only(BlockDriverState *bs)
+ {
+ return bs->read_only;
+ }
Checking out tag v1.6.1 reverted the problem. Thanks!
--
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1240669
Title:
sd_init() generates SIGSEGV when passed NULL
Status in QEMU:
New
Bug description:
Ran into a bug following the following tutorial:
http://balau82.wordpress.com/2010/03/10/u-boot-for-arm-on-qemu/
I built QEMU from a clone of master and became stuck at the beginning
part of the tutorial where only u-boot.bin is exectuted.
http://git.qemu.org/?p=qemu.git;a=commitdiff;h=4f8a066b5fc254eeaabbbde56ba4f5b29cc68fdf
See the modifications to sd.c specifically.
When sd_init (sd.c) is called from pl181_init(), bs is potentially null:
s->card = sd_init(dinfo ? dinfo->bdrv : NULL, false);
sd_init():
SDState *sd_init(BlockDriverState *bs, bool is_spi)
{
SDState *sd;
if (bdrv_is_read_only(bs)) {
fprintf(stderr, "sd_init: Cannot use read-only drive\n");
return NULL;
}
sd = (SDState *) g_malloc0(sizeof(SDState));
sd->buf = qemu_blockalign(bs, 512);
sd->spi = is_spi;
sd->enable = true;
sd_reset(sd, bs);
if (sd->bdrv) {
bdrv_attach_dev_nofail(sd->bdrv, sd);
bdrv_set_dev_ops(sd->bdrv, &sd_block_ops, sd);
}
vmstate_register(NULL, -1, &sd_vmstate, sd);
return sd;
}
Line 497 calls bdrv_is_read_only(bs) (from block.c)and this generates a SEGSIGV.
int bdrv_is_read_only(BlockDriverState *bs)
{
return bs->read_only;
}
Checking out tag v1.6.1 reverted the problem. Thanks!
To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1240669/+subscriptions
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [Bug 1240669] Re: sd_init() generates SIGSEGV when passed NULL
2013-10-16 20:10 ` [Qemu-devel] [Bug 1240669] " Devin Boyer
@ 2013-10-17 5:09 ` Stefan Weil
0 siblings, 0 replies; 5+ messages in thread
From: Stefan Weil @ 2013-10-17 5:09 UTC (permalink / raw)
To: Bug 1240669, qemu-devel, Kevin Wolf
Am 16.10.2013 22:10, schrieb Devin Boyer:
> ** Description changed:
>
> Ran into a bug following the following tutorial:
> - http://balau82.wordpress.com/2010/03/10/u-boot-for-arm-on-qemu/
> + http://balau82.wordpress.com/2010/03/10/u-boot-for-arm-on-qemu/
>
> I built QEMU from a clone of master and became stuck at the beginning
> part of the tutorial where only u-boot.bin is exectuted.
>
> - http://git.qemu.org/?p=qemu.git;a=commitdiff;h=4f8a066b5fc254eeaabbbde56ba4f5b29cc68fdf
> - See the modifications to sd.c specifically.
> + http://git.qemu.org/?p=qemu.git;a=commitdiff;h=4f8a066b5fc254eeaabbbde56ba4f5b29cc68fdf
> + See the modifications to sd.c specifically.
>
> When sd_init (sd.c) is called from pl181_init(), bs is potentially null:
> - s->card = sd_init(dinfo ? dinfo->bdrv : NULL, false);
> + s->card = sd_init(dinfo ? dinfo->bdrv : NULL, false);
>
> - sd_init() :
> + sd_init():
> +
> SDState *sd_init(BlockDriverState *bs, bool is_spi)
> {
> SDState *sd;
> +
> + if (bdrv_is_read_only(bs)) {
> + fprintf(stderr, "sd_init: Cannot use read-only drive\n");
> + return NULL;
> + }
>
> sd = (SDState *) g_malloc0(sizeof(SDState));
> sd->buf = qemu_blockalign(bs, 512);
> sd->spi = is_spi;
> sd->enable = true;
> sd_reset(sd, bs);
> if (sd->bdrv) {
> bdrv_attach_dev_nofail(sd->bdrv, sd);
> bdrv_set_dev_ops(sd->bdrv, &sd_block_ops, sd);
> }
> vmstate_register(NULL, -1, &sd_vmstate, sd);
> return sd;
> }
>
> - Line 497 calls bdrv_is_read_only(bs) (from block.c)and this generates a
> - SEGSIGV.
>
> - int bdrv_is_read_only(BlockDriverState *bs)
> - {
> - return bs->read_only;
> - }
> + Line 497 calls bdrv_is_read_only(bs) (from block.c)and this generates a SEGSIGV.
> +
> + int bdrv_is_read_only(BlockDriverState *bs)
> + {
> + return bs->read_only;
> + }
>
> Checking out tag v1.6.1 reverted the problem. Thanks!
>
See http://lists.nongnu.org/archive/html/qemu-devel/2013-10/msg02075.html
for a possible fix.
Regards,
SW
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Qemu-devel] [Bug 1240669] Re: sd_init() generates SIGSEGV when passed NULL
2013-10-16 19:18 [Qemu-devel] [Bug 1240669] [NEW] sd_init() generates SIGSEGV when passed NULL Devin Boyer
2013-10-16 20:10 ` [Qemu-devel] [Bug 1240669] " Devin Boyer
@ 2013-10-22 1:23 ` Devin Boyer
2016-06-28 14:43 ` T. Huth
2 siblings, 0 replies; 5+ messages in thread
From: Devin Boyer @ 2013-10-22 1:23 UTC (permalink / raw)
To: qemu-devel
Fixed with commit 794cbc26eb94ce13c75d105eea9ff0afff56e2c2.
** Changed in: qemu
Status: New => Fix Committed
--
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1240669
Title:
sd_init() generates SIGSEGV when passed NULL
Status in QEMU:
Fix Committed
Bug description:
Ran into a bug following the following tutorial:
http://balau82.wordpress.com/2010/03/10/u-boot-for-arm-on-qemu/
I built QEMU from a clone of master and became stuck at the beginning
part of the tutorial where only u-boot.bin is exectuted.
http://git.qemu.org/?p=qemu.git;a=commitdiff;h=4f8a066b5fc254eeaabbbde56ba4f5b29cc68fdf
See the modifications to sd.c specifically.
When sd_init (sd.c) is called from pl181_init(), bs is potentially null:
s->card = sd_init(dinfo ? dinfo->bdrv : NULL, false);
sd_init():
SDState *sd_init(BlockDriverState *bs, bool is_spi)
{
SDState *sd;
if (bdrv_is_read_only(bs)) {
fprintf(stderr, "sd_init: Cannot use read-only drive\n");
return NULL;
}
sd = (SDState *) g_malloc0(sizeof(SDState));
sd->buf = qemu_blockalign(bs, 512);
sd->spi = is_spi;
sd->enable = true;
sd_reset(sd, bs);
if (sd->bdrv) {
bdrv_attach_dev_nofail(sd->bdrv, sd);
bdrv_set_dev_ops(sd->bdrv, &sd_block_ops, sd);
}
vmstate_register(NULL, -1, &sd_vmstate, sd);
return sd;
}
Line 497 calls bdrv_is_read_only(bs) (from block.c)and this generates a SEGSIGV.
int bdrv_is_read_only(BlockDriverState *bs)
{
return bs->read_only;
}
Checking out tag v1.6.1 reverted the problem. Thanks!
To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1240669/+subscriptions
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Qemu-devel] [Bug 1240669] Re: sd_init() generates SIGSEGV when passed NULL
2013-10-16 19:18 [Qemu-devel] [Bug 1240669] [NEW] sd_init() generates SIGSEGV when passed NULL Devin Boyer
2013-10-16 20:10 ` [Qemu-devel] [Bug 1240669] " Devin Boyer
2013-10-22 1:23 ` Devin Boyer
@ 2016-06-28 14:43 ` T. Huth
2 siblings, 0 replies; 5+ messages in thread
From: T. Huth @ 2016-06-28 14:43 UTC (permalink / raw)
To: qemu-devel
** Changed in: qemu
Status: Fix Committed => Fix Released
--
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1240669
Title:
sd_init() generates SIGSEGV when passed NULL
Status in QEMU:
Fix Released
Bug description:
Ran into a bug following the following tutorial:
http://balau82.wordpress.com/2010/03/10/u-boot-for-arm-on-qemu/
I built QEMU from a clone of master and became stuck at the beginning
part of the tutorial where only u-boot.bin is exectuted.
http://git.qemu.org/?p=qemu.git;a=commitdiff;h=4f8a066b5fc254eeaabbbde56ba4f5b29cc68fdf
See the modifications to sd.c specifically.
When sd_init (sd.c) is called from pl181_init(), bs is potentially null:
s->card = sd_init(dinfo ? dinfo->bdrv : NULL, false);
sd_init():
SDState *sd_init(BlockDriverState *bs, bool is_spi)
{
SDState *sd;
if (bdrv_is_read_only(bs)) {
fprintf(stderr, "sd_init: Cannot use read-only drive\n");
return NULL;
}
sd = (SDState *) g_malloc0(sizeof(SDState));
sd->buf = qemu_blockalign(bs, 512);
sd->spi = is_spi;
sd->enable = true;
sd_reset(sd, bs);
if (sd->bdrv) {
bdrv_attach_dev_nofail(sd->bdrv, sd);
bdrv_set_dev_ops(sd->bdrv, &sd_block_ops, sd);
}
vmstate_register(NULL, -1, &sd_vmstate, sd);
return sd;
}
Line 497 calls bdrv_is_read_only(bs) (from block.c)and this generates a SEGSIGV.
int bdrv_is_read_only(BlockDriverState *bs)
{
return bs->read_only;
}
Checking out tag v1.6.1 reverted the problem. Thanks!
To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1240669/+subscriptions
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-06-28 14:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-16 19:18 [Qemu-devel] [Bug 1240669] [NEW] sd_init() generates SIGSEGV when passed NULL Devin Boyer
2013-10-16 20:10 ` [Qemu-devel] [Bug 1240669] " Devin Boyer
2013-10-17 5:09 ` Stefan Weil
2013-10-22 1:23 ` Devin Boyer
2016-06-28 14:43 ` T. Huth
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).