From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-178.mta0.migadu.com (out-178.mta0.migadu.com [91.218.175.178]) (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 EEE20269D18 for ; Tue, 27 Jan 2026 20:21:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769545272; cv=none; b=T6d8ghiWzYFzqXZpkXjAhJedxzrIcx05x9Hwk79Tge6ShSsj0rCWGy9DZY7nllk89+IMhvQ7kGnJBgXuBQW3dcEg1GYp35PKw50QvMtiTUq/TssPzcL21qam8DWq7EiVQN/dNJlwu/X7U9TSiBx/0tYk3u+Kz90dg0ysnr6ia+4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769545272; c=relaxed/simple; bh=XFHULvI9Ru40wthBvjelLrasYy/5aArCPZEZW4a/JiI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=e2qufWLIV9CZR20kHpr3Cru/NAXwMcx4/4b3n9j59iNQM+qlsqCCpvXZCqIwCrBAZtPJFghq26/7TvQniGZeR/DYeV9bGkZX3BmfzwQr67YdCUa6VCbwHkzLtgFJJtHIWz32lT+l7CoA1KkBzMgGnDTxQQm48KGQ8sIah/1cHz0= 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=E8g48av/; arc=none smtp.client-ip=91.218.175.178 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="E8g48av/" Message-ID: <9a2c5f29-b45c-4ff3-a8f4-51d207a82d38@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1769545269; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YUP+BUUh/kupPGgyR6A9Wup/rhNgbndAT0lTSWXG59k=; b=E8g48av/mdH7vBbB46MQhSM0uXG6YpO9YX98/FirSyqUEVhrcg/cahIt/f+aYzBq5hHi86 OsfpX5vB2G/tIxiVQbesHN24WfBtVvvli0VTZfD3dOzzSaW3kA52HjAA2I5CIIEn1s1rUd x6IeDVBjc+GYbWgSh/g8XkzfvWzR2BI= Date: Tue, 27 Jan 2026 12:21:03 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH bpf-next v3 08/17] mm: introduce bpf_oom_kill_process() bpf kfunc To: Roman Gushchin 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 References: <20260127024421.494929-1-roman.gushchin@linux.dev> <20260127024421.494929-9-roman.gushchin@linux.dev> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Martin KaFai Lau In-Reply-To: <20260127024421.494929-9-roman.gushchin@linux.dev> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT 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; > + > +static const struct btf_kfunc_id_set bpf_oom_kfunc_set = { > + .owner = THIS_MODULE, > + .set = &bpf_oom_kfuncs, > + .filter = bpf_oom_kfunc_filter, > +}; > + > +static int __init bpf_oom_init(void) > +{ > + int err; > + > + err = register_btf_kfunc_id_set(BPF_PROG_TYPE_STRUCT_OPS, > + &bpf_oom_kfunc_set);