Re: [PATCH] proc: also check the opener's capability for oom_score_adj and oom_adj
From: Hungyu Lin
Date: Thu Nov 26 2026 - 15:34:39 EST
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.
Thanks,
Hungyu