[3.19.y-ckt stable] Patch "arm64: bpf: fix signedness bug in loading 64-bit immediate" has been added to staging queue

Kamal Mostafa kamal at canonical.com
Tue Jun 16 00:22:02 UTC 2015


This is a note to let you know that I have just added a patch titled

    arm64: bpf: fix signedness bug in loading 64-bit immediate

to the linux-3.19.y-queue branch of the 3.19.y-ckt extended stable tree 
which can be found at:

    http://kernel.ubuntu.com/git/ubuntu/linux.git/log/?h=linux-3.19.y-queue

This patch is scheduled to be released in version 3.19.8-ckt2.

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.19.y-ckt tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Kamal

------

>From 25194d877d908daa1150dbcf6b65a1cc3b5e3ba2 Mon Sep 17 00:00:00 2001
From: Xi Wang <xi.wang at gmail.com>
Date: Fri, 8 May 2015 06:39:51 +0100
Subject: arm64: bpf: fix signedness bug in loading 64-bit immediate

commit 1e4df6b7208140f3c49f316d33a409d3a161f350 upstream.

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, which will be zero-extended to
u64 implicitly.

Cc: Zi Shen Lim <zlim.lnx at gmail.com>
Cc: Alexei Starovoitov <ast at plumgrid.com>
Cc: Catalin Marinas <catalin.marinas at arm.com>
Fixes: 30d3d94cc3d5 ("arm64: bpf: add 'load 64-bit immediate' instruction")
Signed-off-by: Xi Wang <xi.wang at gmail.com>
[will: removed non-arm64 bits and redundant casting]
Signed-off-by: Will Deacon <will.deacon at arm.com>
Signed-off-by: Kamal Mostafa <kamal at canonical.com>
---
 arch/arm64/net/bpf_jit_comp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c
index edba042..dc6a484 100644
--- a/arch/arm64/net/bpf_jit_comp.c
+++ b/arch/arm64/net/bpf_jit_comp.c
@@ -487,7 +487,7 @@ emit_cond_jmp:
 			return -EINVAL;
 		}

-		imm64 = (u64)insn1.imm << 32 | imm;
+		imm64 = (u64)insn1.imm << 32 | (u32)imm;
 		emit_a64_mov_i64(dst, imm64, ctx);

 		return 1;
--
1.9.1





More information about the kernel-team mailing list