All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [Qemu-devel] 9pfs segfaults on chmod(special)
       [not found]     ` <87txowzkvi.fsf@in.ibm.com>
@ 2013-03-01 19:38       ` H. Peter Anvin
  2013-03-01 21:00         ` Eric Van Hensbergen
  0 siblings, 1 reply; 4+ messages in thread
From: H. Peter Anvin @ 2013-03-01 19:38 UTC (permalink / raw)
  To: M. Mohan Kumar; +Cc: Michael Tokarev, Aneesh Kumar K.V, qemu-devel

On 02/28/2013 04:24 AM, M. Mohan Kumar wrote:
> 
> By default 9p.u is used, you can override by that
>  mount -t 9p -otrans=virtio,version=9p2000.L tag /mnt
> 

Shouldn't we change that default?

	-hpa

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] 9pfs segfaults on chmod(special)
  2013-03-01 19:38       ` [Qemu-devel] 9pfs segfaults on chmod(special) H. Peter Anvin
@ 2013-03-01 21:00         ` Eric Van Hensbergen
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Van Hensbergen @ 2013-03-01 21:00 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: v9fs-users, M. Mohan Kumar, Michael Tokarev, Aneesh Kumar K.V,
	qemu-devel

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

Yeah, that's probably overdue -- it should gracefully downgrade to 9p2000.u
and/or 9p2000 anyways.

    -eric


On Fri, Mar 1, 2013 at 1:38 PM, H. Peter Anvin <hpa@zytor.com> wrote:

> On 02/28/2013 04:24 AM, M. Mohan Kumar wrote:
> >
> > By default 9p.u is used, you can override by that
> >  mount -t 9p -otrans=virtio,version=9p2000.L tag /mnt
> >
>
> Shouldn't we change that default?
>
>         -hpa
>
>
>
>

[-- Attachment #2: Type: text/html, Size: 881 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] 9pfs segfaults on chmod(special)
       [not found] ` <87mwuo4x9o.fsf@linux.vnet.ibm.com>
       [not found]   ` <512F35C4.1060205@msgid.tls.msk.ru>
@ 2013-05-19 16:10   ` Michael Tokarev
  2013-05-20  6:06     ` Aneesh Kumar K.V
  1 sibling, 1 reply; 4+ messages in thread
From: Michael Tokarev @ 2013-05-19 16:10 UTC (permalink / raw)
  To: Aneesh Kumar K.V, Anthony Liguori, qemu-stable; +Cc: qemu-devel

Guys, are we playing with our sand-box toys or what?

Can we apply this maybe to 1.5??  It's just insane that
such a simple bugfixes, with lots of preceeding work to
identify it, and with users suffering, are being simply
ignored for months...

Thanks,

/mjt

28.02.2013 13:12, Aneesh Kumar K.V wrote:
> Michael Tokarev <mjt@tls.msk.ru> writes:
> 
>> When guest tries to chmod a block or char device file over 9pfs,
>> the qemu process segfaults.
>>
>> On host:
>>  qemu-system-x86_64 -virtfs local,path=/dev,security_model=mapped-file,mount_tag=tag
>>
>> On guest:
>>  mount -t 9p -o trans=virtio tag /mnt
>>  chmod 0777 /mnt/tty
> 
> any specific reason why you are trying 9p .u ?
> 
>>
>> Result (for 1.4.0):
>>
>> Program received signal SIGSEGV, Segmentation fault.
>> 0x566095af in v9mode_to_mode (mode=8389101, extension=0xc7584ef8)
>>     at /build/kvm/git/hw/9pfs/virtio-9p.c:662
>> 662	        if (extension && extension->data[0] == 'c') {
>> (gdb) p *extension
>> $1 = {size = 0, data = 0x0}
>> (gdb) bt
>> #0  0x566095af in v9mode_to_mode (mode=8389101, extension=0xc7584ef8)
>>     at hw/9pfs/virtio-9p.c:662
>> #1  0x5660f38b in v9fs_wstat (opaque=0xd250945c)
>>     at hw/9pfs/virtio-9p.c:2635
>> (gdb) frame 1
>> #1  0x5660f38b in v9fs_wstat (opaque=0xd250945c)
>>     at hw/9pfs/virtio-9p.c:2635
>> 2635	        err = v9fs_co_chmod(pdu, &fidp->path,
>>                             v9mode_to_mode(v9stat.mode,
>>                                            &v9stat.extension));
>> (gdb) p v9stat
>> $2 = {size = 61, type = -1, dev = -1, qid = {type = -1 '\377', version = -1,
>>     path = -1}, mode = 8389101, atime = -1, mtime = -1, length = -1, name = {
>>     size = 0, data = 0x0}, uid = {size = 0, data = 0x0}, gid = {size = 0,
>>     data = 0x0}, muid = {size = 0, data = 0x0}, extension = {size = 0,
>>     data = 0x0}, n_uid = -1, n_gid = -1, n_muid = -1}
>>
>>
>> Corresponding code in v9mode_to_mode():
>>
>>      if (mode & P9_STAT_MODE_DEVICE) {
>>          if (extension && extension->data[0] == 'c') {
>>              ret |= S_IFCHR;
>>          } else {
>>              ret |= S_IFBLK;
>>      }
>>
>> This (static) function (v9mode_to_mode) is called from only one place,
>> namely from v9fs_wstat(), and it always calls it with non-NULL
>> `extension' argument: &v9stat.extension.
>>
>> Maybe the buffer (extension->data) should be passed to it instead of
>> the whole structure (extension)?  Or the check be extended (or,
>> since this function isn't called from any other place, _replaced_) to
>> test for non-NULL ->data too?
>>
> 
> Thanks for the detailed analysis. Something like below ?
> 
> diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c
> index f526467..073067f 100644
> --- a/hw/9pfs/virtio-9p.c
> +++ b/hw/9pfs/virtio-9p.c
> @@ -659,7 +659,7 @@ static mode_t v9mode_to_mode(uint32_t mode, V9fsString *extension)
>          ret |= S_IFIFO;
>      }
>      if (mode & P9_STAT_MODE_DEVICE) {
> -        if (extension && extension->data[0] == 'c') {
> +        if (extension->size && extension->data[0] == 'c') {
>              ret |= S_IFCHR;
>          } else {
>              ret |= S_IFBLK;
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] 9pfs segfaults on chmod(special)
  2013-05-19 16:10   ` Michael Tokarev
@ 2013-05-20  6:06     ` Aneesh Kumar K.V
  0 siblings, 0 replies; 4+ messages in thread
From: Aneesh Kumar K.V @ 2013-05-20  6:06 UTC (permalink / raw)
  To: Michael Tokarev, Anthony Liguori, qemu-stable; +Cc: qemu-devel

Michael Tokarev <mjt@tls.msk.ru> writes:

> Guys, are we playing with our sand-box toys or what?
>
> Can we apply this maybe to 1.5??  It's just insane that
> such a simple bugfixes, with lots of preceeding work to
> identify it, and with users suffering, are being simply
> ignored for months...
>

Sorry for not looking at this before. I wanted to make sure that we are
not missing the extension information as part of protocol. Verified
that chmod should not carry the extension details. 

I have sent the patch and also added qemu-stable. 

-aneesh

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-05-20  6:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <512EEF75.2090503@msgid.tls.msk.ru>
     [not found] ` <87mwuo4x9o.fsf@linux.vnet.ibm.com>
     [not found]   ` <512F35C4.1060205@msgid.tls.msk.ru>
     [not found]     ` <87txowzkvi.fsf@in.ibm.com>
2013-03-01 19:38       ` [Qemu-devel] 9pfs segfaults on chmod(special) H. Peter Anvin
2013-03-01 21:00         ` Eric Van Hensbergen
2013-05-19 16:10   ` Michael Tokarev
2013-05-20  6:06     ` Aneesh Kumar K.V

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.