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 46EA03B14BF for ; Wed, 1 Jul 2026 07:02:52 +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=1782889373; cv=none; b=bbXUMWIKc5KTWu2RyfTBL8rSP4ppzd98pC6wSubWZgBULUWfZUYnIBYg1KK8Jf88+z3N3fuK8wRCgaUtqvJRF4tiHYqjjreWUxfQ0u9pSJ5kGkjZ3buQMj7C1X+GC/svzanEkH5Ra9wS8GfKcETPD64ISggpreJh3TfIHQYPol8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782889373; c=relaxed/simple; bh=mYmmAQSde6F7Y/E1QWGy1zeR+da/doe1A8t8muctFB0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=n2ngSuqUCz/oZKERpQJfyivxHEpvi2JsT1qbMmbuoWezoAdmo5hobskL9/qcX8+DSlOTyAgOk3FP74cU7emOEH2nQhbXUmXopx5RgxiNlEQDeSlJu+FNfn/ogW89Nm2wLVm+ZhTR1iSdsqFoHLiqClZv9Y1XtfYNW22/UGhcy/Y= 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=hHa7k8Kk; 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="hHa7k8Kk" Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1782889360; 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=2YHZ7VeExib9bwMl0hMRMS3DxaFLnavLkPtqkc6DdGk=; b=hHa7k8KkncHcXNYwNh7nMxCdcxfZ3P0OQrLgq3ymz66x4F86OrXag/T4CKo4bm7Cn/Y1ZT GxRfGYCmBG2UjR3EQ9Cb+1c6+2LNvIRjRuSfN/CmOG5XuHYrhodAMK/ZeqMda2RbaJ6iOM h9DOhM8MMN6SkXZny8bnhF5ALXkBcAU= Date: Wed, 1 Jul 2026 15:02:29 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [RFC PATCH bpf 1/6] bpf: Disallow interpreter fallback for user BPF_ADDR_SPACE_CAST insn Content-Language: en-US To: Tiezhu Yang , KaFai Wan , bpf@vger.kernel.org Cc: Alexei Starovoitov , Daniel Borkmann , John Fastabend , Andrii Nakryiko , Eduard Zingerman , Kumar Kartikeya Dwivedi , Martin KaFai Lau , Song Liu , Yonghong Song , Jiri Olsa , Emil Tsalapatis , Andrew Morton , Shuah Khan , Puranjay Mohan , Anton Protopopov , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org References: <20260626154330.33619-1-leon.hwang@linux.dev> <20260626154330.33619-2-leon.hwang@linux.dev> <1c07a34f-b050-a281-6a7b-542a9bfa30b3@loongson.cn> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Leon Hwang In-Reply-To: <1c07a34f-b050-a281-6a7b-542a9bfa30b3@loongson.cn> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 1/7/26 14:49, Tiezhu Yang wrote: [...] >> >> It is a real issue. >> >> Instead of fixing up helper calls, it seems better to prevent >> interpreter fallback if the prog has any JIT-inlineable helper call. > > Hi Alexei and Leon, > > What about the following: (not tested yet, if it is good, I can test it) > > [...] > > If you are OK with the above changes, I will test it again and send > a new version later. > If you don't mind, I think I can disallow the interpreter fallback by the below diff in the next revision of this series. The 'aux->jit_required' is introduced by following Alexei's suggestion. Thanks, Leon --- diff --git a/kernel/bpf/fixups.c b/kernel/bpf/fixups.c index b5a273a5f944..677b6d2a6ba4 100644 --- a/kernel/bpf/fixups.c +++ b/kernel/bpf/fixups.c @@ -1841,8 +1841,10 @@ int bpf_do_misc_fixups(struct bpf_verifier_env *env) } /* Skip inlining the helper call if the JIT does it. */ - if (bpf_jit_inlines_helper_call(insn->imm)) + if (bpf_jit_inlines_helper_call(insn->imm)) { + prog->aux->jit_required = true; goto next_insn; + } if (insn->imm == BPF_FUNC_get_route_realm) prog->dst_needed = 1;