From: Richard Weinberger <richard@nod.at>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
toralf.foerster@gmx.de, jdike@addtoit.com,
linux-kernel@vger.kernel.org,
user-mode-linux-devel@lists.sourceforge.net,
viro@zeniv.linux.org.uk
Subject: Re: [uml-devel] [PATCH 1/1] hostfs: fix UML crash
Date: Mon, 18 Oct 2010 21:31:33 +0200 [thread overview]
Message-ID: <201010182131.33385.richard@nod.at> (raw)
In-Reply-To: <AANLkTimpmcZEV-V6rhZtJXnXLdtB_HRTxM+ExM-YyWmh@mail.gmail.com>
Am Montag 18 Oktober 2010, 21:22:31 schrieb Geert Uytterhoeven:
> On Mon, Oct 18, 2010 at 20:40, Andrew Morton <akpm@linux-foundation.org>
wrote:
> > On Mon, 18 Oct 2010 18:36:54 +0200 Richard Weinberger <richard@nod.at>
wrote:
> >> 365b1818 resized f_spare within struct statfs.
> >> hostfs accesses f_spare directly and needs an update.
> >>
> >> Signed-off-by: Richard Weinberger <richard@nod.at>
> >> Reported-by: Toralf F__rster <toralf.foerster@gmx.de>
> >> Tested-by: Toralf F__rster <toralf.foerster@gmx.de>
> >> ---
> >> fs/hostfs/hostfs_user.c | 2 +-
> >> 1 files changed, 1 insertions(+), 1 deletions(-)
> >>
> >> diff --git a/fs/hostfs/hostfs_user.c b/fs/hostfs/hostfs_user.c
> >> index 6777aa0..ce2f168 100644
> >> --- a/fs/hostfs/hostfs_user.c
> >> +++ b/fs/hostfs/hostfs_user.c
> >> @@ -388,6 +388,6 @@ int do_statfs(char *root, long *bsize_out, long long
> >> *blocks_out, spare_out[1] = buf.f_spare[1];
> >> spare_out[2] = buf.f_spare[2];
> >> spare_out[3] = buf.f_spare[3];
> >> - spare_out[4] = buf.f_spare[4];
> >> +
> >> return 0;
> >> }
> >
> > Thanks.
> >
> > Is there any reason for hostfs to be playing with the f_spare field at
> > all?
>
> It just copies it from struct statfs64 on the host to struct kstatfs
> on the guest.
> Probably a memcpy() is more future-safe, if it's combined with a
> BUILD_BUG_ON(sizeof(statfs64.f_spare) != sizeof(kstatfs.f_spare)).
>
> Still, currently it doesn't copy the recently added f_flags field.
> To protect against future changes like that, an explicit
> BUILD_BUG_ON(sizeof(kstatfs.f_spare) != 4*sizeof(long)) may be even
> better...
Anyway, why do we need to copy f_spare from the host to the guest?
I'm quite sure it can be omitted.
Thanks,
//richard
next prev parent reply other threads:[~2010-10-18 19:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-18 16:36 [PATCH 1/1] hostfs: fix UML crash Richard Weinberger
2010-10-18 18:40 ` Andrew Morton
2010-10-18 18:53 ` Richard Weinberger
2010-10-18 20:02 ` Andrew Morton
2010-10-19 1:11 ` Christoph Hellwig
2010-10-19 10:27 ` Richard Weinberger
2010-10-18 19:22 ` [uml-devel] " Geert Uytterhoeven
2010-10-18 19:31 ` Richard Weinberger [this message]
2010-10-18 19:43 ` Geert Uytterhoeven
2010-10-18 20:03 ` Richard Weinberger
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=201010182131.33385.richard@nod.at \
--to=richard@nod.at \
--cc=akpm@linux-foundation.org \
--cc=geert@linux-m68k.org \
--cc=jdike@addtoit.com \
--cc=linux-kernel@vger.kernel.org \
--cc=toralf.foerster@gmx.de \
--cc=user-mode-linux-devel@lists.sourceforge.net \
--cc=viro@zeniv.linux.org.uk \
/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