From nobody Mon Feb 9 13:02:07 2026 Received: from out-186.mta1.migadu.com (out-186.mta1.migadu.com [95.215.58.186]) (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 D146F1BFE00 for ; Mon, 28 Apr 2025 03:36:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.186 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745811405; cv=none; b=mWJWW1q0c5Bf0ogw3p0S0RVmhJJDUU9Kx7vlb0xRYsUhkSSkFFtlsTjPKp+toChzgyhsG8HgjObZwc2fYtkZIT1msYhy7dxz/i7QJ/aB11BTA1+mhtwNeJEzbSO90YiK4rY4obuqNoPpDcvDKujUtG/K+2AlDu3X0lJ5rtKdvOc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745811405; c=relaxed/simple; bh=2bUbxHD5Dxg5eYui3jDltoOsngL8VyFix5jEfVdSLG0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XER4BsF2I3vFBv+8BmIHdrCPDr+HWXiAhoB7EQGdxvehfZ9gxGn+wASL9ijgiI9oF2n0YIldTbfuFSBzl7VjpkD/K0pzg7pAC9LpWFQCIjP46ybbIMxl83TkU+J7okuq3pvPeyQp61iXqJ7+q67nxnCax5BDwm0P7uwEi4njrow= 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=rkb+LBSM; arc=none smtp.client-ip=95.215.58.186 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="rkb+LBSM" 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=1745811401; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pVLyMgxEgIhuDOYAYLLDexoPQY+fmhXjZ45o9+pIZwY=; b=rkb+LBSMsHwLB7IGdALJ3Zig+Z0TfDZlFUKQ3AjaYNm2NIPMmXkltcH/lgWAMD6KlkYQIQ vOIfLeVlKGKzeNULNK80f3sawYAGn4pFstkoWF6WU0/xMrhgdcSO9i9SJg7Pr8tMV0ovUl pvDbVFOWTc4TPMf3lqk1xTij1KeWzeA= From: Roman Gushchin To: linux-kernel@vger.kernel.org Cc: Andrew Morton , Alexei Starovoitov , Johannes Weiner , Michal Hocko , Shakeel Butt , Suren Baghdasaryan , David Rientjes , Josh Don , Chuyi Zhou , cgroups@vger.kernel.org, linux-mm@kvack.org, bpf@vger.kernel.org, Roman Gushchin Subject: [PATCH rfc 03/12] bpf: treat fmodret tracing program's arguments as trusted Date: Mon, 28 Apr 2025 03:36:08 +0000 Message-ID: <20250428033617.3797686-4-roman.gushchin@linux.dev> In-Reply-To: <20250428033617.3797686-1-roman.gushchin@linux.dev> References: <20250428033617.3797686-1-roman.gushchin@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" *** DO NOT MERGE! *** This is a temporarily workaround, which will be fixed/replaced in the next version. -- Bpf oom handler hook has to: 1) have a trusted pointer to the oom_control structure, 2) return a value, 3) be sleepable to use cgroup iterator functions. fmodret tracing programs fulfill 2) and 3). This patch enables 1), however this change contradicts the commit c6b0337f0120 ("bpf: Don't mark arguments to fentry/fexit programs as trusted."). Signed-off-by: Roman Gushchin --- kernel/bpf/btf.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c index a91822bae043..aa86c4eabfa0 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -6424,7 +6424,14 @@ static bool prog_args_trusted(const struct bpf_prog = *prog) =20 switch (prog->type) { case BPF_PROG_TYPE_TRACING: - return atype =3D=3D BPF_TRACE_RAW_TP || atype =3D=3D BPF_TRACE_ITER; + switch (atype) { + case BPF_TRACE_RAW_TP: + case BPF_TRACE_ITER: + case BPF_MODIFY_RETURN: + return true; + default: + return false; + } case BPF_PROG_TYPE_LSM: return bpf_lsm_is_trusted(prog); case BPF_PROG_TYPE_STRUCT_OPS: --=20 2.49.0.901.g37484f566f-goog