From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 26C494C9D for ; Mon, 17 Nov 2025 00:47:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763340431; cv=none; b=epjkuTCxSpiPRCHGZ5/y3Ey4jDZ2FsVmdJ02pblm2Jdd7OzwkjkOVIgz2r857DpCqg5JkqG52dKGgr2Wr8sGFeKFdW8Fll0TivhcI0ReTAbvWqmaS8a3eO8PBnqh1P7l9rV9p5pRuRnMbq+WIHaNaKUYMvhj62aGBGV8+ryS56o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763340431; c=relaxed/simple; bh=8+OxfMJRZukPSQDiqAaIH0jG1XyOdpSWU++IDXiOpps=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=e5CyiorN7EoiqQnyBFTK6YmELa1YbBrnUYzThD0UcS0I8DV9z9ZcmoJr0zBco4lDjGuwl28mUL3UZjzUBCA9klBwJjB/BnO9LdPos8tIzYLWV7cQl+3zVDQb5tF6E+5fsKOAbpVf1xI5OtlZY2/Ok/sw3UwND1b0LBxBSOXeRVg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TmjeNNR6; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="TmjeNNR6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 661DCC19422; Mon, 17 Nov 2025 00:47:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1763340427; bh=8+OxfMJRZukPSQDiqAaIH0jG1XyOdpSWU++IDXiOpps=; h=From:To:Cc:Subject:Date:From; b=TmjeNNR6Yh1zZofnGsKjR2HmSeO3i0zeL2/0uKAKNTvjJBelY/qzIrNTbcGHeffdt YO06dhCLka0fnyIkr7mXmT4goNoG+tN3JLTb8qvDltQb4tSwFTjzMZy5lAiXVq6XCb 7/+dNrEfaoZCbSdGq1zio6xgdZCD2ASzO9Is3vsRAg0EUaDQwSE8jaWbvyMbJS9GlJ t/p6fE0qgl6cSBG6jDWXCL5UQB34xzeHN9pHlGRrwzTWAnbakbA7Q8HStZvdRi00Sh /60Zk41fH4xBK/sxHhwQKmec5q8PJxE9H54dTCYQn1qjsn/GIP86f2jbrv+knVwHmJ Ygahhpdk5FcsA== From: Puranjay Mohan To: bpf@vger.kernel.org Cc: Puranjay Mohan , Puranjay Mohan , Alexei Starovoitov , Andrii Nakryiko , Daniel Borkmann , Martin KaFai Lau , Eduard Zingerman , Xu Kuohai , Catalin Marinas , Will Deacon , kernel-team@meta.com Subject: [PATCH bpf-next 0/4] bpf: arm64: Indirect jumps Date: Mon, 17 Nov 2025 00:46:35 +0000 Message-ID: <20251117004656.33292-1-puranjay@kernel.org> X-Mailer: git-send-email 2.47.3 Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This set adds the support of indirect jumps to the arm64 JIT. It involves calling bpf_prog_update_insn_ptrs() to support instructions array map. The second piece is supporting BPF_JMP|BPF_X|BPF_JA, SRC=0, DST=Rx, off=0, imm=0 instruction that is trivial to implement on arm64. When running the selftests after doing the above changes, I found that on arm64 builds of llvm, a relocation section was being generated for .jumptables sections and it was making libbpf fail like: libbpf: relocation against STT_SECTION in non-exec section is not supported! Error: failed to link 'tools/testing/selftests/bpf/cpuv4/bpf_gotox.bpf.o': Invalid argument (22) Which is due to: Relocation section '.rel.jumptables' at offset 0x5b50 contains 263 entries: Offset Info Type Symbol's Value Symbol's Name 0000000000000000 0000000300000002 R_BPF_64_ABS64 0000000000000000 syscall 0000000000000008 0000000300000002 R_BPF_64_ABS64 0000000000000000 syscall 0000000000000010 0000000300000002 R_BPF_64_ABS64 0000000000000000 syscall This rel section is not generated by x86 builds of LLVM. The third patch of this set makes libbpf ignore relocation sections for .jumptables. The final patch enables selftests on arm64: [root@localhost bpf]# ./test_progs-cpuv4 -a "*gotox*" #20/1 bpf_gotox/one-switch:OK #20/2 bpf_gotox/one-switch-non-zero-sec-offset:OK #20/3 bpf_gotox/two-switches:OK #20/4 bpf_gotox/big-jump-table:OK #20/5 bpf_gotox/static-global:OK #20/6 bpf_gotox/nonstatic-global:OK #20/7 bpf_gotox/other-sec:OK #20/8 bpf_gotox/static-global-other-sec:OK #20/9 bpf_gotox/nonstatic-global-other-sec:OK #20/10 bpf_gotox/one-jump-two-maps:OK #20/11 bpf_gotox/one-map-two-jumps:OK #20 bpf_gotox:OK #537/1 verifier_gotox/jump_table_ok:OK #537/2 verifier_gotox/jump_table_reserved_field_src_reg:OK #537/3 verifier_gotox/jump_table_reserved_field_non_zero_off:OK #537/4 verifier_gotox/jump_table_reserved_field_non_zero_imm:OK #537/5 verifier_gotox/jump_table_no_jump_table:OK #537/6 verifier_gotox/jump_table_incorrect_dst_reg_type:OK #537/7 verifier_gotox/jump_table_invalid_read_size_u32:OK #537/8 verifier_gotox/jump_table_invalid_read_size_u16:OK #537/9 verifier_gotox/jump_table_invalid_read_size_u8:OK #537/10 verifier_gotox/jump_table_misaligned_access:OK #537/11 verifier_gotox/jump_table_invalid_mem_acceess_pos:OK #537/12 verifier_gotox/jump_table_invalid_mem_acceess_neg:OK #537/13 verifier_gotox/jump_table_add_sub_ok:OK #537/14 verifier_gotox/jump_table_no_writes:OK #537/15 verifier_gotox/jump_table_use_reg_r0:OK #537/16 verifier_gotox/jump_table_use_reg_r1:OK #537/17 verifier_gotox/jump_table_use_reg_r2:OK #537/18 verifier_gotox/jump_table_use_reg_r3:OK #537/19 verifier_gotox/jump_table_use_reg_r4:OK #537/20 verifier_gotox/jump_table_use_reg_r5:OK #537/21 verifier_gotox/jump_table_use_reg_r6:OK #537/22 verifier_gotox/jump_table_use_reg_r7:OK #537/23 verifier_gotox/jump_table_use_reg_r8:OK #537/24 verifier_gotox/jump_table_use_reg_r9:OK #537/25 verifier_gotox/jump_table_outside_subprog:OK #537/26 verifier_gotox/jump_table_contains_non_unique_values:OK #537 verifier_gotox:OK Summary: 2/37 PASSED, 0 SKIPPED, 0 FAILED Puranjay Mohan (4): bpf: arm64: Add support for instructions array bpf: arm64: Add support for indirect jumps libbpf: Ignore relocations for .jumptables sections selftests: bpf: Enable gotox tests from arm64 arch/arm64/net/bpf_jit_comp.c | 11 +++++++++++ tools/lib/bpf/linker.c | 4 ++++ tools/testing/selftests/bpf/progs/verifier_gotox.c | 4 ++-- 3 files changed, 17 insertions(+), 2 deletions(-) -- 2.47.3