Skip to contentSkip to conversation

virtio/s390: fix some races in virtio-ccw

PATCH Superseded Halil Pasic 3 participants 6 messages Sep 21, 2018 – Sep 24, 2018 8 messages not in the archive

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover virtio/s390: fix some races in virtio-ccw

The trigger for the series is this bug report:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1788432

Changelog:
RFC -> v1:
* do mutual exclusion on a per device basis in ccw_io_helper()

Halil Pasic (2):
virtio/s390: avoid race on vcdev->config
virtio/s390: fix race in ccw_io_helper()

 drivers/s390/virtio/virtio_ccw.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
Signature · 1 line
2.16.4
#1 lore raw

Can you consider adding stable tags to the (final version of the) fixes?

Quoted 14 lines · Halil Pasic

The trigger for the series is this bug report:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1788432

Changelog:
RFC -> v1:
* do mutual exclusion on a per device basis in ccw_io_helper()

Halil Pasic (2):
virtio/s390: avoid race on vcdev->config
virtio/s390: fix race in ccw_io_helper()

 drivers/s390/virtio/virtio_ccw.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

Re: [PATCH 1/2] virtio/s390: avoid race on vcdev->config

Quoted 6 lines · On Fri, 21 Sep 2018 17:47:47 -0400 Farhan Ali <[email protected]> wrote:
Quoted 4 lines · Halil Pasic

Anyway I'm fine with swapping the old out and your new version in, if you prefer it that way.

If you do, would you like to have a respin?

Just send me a respin with something that you find useful :) (maybe a mashup of our descriptions) (while at it, you could also add the cc:stable, which I agree make sense)

Quoted 8 lines
Quoted 4 lines

Regards,
Halil

I had been looking into this code recently, and shouldn't vcdev->status (function get/set_status functions) also have a lock around it? Or is it not possible to have a race condition on vcdev->status?

I don't think so, as status is only a byte.

Quoted 16 lines

Thanks
Farhan

Quoted 10 lines
Quoted 8 lines
Quoted 7 lines

Let us protect the shared state using vcdev->lock.

---
  drivers/s390/virtio/virtio_ccw.c | 10 ++++++++--
  1 file changed, 8 insertions(+), 2 deletions(-)  

A message that is not in the archive (sent off-list or not yet received): [email protected]

#8 lore raw

Re: [PATCH 1/2] virtio/s390: avoid race on vcdev->config

Quoted 19 lines · On Mon, 24 Sep 2018 16:27:30 +0200 Halil Pasic <[email protected]> wrote:
Quoted 5 lines · Cornelia Huck
Quoted 1 line · On Fri, 21 Sep 2018 17:47:47 -0400 Farhan Ali <[email protected]> wrote:

On 09/21/2018 09:28 AM, Halil Pasic wrote:

Quoted 9 lines
Quoted 4 lines
Quoted 4 lines

Anyway I'm fine with swapping the old out and your new version in, if you prefer it that way.

If you do, would you like to have a respin?

Just send me a respin with something that you find useful :) (maybe a mashup of our descriptions) (while at it, you could also add the cc:stable, which I agree make sense)

Will do! I would like to go with.

Quoted 6 lines

"""
This normally does not cause problems, as these are usually infrequent operations. However, for some devices writing to/reading from the config space can be triggered through sysfs attributes. For these userspace can force the race by increasing the frequency.
"""

Sounds good.

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#12 lore raw

Re: [PATCH 2/2] virtio/s390: fix race in ccw_io_helper()

Quoted 11 lines · On Mon, 24 Sep 2018 14:57:26 +0200 Halil Pasic <[email protected]> wrote:
Quoted 2 lines · Cornelia Huck

On Fri, 21 Sep 2018 14:46:21 +0200
Halil Pasic <[email protected]> wrote:

Again, not what I tried to say. By 'This' I meant 'this race'. How about?

"""
This race normally does not cause any problems. The operations provided by struct virtio_config_ops are usually invoked in a well defined sequence, normally don't fail, and are normally usually quite infrequent too.

s/usually/used/

Quoted 6 lines

Yet, if some of the these operations are directly triggered via sysfs attributes, like in the case described by the referenced bug, userspace is given an opportunity to force races by increasing the frequency of the given operations.
"""

Fine with me.

#13 lore raw

Re: [PATCH 2/2] virtio/s390: fix race in ccw_io_helper()

Quoted 10 lines · Cornelia Huck
Quoted 7 lines · On Mon, 24 Sep 2018 14:57:26 +0200 Halil Pasic <[email protected]> wrote:
Quoted 2 lines · Cornelia Huck

On Fri, 21 Sep 2018 14:46:21 +0200
Halil Pasic <[email protected]> wrote:

Again, not what I tried to say. By 'This' I meant 'this race'. How about?

Quoted 6 lines
Quoted 4 lines

"""
This race normally does not cause any problems. The operations provided by struct virtio_config_ops are usually invoked in a well defined sequence, normally don't fail, and are normally usually quite infrequent too.

s/usually/used/

Nod. Thanks!

Quoted 10 lines
Quoted 7 lines

Yet, if some of the these operations are directly triggered via sysfs attributes, like in the case described by the referenced bug, userspace is given an opportunity to force races by increasing the frequency of the given operations.
"""

Fine with me.