From: Stefan Hajnoczi <stefanha@redhat.com>
To: Brian Foster <bfoster@redhat.com>
Cc: linux-fsdevel@vger.kernel.org,
Miklos Szeredi <mszeredi@redhat.com>,
vgoyal@redhat.com
Subject: Re: [PATCH] virtiofs: include a newline in sysfs tag
Date: Tue, 7 May 2024 10:03:30 -0400 [thread overview]
Message-ID: <20240507140330.GD105913@fedora.redhat.com> (raw)
In-Reply-To: <ZjkoDqhIti--j1F5@bfoster>
[-- Attachment #1: Type: text/plain, Size: 2570 bytes --]
On Mon, May 06, 2024 at 02:57:18PM -0400, Brian Foster wrote:
> On Tue, Apr 30, 2024 at 01:34:31PM -0400, Stefan Hajnoczi wrote:
> > On Thu, Apr 25, 2024 at 06:44:00AM -0400, Brian Foster wrote:
> > > The internal tag string doesn't contain a newline. Append one when
> > > emitting the tag via sysfs.
> > >
> > > Signed-off-by: Brian Foster <bfoster@redhat.com>
> > > ---
> > >
> > > Hi all,
> > >
> > > I just noticed this and it seemed a little odd to me compared to typical
> > > sysfs output, but maybe it was intentional..? Easy enough to send a
> > > patch either way.. thoughts?
> >
> > Hi Brian,
> > Orthogonal to the newline issue, sysfs_emit(buf, "%s", fs->tag) is
> > needed to prevent format string injection. Please mention this in the
> > commit description. I'm afraid I introduced that bug, sorry!
> >
>
> Hi Stefan,
>
> Ah, thanks. That hadn't crossed my mind.
>
> > Regarding newline, I'm concerned that adding a newline might break
> > existing programs. Unless there is a concrete need to have the newline,
> > I would keep things as they are.
> >
>
> Not sure I follow the concern.. wasn't this interface just added? Did
> you have certain userspace tools in mind?
v6.9-rc7 has already been tagged and might be the last tag (I'm not
sure). If v6.9 is released without the newline, then changing it in the
next kernel release could cause breakage. Some ideas on how userspace
might break:
- Userspace calls mount(2) with the contents of the sysfs attr as the
source (i.e. "myfs\n" vs "myfs").
- Userspace stores the contents of the sysfs attr in a file and runs
again later on a new kernel after the format has changed, causing tag
comparisons to fail.
> FWIW, my reason for posting this was that the first thing I did to try
> out this functionality was basically a 'cat /sys/fs/virtiofs/*/tag' to
> see what fs' were attached to my vm, and then I got a single line
> concatenation of every virtiofs tag and found that pretty annoying. ;)
Understood.
> I don't know that is a concrete need for the newline, but I still find
> the current behavior kind of odd. That said, I'll defer to you guys if
> you'd prefer to leave it alone. I just posted a v2 for the format
> specifier thing as above and you can decide which patch to take or not..
The v6.9 release will happen soon and I'm not sure if we can still get
the patch in. I've asked Miklos if your patch can be merged with the
newline added for v6.9. That would solve the userspace breakage
concerns.
Stefan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2024-05-07 14:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-25 10:44 [PATCH] virtiofs: include a newline in sysfs tag Brian Foster
2024-04-25 12:42 ` Vivek Goyal
2024-04-30 17:34 ` Stefan Hajnoczi
2024-05-06 18:57 ` Brian Foster
2024-05-07 14:03 ` Stefan Hajnoczi [this message]
2024-05-07 16:32 ` Brian Foster
2024-05-08 7:55 ` Miklos Szeredi
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=20240507140330.GD105913@fedora.redhat.com \
--to=stefanha@redhat.com \
--cc=bfoster@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=mszeredi@redhat.com \
--cc=vgoyal@redhat.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 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.