From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-189.mta0.migadu.com (out-189.mta0.migadu.com [91.218.175.189]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 207F128727D for ; Tue, 27 Jan 2026 20:47:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.189 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769546864; cv=none; b=oBElyUBI+68OQdL2glUNvTeClqEeEs8UJPL2/yZIUj6QbeM8bPEgJJcLFfwPWOfBasiaKFBN6gBPDm314Ex+rlOTgwYN5mHB32w8VDgZCRiw9KFV4l4OCE4Dy80IMWKKcF/+eOf4zFllsqeZ2ETzQDTt5WU27FSiqqa0nzRWVqk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769546864; c=relaxed/simple; bh=rZcwqTKzBmQ9xeyFfvycFgI34PEL2PGDppu7vMC1dxo=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=st7IjNQdqjEIcSuuqnRtWvd5BAtwD6ZFZyVRzByK5Xa/KIJrvUlzaSXJ6DoGb+fpJObfB3/WTvPo+n6pl4QMYobE3SDT1fRq9JlLWNlDHxBkLD/YoRVJg1aAlbfnhVHVL1MjORqlnjFSHezuRaWuzaRLLA4gDBSzZc2C7y4VWXk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=MXrV5wPR; arc=none smtp.client-ip=91.218.175.189 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="MXrV5wPR" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1769546849; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=p62oMbD2WGIl31iE58AjJBexIFrmv0YyTyX0OQvm33U=; b=MXrV5wPR59IDMmslYF9So3TZUiPFv26eBfOnddXc6nMgRjMhB+pPURPChm0vE2CuMcyCMe TivIEtPADaLv6IkiwsRuiagd892Hf21vczCj5R9zqXFJFBfDwlb7Uvj2u7I0qDsgo1EeRD oxHDJcrrjld+4Lxv4mpaOFiYGYO71jw= From: Roman Gushchin To: Martin KaFai Lau Cc: Michal Hocko , Alexei Starovoitov , Matt Bobrowski , Shakeel Butt , JP Kobryn , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Suren Baghdasaryan , Johannes Weiner , Andrew Morton , bpf@vger.kernel.org Subject: Re: [PATCH bpf-next v3 08/17] mm: introduce bpf_oom_kill_process() bpf kfunc In-Reply-To: <9a2c5f29-b45c-4ff3-a8f4-51d207a82d38@linux.dev> (Martin KaFai Lau's message of "Tue, 27 Jan 2026 12:21:03 -0800") References: <20260127024421.494929-1-roman.gushchin@linux.dev> <20260127024421.494929-9-roman.gushchin@linux.dev> <9a2c5f29-b45c-4ff3-a8f4-51d207a82d38@linux.dev> Date: Tue, 27 Jan 2026 20:47:11 +0000 Message-ID: <7ia48qdilr5c.fsf@castle.c.googlers.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Flow: FLOW_OUT Martin KaFai Lau writes: > On 1/26/26 6:44 PM, Roman Gushchin wrote: >> +static int bpf_oom_kfunc_filter(const struct bpf_prog *prog, u32 kfunc_id) > > The filter callback is registered for BPF_PROG_TYPE_STRUCT_OPS. It is > checking if a kfunc_id is allowed for other struct_ops progs also, > e.g. the bpf-tcp-cc struct_ops progs. > > >> +{ >> + if (prog->type != BPF_PROG_TYPE_STRUCT_OPS || >> + prog->aux->attach_btf_id != bpf_oom_ops_ids[0]) >> + return -EACCES; > > The 'return -EACCES' should be the cause of the "calling kernel > function XXX is not allowed" error reported by the CI. Take a look at > btf_kfunc_is_allowed(). > > Take a look at bpf_qdisc_kfunc_filter(). I suspect it should be > something like this, untested: > > if (btf_id_set8_contains(&bpf_oom_kfuncs, kfunc_id) && > prog->aux->st_ops != &bpf_oom_bpf_ops) > return -EACCES; > > return 0; Oh, I see.. It's a bit surprising that these .filter() functions have non-local effects... Will fix in v4. Thank you, Martin!