* [PULL 1/1] 9pfs: local: read native symlinks when security-model=mapped
2026-02-07 13:17 [PULL 0/1] 9p queue 2026-02-07 Christian Schoenebeck
@ 2026-02-07 13:17 ` Christian Schoenebeck
2026-02-09 10:59 ` [PULL 0/1] 9p queue 2026-02-07 Peter Maydell
1 sibling, 0 replies; 3+ messages in thread
From: Christian Schoenebeck @ 2026-02-07 13:17 UTC (permalink / raw)
To: qemu-devel, Peter Maydell; +Cc: Greg Kurz, Andrey Erokhin
From: Andrey Erokhin <language.lawyer@gmail.com>
Directories attached using virtfs with security-model=mapped
may contain native symlinks
This can happen e.g. when booting from a rootfs directory tree
(usually with a writable overlay set up on the host side)
Currently, when security-model=mapped[-xattr|-file],
QEMU assumes that host-side "symlinks" are in the mapped format,
i.e. are regular files storing the linked path,
so it tries to open with O_NOFOLLOW
and fails with ELOOP on native symlinks
This patch introduces a fallback for such cases:
reuse security-model=[none|passthrough] else if branch logic
where readlink will be called for the path basename
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/173
Signed-off-by: Andrey Erokhin <language.lawyer@gmail.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Link: https://lore.kernel.org/qemu-devel/3c35955d-a57e-4203-81c5-395146e23f83@gmail.com
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
---
hw/9pfs/9p-local.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c
index c3745f2839..24cb1da90a 100644
--- a/hw/9pfs/9p-local.c
+++ b/hw/9pfs/9p-local.c
@@ -469,12 +469,16 @@ static ssize_t local_readlink(FsContext *fs_ctx, V9fsPath *fs_path,
fd = local_open_nofollow(fs_ctx, fs_path->data, O_RDONLY, 0);
if (fd == -1) {
+ if (errno == ELOOP) {
+ goto native_symlink;
+ }
return -1;
}
tsize = RETRY_ON_EINTR(read(fd, (void *)buf, bufsz));
close_preserve_errno(fd);
} else if ((fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) ||
(fs_ctx->export_flags & V9FS_SM_NONE)) {
+ native_symlink:;
char *dirpath = g_path_get_dirname(fs_path->data);
char *name = g_path_get_basename(fs_path->data);
int dirfd;
--
2.47.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PULL 0/1] 9p queue 2026-02-07
@ 2026-02-07 13:17 Christian Schoenebeck
2026-02-07 13:17 ` [PULL 1/1] 9pfs: local: read native symlinks when security-model=mapped Christian Schoenebeck
2026-02-09 10:59 ` [PULL 0/1] 9p queue 2026-02-07 Peter Maydell
0 siblings, 2 replies; 3+ messages in thread
From: Christian Schoenebeck @ 2026-02-07 13:17 UTC (permalink / raw)
To: qemu-devel, Peter Maydell; +Cc: Greg Kurz, Andrey Erokhin
The following changes since commit cd5a79dc98e3087e7658e643bdbbb0baec77ac8a:
Merge tag 'for_upstream' of https://git.kernel.org/pub/scm/virt/kvm/mst/qemu into staging (2026-02-05 13:54:50 +0000)
are available in the Git repository at:
https://github.com/cschoenebeck/qemu.git tags/pull-9p-20260207
for you to fetch changes up to 22296f2db9f17f9954f85de9e99b09498936eb51:
9pfs: local: read native symlinks when security-model=mapped (2026-02-07 13:38:56 +0100)
----------------------------------------------------------------
9pfs changes:
* security-model=mapped: add fallback for reading native symlink
(if no mapped symlink present).
----------------------------------------------------------------
Andrey Erokhin (1):
9pfs: local: read native symlinks when security-model=mapped
hw/9pfs/9p-local.c | 4 ++++
1 file changed, 4 insertions(+)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PULL 0/1] 9p queue 2026-02-07
2026-02-07 13:17 [PULL 0/1] 9p queue 2026-02-07 Christian Schoenebeck
2026-02-07 13:17 ` [PULL 1/1] 9pfs: local: read native symlinks when security-model=mapped Christian Schoenebeck
@ 2026-02-09 10:59 ` Peter Maydell
1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2026-02-09 10:59 UTC (permalink / raw)
To: Christian Schoenebeck; +Cc: qemu-devel, Greg Kurz, Andrey Erokhin
On Sat, 7 Feb 2026 at 13:23, Christian Schoenebeck
<qemu_oss@crudebyte.com> wrote:
>
> The following changes since commit cd5a79dc98e3087e7658e643bdbbb0baec77ac8a:
>
> Merge tag 'for_upstream' of https://git.kernel.org/pub/scm/virt/kvm/mst/qemu into staging (2026-02-05 13:54:50 +0000)
>
> are available in the Git repository at:
>
> https://github.com/cschoenebeck/qemu.git tags/pull-9p-20260207
>
> for you to fetch changes up to 22296f2db9f17f9954f85de9e99b09498936eb51:
>
> 9pfs: local: read native symlinks when security-model=mapped (2026-02-07 13:38:56 +0100)
>
> ----------------------------------------------------------------
> 9pfs changes:
>
> * security-model=mapped: add fallback for reading native symlink
> (if no mapped symlink present).
>
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/11.0
for any user-visible changes.
-- PMM
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-02-09 11:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-07 13:17 [PULL 0/1] 9p queue 2026-02-07 Christian Schoenebeck
2026-02-07 13:17 ` [PULL 1/1] 9pfs: local: read native symlinks when security-model=mapped Christian Schoenebeck
2026-02-09 10:59 ` [PULL 0/1] 9p queue 2026-02-07 Peter Maydell
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.