[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PULL v2 5/5] 9pfs: Fix segfault in do_readdir_many caused by struct
|
From: |
Christian Schoenebeck |
|
Subject: |
Re: [PULL v2 5/5] 9pfs: Fix segfault in do_readdir_many caused by struct dirent overread |
|
Date: |
Tue, 22 Feb 2022 14:54:17 +0100 |
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:
20220220165056.72289-10-wwcohen@gmail.com/">https://lore.kernel.org/qemu-devel/20220220165056.72289-10-wwcohen@gmail.com/
We'll find a different place.
Thanks!
Best regards,
Christian Schoenebeck
- [PULL v2 0/5] 9p queue (previous 2022-02-10), Christian Schoenebeck, 2022/02/17
- [PULL v2 2/5] tests/9pfs: fix mkdir() being called twice, Christian Schoenebeck, 2022/02/17
- [PULL v2 4/5] tests/9pfs: Use g_autofree and g_autoptr where possible, Christian Schoenebeck, 2022/02/17
- [PULL v2 3/5] tests/9pfs: Fix leak of local_test_path, Christian Schoenebeck, 2022/02/17
- [PULL v2 1/5] tests/9pfs: use g_autofree where possible, Christian Schoenebeck, 2022/02/17
- Re: [PULL v2 0/5] 9p queue (previous 2022-02-10), Peter Maydell, 2022/02/19