Re: [PATCH] proc: also check the opener's capability for oom_score_adj and oom_adj
From: Oleg Nesterov
Date: Fri Nov 27 2026 - 05:59:59 EST
On 11/26, Hungyu Lin wrote:
>
> On Thu, Nov 26, 2026 at 03:42:11PM +0100, Oleg Nesterov wrote:
> > I just noticed that __set_oom_adj() has more CAP_SYS_RESOURCE checks below.
> >
> > Shouldn't we unify them or even factor out?
>
> The checks below only decide whether a successful write also sets
> oom_score_adj_min. The checks above already prevent a write through
> an fd opened without CAP_SYS_RESOURCE from lowering it, so I left
> them as they are.
>
> I can factor out the common check in the two rejection paths in a
> separate patch on top of this one if you like.
No, up to you, I don't really understand this code anyway,
Oleg.