[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d7jobrgasskf4j6mst3amazyon5g473hhrmbrie7ki7xoy5mca@qsdpnk2qracx>
Date: Fri, 13 Sep 2024 08:56:12 -0700
From: Shakeel Butt <shakeel.butt@...ux.dev>
To: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, Vlastimil Babka <vbabka@...e.cz>,
Liam Howlett <liam.howlett@...cle.com>, Shakeel Butt <shakeelb@...gle.com>,
Suren Baghdasaryan <surenb@...gle.com>
Subject: Re: [PATCH] mm/madvise: process_madvise() drop capability check if
same mm
On Fri, Sep 13, 2024 at 03:06:28PM GMT, Lorenzo Stoakes wrote:
> In commit 96cfe2c0fd23 ("mm/madvise: replace ptrace attach requirement for
> process_madvise") process_madvise() was updated to require the caller to
> possess the CAP_SYS_NICE capability to perform the operation, in addition
> to a check against PTRACE_MODE_READ performed by mm_access().
>
> The mm_access() function explicitly checks to see if the address space of
> the process being referenced is the current one, in which case no check is
> performed.
>
> We, however, do not do this when checking the CAP_SYS_NICE capability. This
> means that we insist on the caller possessing this capability in order to
> perform madvise() operations on its own address space, which seems
> nonsensical.
>
> Simply add a check to allow for an invocation of this function with pidfd
> set to the current process without elevation.
>
> Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
Acked-by: Shakeel Butt <shakeel.butt@...ux.dev>
Powered by blists - more mailing lists