Re: [PATCH v3] selinux: hooks: use kmalloc() to allocate path buffer
From: Mike Rapoport
Date: Thu Jun 04 2026 - 01:30:18 EST
On Wed, Jun 03, 2026 at 12:08:04PM -0400, Paul Moore wrote:
> On Tue, Jun 2, 2026 at 6:20 AM Mike Rapoport <rppt@xxxxxxxxxx> wrote:
> > On Mon, Jun 01, 2026 at 02:11:11PM -0400, Paul Moore wrote:
> > > On Sun, May 31, 2026 at 12:58 PM Mike Rapoport <rppt@xxxxxxxxxx> wrote:
> > > >
> > > > From: "Mike Rapoport (Microsoft)" <rppt@xxxxxxxxxx>
> > > >
> > > > selinux_genfs_get_sid() allocates memory for a path with __get_free_page().
> > > >
> > > > Such usage does not require a "page" and the size of the buffer should
> > > > actually be PATH_MAX which may be less than PAGE_SIZE on some
> > > > architectures.
> > > >
> > > > Replace __get_free_page() for allocation of a path buffer with kmalloc()
> > > > and make it explicit that the buffer size is PATH_MAX.
> > > >
> > > > Signed-off-by: Mike Rapoport (Microsoft) <rppt@xxxxxxxxxx>
> > > > ---
> > > > v3:
> > > > get the args in the right order
> > > >
> > > > v2:
> > > > * explicitly use kmalloc() with PATH_MAX
> > > >
> > > > security/selinux/hooks.c | 6 +++---
> > > > 1 file changed, 3 insertions(+), 3 deletions(-)
> > >
> > > Considering the problems with the first two versions of this patch I
> > > have to ask what sort of testing you've done on this? I know it's a
> > > trivial patch, but we're on v3 ...
> >
> > Boot of fedora on an arm64 VM with 64K page size kernel.
>
> Given the minimal testing, the problems with the previous versions,
> and the fact that we are at -rc6, I'm going to hold this for the next
> dev cycle.
Fair enough :)
> --
> paul-moore.com
--
Sincerely yours,
Mike.