qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kurz <groug@kaod.org>
To: Christian Schoenebeck <qemu_oss@crudebyte.com>
Cc: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Subject: Re: [PULL v2 5/5] 9pfs: Fix segfault in do_readdir_many caused by struct dirent overread
Date: Tue, 22 Feb 2022 16:35:25 +0100	[thread overview]
Message-ID: <20220222163525.0f198199@bahia> (raw)
In-Reply-To: <3196572.21YWrCmDqH@silver>

On Tue, 22 Feb 2022 14:54:17 +0100
Christian Schoenebeck <qemu_oss@crudebyte.com> wrote:

> On Dienstag, 22. Februar 2022 14:21:52 CET Peter Maydell wrote:
> > On Thu, 17 Feb 2022 at 16:43, Christian Schoenebeck
> > 
> > <qemu_oss@crudebyte.com> wrote:
> > > diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
> > > index d1660d67fa..ce12f64853 100644
> > > --- a/include/qemu/osdep.h
> > > +++ b/include/qemu/osdep.h
> > > @@ -805,6 +805,19 @@ static inline int
> > > platform_does_not_support_system(const char *command)> 
> > >  }
> > >  #endif /* !HAVE_SYSTEM_FUNCTION */
> > > 
> > > +/**
> > > + * Duplicate directory entry @dent.
> > > + *
> > > + * It is highly recommended to use this function instead of open coding
> > > + * duplication of @c dirent objects, because the actual @c struct @c
> > > dirent + * size may be bigger or shorter than @c sizeof(struct dirent)
> > > and correct + * handling is platform specific (see gitlab issue #841).
> > > + *
> > > + * @dent - original directory entry to be duplicated
> > > + * @returns duplicated directory entry which should be freed with
> > > g_free()
> > > + */
> > > +struct dirent *qemu_dirent_dup(struct dirent *dent);
> > 
> > Hi; I just noticed this has landed in git recently.
> > Please don't add new prototypes to osdep.h -- it is
> > a header included by every single C file in the tree, so
> > making it bigger slows down compilation. osdep.h is supposed
> > to contain only:
> >  * things which everybody needs
> >  * things without which code would work on most platforms but
> >    fail to compile or misbehave on a minority of host OSes
> >    (ie system incompatibility handling)
> > 
> > This prototype is neither of those -- please find or create a more
> > appropriate header file for it, that can be included only by the
> > source files that actually need it.
> > 
> > thanks
> > -- PMM
> 
> Good to know, because the pending Darwin series would have added stuff to 
> osdep.h as well:
> https://lore.kernel.org/qemu-devel/20220220165056.72289-10-wwcohen@gmail.com/
> 
> We'll find a different place.
> 

I suggest you move all that under hw/9pfs for now since it is
the only user and we don't really know if there will ever be
a new one (especially now that development on C virtiofsd is
slowing down).

Cheers,

--
Greg


> Thanks!
> 
> Best regards,
> Christian Schoenebeck
> 
> 



  reply	other threads:[~2022-02-22 15:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-17 16:19 [PULL v2 0/5] 9p queue (previous 2022-02-10) Christian Schoenebeck
2022-02-17 16:19 ` [PULL v2 4/5] tests/9pfs: Use g_autofree and g_autoptr where possible Christian Schoenebeck
2022-02-17 16:19 ` [PULL v2 2/5] tests/9pfs: fix mkdir() being called twice Christian Schoenebeck
2022-02-17 16:19 ` [PULL v2 5/5] 9pfs: Fix segfault in do_readdir_many caused by struct dirent overread Christian Schoenebeck
2022-02-22 13:21   ` Peter Maydell
2022-02-22 13:54     ` Christian Schoenebeck
2022-02-22 15:35       ` Greg Kurz [this message]
2022-02-17 16:19 ` [PULL v2 1/5] tests/9pfs: use g_autofree where possible Christian Schoenebeck
2022-02-17 16:19 ` [PULL v2 3/5] tests/9pfs: Fix leak of local_test_path Christian Schoenebeck
2022-02-19 15:21 ` [PULL v2 0/5] 9p queue (previous 2022-02-10) Peter Maydell

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=20220222163525.0f198199@bahia \
    --to=groug@kaod.org \
    --cc=peter.maydell@linaro.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).