From: Andrey Erokhin <language.lawyer@gmail.com>
To: Christian Schoenebeck <qemu_oss@crudebyte.com>, qemu-devel@nongnu.org
Cc: Greg Kurz <groug@kaod.org>
Subject: Re: [PATCH] hw/9pfs: Follow native symlinks when security-model=mapped
Date: Fri, 21 Nov 2025 23:32:14 +0500 [thread overview]
Message-ID: <f5fee3f9-9075-4d73-96b2-5d026500e295@gmail.com> (raw)
In-Reply-To: <13890690.uLZWGnKmhe@weasel>
[-- Attachment #1: Type: text/plain, Size: 2030 bytes --]
On 21/11/2025 17:20, Christian Schoenebeck wrote:
> Andrey, just some minor issues from my side below:
>
> Git commit log message should not exceed 76 characters per line.
TBH, I'm not used to sending patches by git, it was just an e-mail message, not a commit message
>> QEMU issues:
>> https://gitlab.com/qemu-project/qemu/-/issues/173 (from
>> https://bugs.launchpad.net/qemu/+bug/1831354)
>> https://gitlab.com/qemu-project/qemu/-/issues/3088 (dup of the first one)
>
> This should be:
>
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/173
Fixed in the attached patch. Or should I start a new [PATCH v2] thread?
> The other links can be dropped. They are already linked by #173.
>
>> Signed-off-by: Andrey Erokhin <language.lawyer@gmail.com>
>>
>>
>> diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c
>> index 31e216227c..b4f8be2c81 100644
>> --- a/hw/9pfs/9p-local.c
>> +++ b/hw/9pfs/9p-local.c
>> @@ -468,12 +468,14 @@ 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;
>> }
>
> scripts/checkpatch.pl complaints:
>
> ERROR: trailing statements should be on next line
> #33: FILE: hw/9pfs/9p-local.c:471:
> + if (errno == ELOOP) goto native_symlink;
>
> ERROR: braces {} are necessary for all arms of this statement
> #33: FILE: hw/9pfs/9p-local.c:471:
> + if (errno == ELOOP) goto native_symlink;
> [...]
Fixed
>> 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:;
>
> Semicolon is unnecessary here, isn't it?
https://port70.net/~nsz/c/c11/n1570.html#6.8.1 Labeled statements:
labeled-statement:
identifier : statement
Can't be a declaration
[-- Attachment #2: 0001-hw-9pfs-follow-native-symlinks-in-security-model-map.patch --]
[-- Type: text/x-patch, Size: 1085 bytes --]
hw/9pfs: follow native symlinks in security-model=mapped
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/173
Signed-off-by: Andrey Erokhin <language.lawyer@gmail.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 31e216227c..5ce97b76a6 100644
--- a/hw/9pfs/9p-local.c
+++ b/hw/9pfs/9p-local.c
@@ -468,12 +468,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.34.1
next prev parent reply other threads:[~2025-11-22 3:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-20 13:01 [PATCH] hw/9pfs: Follow native symlinks when security-model=mapped Andrey Erokhin
2025-11-21 12:20 ` Christian Schoenebeck
2025-11-21 18:32 ` Andrey Erokhin [this message]
2025-11-22 12:23 ` Christian Schoenebeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f5fee3f9-9075-4d73-96b2-5d026500e295@gmail.com \
--to=language.lawyer@gmail.com \
--cc=groug@kaod.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu_oss@crudebyte.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).