All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] 9pfs: fix fstat() after unlink() (with a Linux guest)
@ 2024-11-24 16:28 Christian Schoenebeck
  2024-02-21 14:13 ` [PATCH 1/6] tests/9p: add 'use-after-unlink' test Christian Schoenebeck
                   ` (7 more replies)
  0 siblings, 8 replies; 25+ messages in thread
From: Christian Schoenebeck @ 2024-11-24 16:28 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable, Greg Kurz

This fixes an infamous, long standing bug:
https://gitlab.com/qemu-project/qemu/-/issues/103

* Actual fix of this bug is patch 5.

* Patches 1 and 6 add a test case to verify the expected behaviour.

* The other patches (2, 3, 4) are basically just minor cleanup patches more
  or less (un)related that I simply did not bother to send separately.

Probably there are still other 9p request types that should be fixed for this
use-after-unlink idiom, but this series fixes the mentioned bug report as
described by reporter, so fair enough to round this up here for now.

Simple test app to verify this behaviour on a Linux guest:

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>

int main() {
  struct stat st;
  int fd = open("doa-file", O_RDWR | O_CREAT | O_EXCL, 0600);
  unlink("doa-file");
  int res = fstat(fd, &st);
  printf("fstat() = %d\n", res);
  return res;
}

Christian Schoenebeck (6):
  tests/9p: add 'use-after-unlink' test
  tests/9p: fix Rreaddir response name
  tests/9p: add missing Rgetattr response name
  9pfs: remove obsolete comment in v9fs_getattr()
  9pfs: fix 'Tgetattr' after unlink
  tests/9p: also check 'Tgetattr' in 'use-after-unlink' test

 hw/9pfs/9p.c                          | 12 ++++---
 tests/qtest/libqos/virtio-9p-client.c |  3 +-
 tests/qtest/virtio-9p-test.c          | 46 +++++++++++++++++++++++++++
 3 files changed, 55 insertions(+), 6 deletions(-)

-- 
2.39.5



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

end of thread, other threads:[~2024-11-27 10:00 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-24 16:28 [PATCH 0/6] 9pfs: fix fstat() after unlink() (with a Linux guest) Christian Schoenebeck
2024-02-21 14:13 ` [PATCH 1/6] tests/9p: add 'use-after-unlink' test Christian Schoenebeck
2024-11-25  8:47   ` Greg Kurz
2024-11-25  9:34     ` Christian Schoenebeck
2024-11-24 13:34 ` [PATCH 2/6] tests/9p: fix Rreaddir response name Christian Schoenebeck
2024-11-24 19:41   ` Christian Schoenebeck
2024-11-25  8:48   ` Greg Kurz
2024-11-24 14:49 ` [PATCH 3/6] tests/9p: add missing Rgetattr " Christian Schoenebeck
2024-11-24 19:42   ` Christian Schoenebeck
2024-11-25  8:51   ` Greg Kurz
2024-11-24 15:06 ` [PATCH 4/6] 9pfs: remove obsolete comment in v9fs_getattr() Christian Schoenebeck
2024-11-24 19:43   ` Christian Schoenebeck
2024-11-25  8:54   ` Greg Kurz
2024-11-24 15:50 ` [PATCH 5/6] 9pfs: fix 'Tgetattr' after unlink Christian Schoenebeck
2024-11-24 19:44   ` Christian Schoenebeck
2024-11-26 16:03   ` Christian Schoenebeck
2024-11-26 16:58     ` Greg Kurz
2024-11-24 16:05 ` [PATCH 6/6] tests/9p: also check 'Tgetattr' in 'use-after-unlink' test Christian Schoenebeck
2024-11-26 17:02   ` Greg Kurz
2024-11-25  8:45 ` [PATCH 0/6] 9pfs: fix fstat() after unlink() (with a Linux guest) Greg Kurz
2024-11-25  9:05   ` Greg Kurz
2024-11-25 10:23   ` Christian Schoenebeck
2024-11-25 11:35     ` Greg Kurz
2024-11-25 14:11       ` Christian Schoenebeck
2024-11-27  9:58 ` Christian Schoenebeck

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.