Re: [PATCH] arm64: bpf: fix signedness bug in loading 64-bit immediate

2015-05-08 Thread Alexei Starovoitov
On 5/8/15 8:17 AM, Will Deacon wrote: Ok, I plan to apply the patch below for 4.1. great catch. Looks good to me. Xi, could you send a separate patch for test_bpf update to net-next? Thanks! -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to

Re: [PATCH] arm64: bpf: fix signedness bug in loading 64-bit immediate

2015-05-08 Thread Will Deacon
On Fri, May 08, 2015 at 09:45:59AM +0100, Xi Wang wrote: > On Fri, May 8, 2015 at 1:38 AM, Will Deacon wrote: > >> - imm64 = (u64)insn1.imm << 32 | imm; > >> + imm64 = ((u64)(u32)insn1.imm) << 32 | (u64)(u32)imm; > > > > This seems a bit convoluted to me. Don't you just nee

Re: [PATCH] arm64: bpf: fix signedness bug in loading 64-bit immediate

2015-05-08 Thread Xi Wang
On Fri, May 8, 2015 at 1:38 AM, Will Deacon wrote: >> - imm64 = (u64)insn1.imm << 32 | imm; >> + imm64 = ((u64)(u32)insn1.imm) << 32 | (u64)(u32)imm; > > This seems a bit convoluted to me. Don't you just need to add a (u32) > cast to imm and that's it? The (u64)(u32) looks

Re: [PATCH] arm64: bpf: fix signedness bug in loading 64-bit immediate

2015-05-08 Thread Will Deacon
On Fri, May 08, 2015 at 06:39:51AM +0100, Xi Wang wrote: > Consider "(u64)insn1.imm << 32 | imm" in the arm64 JIT. Since imm is > signed 32-bit, it is sign-extended to 64-bit, losing the high 32 bits. > The fix is to convert imm to u32 first and zero-extend it to u64. > > Also extend test_bpf to