lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9b9fd5ce-c303-46c4-acc7-40db1201f70a@lucifer.local>
Date: Fri, 9 May 2025 11:57:17 +0100
From: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
To: David Hildenbrand <david@...hat.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
        "Liam R . Howlett" <Liam.Howlett@...cle.com>,
        Vlastimil Babka <vbabka@...e.cz>, Mike Rapoport <rppt@...nel.org>,
        Suren Baghdasaryan <surenb@...gle.com>, Michal Hocko <mhocko@...e.com>,
        Jann Horn <jannh@...gle.com>, Pedro Falcato <pfalcato@...e.de>,
        linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-mm@...ck.org, Alexander Viro <viro@...iv.linux.org.uk>,
        Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>,
        Matthew Wilcox <willy@...radead.org>
Subject: Re: [PATCH 1/3] mm: introduce new .mmap_prepare() file callback

On Fri, May 09, 2025 at 12:51:14PM +0200, David Hildenbrand wrote:
>
> > > > +
> > > > +static inline int __call_mmap_prepare(struct file *file,
> > > > +		struct vm_area_desc *desc)
> > > > +{
> > > > +	return file->f_op->mmap_prepare(desc);
> > > > +}
> > >
> > > Hm, is there a way avoid a copy of the exact same code from fs.h, and
> > > essentially test the implementation in fs.h (-> more coverage by using less
> > > duplciated stubs?).
> >
> > Not really, this kind of copying is sadly part of it because we're
> > intentionally isolating vma.c from everything else, and if we try to bring
> > in other headers they import yet others and etc. etc. it becomes a
> > combinatorial explosion potentially.
>
> I guess what would work is inlining __call_mmap_prepare() -- again, rather
> simple wrapper ... and having file_has_valid_mmap_hooks() + call_mmap()
> reside in vma.c. Hm.
>
> As an alternative, we'd really need some separate header that does not allow
> for any other includes, and is essentially only included in the other header
> files.
>
> Duplicating functions in such a way that they can easily go out of sync and
> are not getting tested is really suboptimal. :(

This is a problem that already exists, if minimised. Perfect is the enemy of
good - if we had make these tests existence depend on being able to isolate
_everything_ they'd never happen :)

But I will definitely try to improve the situation, as I couldn't agree more
about de-syncing and it's a concern I share with you.

I think we have a bit of a mess of header files anyway like this, random helpers
put in random places etc.

It doesn't help that a random driver/shm reference call_mmap()...

Anyway, this is somehwat out of scope for this series, as we already have a
number of instances like this and this is just symptomatic of an existing
problem rather than introducing it.

I think one thing to do might be to have a separate header which is explicitly
for functions like these to at least absolutely highlight this case.

The VMA tests need restructuring anyway, so it can be part of a bigger project
to do some work cleaning up there.

todo++; :>)

>
> --
> Cheers,
>
> David / dhildenb
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ