On Tue, Nov 11, 2025 at 10:09 PM Marat Khalili <[email protected]> wrote: > > > -----Original Message----- > > From: Jerin Jacob <[email protected]> > > Sent: Tuesday 11 November 2025 16:31 > > To: Marat Khalili <[email protected]> > > Cc: Konstantin Ananyev <[email protected]>; Stephen Hemminger > > <[email protected]>; > > [email protected] > > Subject: Re: [PATCH 1/3] bpf: fix signed shift overflows in ARM JIT > > > > On Tue, Nov 11, 2025 at 3:40 PM Marat Khalili <[email protected]> > > wrote: > > > > > > > On Mon, Nov 10, 2025 at 9:01 PM Marat Khalili > > > > <[email protected]> wrote: > > > > > > > > > > Left shifts of integer literals and bool values overwriting the sign > > > > > bit > > > > > were used multiple times in bpf_jit_arm64.c. E.g.: > > > > > > > > > > insn = (!!is64) << 31; > > > > > > > > > > where is64 has type bool (double bang is a no-op here). The operand of > > > > > left shift was promoted to type int, which when 32-bit wide cannot > > > > > represent the result. Similarly literal integers have int type by > > > > > default. Sanitizer produced the following diagnostic during runtime > > > > > (for various lines): > > > > > > > > > > lib/bpf/bpf_jit_arm64.c:241:18: runtime error: left shift of 1 by > > > > > 31 > > > > > places cannot be represented in type 'int' > > > > > > > > Wonder why none of the tests in app/test/test_bpf.c able to catch > > > > this? The generated ARM opcode looks OK (otherwise tests wont pass). > > > > Could you check what is missing in the app/test/test_bpf.c? > > > > > > That tests do trigger it. > > > > > > RTE>>bpf_autotest > > > ../../src/lib/bpf/bpf_jit_arm64.c:320:18: runtime error: left shift of 1 > > > by 31 places cannot be > > represented in type 'int' > > > > This is when ASAN is enabled. Right? > > More likely UBSAN, but yes. > > > Is it really generating BAD > > opcode(i.e emiter generating bad OPcode) and test fails? > > If allowed to finish the test does not fail.
Does that mean, it is a false positive? Right? Anyway, There is no harm in the new patch, Change the patch to use SHIFT macros from EAL. > However, I have not compared DPDK or JIT compiled code with and without > changes.

