From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-180.mta1.migadu.com (out-180.mta1.migadu.com [95.215.58.180]) (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 5C80127FB2E for ; Wed, 25 Mar 2026 10:13:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774433616; cv=none; b=QT6QWWUtuVG+CBijr3LzZpGZUFHHHJJSV/by3FYSHVpPdlPBj3IvJrST/EVp824xmddvVJJNrBOO/yjWCi26rComPZjX+q4oXjbUEk0uJASfJRPgYHevMpz6O9bykC3yuqc9puAwYjE4vHle8oK66XTdBbzN85ghid4pt46KJKM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774433616; c=relaxed/simple; bh=jPQ/OCE3cLFSUiqEm98z2Z5fX4ZPiIzJozt+7kxLFuI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PxQg+1bhc7mq4sOTQ/xukV61XtJPx/5APqKaywCLqbmZmcDXiXJ1pcU0y/zhLb+oyFzhZfyy6TPUk4K2FLsc+8Ez75QCoRyECr827mnbmmpOryJYE+dxd01odf0vV1wnfNBaTjxtAbiIDznEfWi7VSoAC6LWTc787ygeYnP9uNE= 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=SsU4PKv9; arc=none smtp.client-ip=95.215.58.180 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="SsU4PKv9" 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=1774433611; 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=1c0m0l0BFph+vxPq0JK9iSEmYMllvCkSTL83OQwQZ68=; b=SsU4PKv9+lZGDqr2EaxCrhvGpHfT5pV6z0OIDaxH+Z4kRtrwqm8MD0Q/el6No/iYD9/2Y3 rl1oJIt/C3CHRAh6D1Hr5nWpEAThsnSoU8IId1jD+inQ7KIvZm2TjbhsUNlaxZo9XlhewW Q7HWh79GyA17l2p8AfB2a3l8EvkPKBs= From: Leon Hwang To: xukuohai@huaweicloud.com Cc: a.s.protopopov@gmail.com, alexis.lothore@bootlin.com, andrii@kernel.org, ast@kernel.org, bjorn@kernel.org, bpf@vger.kernel.org, chleroy@kernel.org, daniel@iogearbox.net, davem@davemloft.net, eddyz87@gmail.com, gor@linux.ibm.com, hbathini@linux.ibm.com, hca@linux.ibm.com, hengqi.chen@gmail.com, iii@linux.ibm.com, johan.almbladh@anyfinetworks.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux@armlinux.org.uk, list+bpf@vahedi.org, luke.r.nels@gmail.com, martin.lau@linux.dev, naveen@kernel.org, paulburton@kernel.org, pulehui@huawei.com, puranjay@kernel.org, udknight@gmail.com, xi.wang@gmail.com, yangtiezhu@loongson.cn, yonghong.song@linux.dev, Leon Hwang Subject: Re: [PATCH bpf-next v10 4/5] bpf, x86: Emit ENDBR for indirect jump targets Date: Wed, 25 Mar 2026 18:13:03 +0800 Message-ID: <20260325101303.232060-1-leon.hwang@linux.dev> In-Reply-To: <20260324122052.342751-5-xukuohai@huaweicloud.com> References: <20260324122052.342751-5-xukuohai@huaweicloud.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; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT On Tue, Mar 24, 2026 at 08:20:51PM +0800, Xu Kuohai wrote: >From: Xu Kuohai > >On CPUs that support CET/IBT, the indirect jump selftest triggers >a kernel panic because the indirect jump targets lack ENDBR >instructions. > >To fix it, emit an ENDBR instruction to each indirect jump target. Since >the ENDBR instruction shifts the position of original jited instructions, >fix the instruction address calculation wherever the addresses are used. > >For reference, below is a sample panic log. > > Missing ENDBR: bpf_prog_2e5f1c71c13ac3e0_big_jump_table+0x97/0xe1 > ------------[ cut here ]------------ > kernel BUG at arch/x86/kernel/cet.c:133! > Oops: invalid opcode: 0000 [#1] SMP NOPTI > > ... > > ? 0xffffffffc00fb258 > ? bpf_prog_2e5f1c71c13ac3e0_big_jump_table+0x97/0xe1 > bpf_prog_test_run_syscall+0x110/0x2f0 > ? fdget+0xba/0xe0 > __sys_bpf+0xe4b/0x2590 > ? __kmalloc_node_track_caller_noprof+0x1c7/0x680 > ? bpf_prog_test_run_syscall+0x215/0x2f0 > __x64_sys_bpf+0x21/0x30 > do_syscall_64+0x85/0x620 > ? bpf_prog_test_run_syscall+0x1e2/0x2f0 > >Fixes: 493d9e0d6083 ("bpf, x86: add support for indirect jumps") >Reviewed-by: Anton Protopopov >Signed-off-by: Xu Kuohai Acked-by: Leon Hwang [...]