[3.13.y-ckt stable] Patch "[3.13-stable only] Revert "ARM: net: delegate filter to kernel interpreter when imm_offset() return value can't fit into 12bits."" has been added to staging queue

Kamal Mostafa kamal at canonical.com
Mon Jul 6 23:52:44 UTC 2015


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

    [3.13-stable only] Revert "ARM: net: delegate filter to kernel interpreter when imm_offset() return value can't fit into 12bits."

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

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

This patch is scheduled to be released in version 3.13.11-ckt23.

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.13.y-ckt tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Kamal

------

>From b3b48543901b3654200ecd38934a58d87f36b066 Mon Sep 17 00:00:00 2001
From: Kamal Mostafa <kamal at canonical.com>
Date: Mon, 6 Jul 2015 16:49:26 -0700
Subject: [3.13-stable only] Revert "ARM: net: delegate filter to kernel
 interpreter when imm_offset() return value can't fit into 12bits."

This reverts commit a39d787c6d2df9850559923ffb7516f1011cf54e.

Not suitable for 3.13 (no bpf_jit_binary_free).

Cc: Brad Figg <brad.figg at canonical.com>
Signed-off-by: Kamal Mostafa <kamal at canonical.com>
---
 arch/arm/net/bpf_jit_32.c | 27 +--------------------------
 1 file changed, 1 insertion(+), 26 deletions(-)

diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c
index 5fad5e9..6adf591 100644
--- a/arch/arm/net/bpf_jit_32.c
+++ b/arch/arm/net/bpf_jit_32.c
@@ -54,7 +54,6 @@
 #define SEEN_DATA		(1 << (BPF_MEMWORDS + 3))

 #define FLAG_NEED_X_RESET	(1 << 0)
-#define FLAG_IMM_OVERFLOW	(1 << 1)

 struct jit_ctx {
 	const struct sk_filter *skf;
@@ -294,15 +293,6 @@ static u16 imm_offset(u32 k, struct jit_ctx *ctx)
 	/* PC in ARM mode == address of the instruction + 8 */
 	imm = offset - (8 + ctx->idx * 4);

-	if (imm & ~0xfff) {
-		/*
-		 * literal pool is too far, signal it into flags. we
-		 * can only detect it on the second pass unfortunately.
-		 */
-		ctx->flags |= FLAG_IMM_OVERFLOW;
-		return 0;
-	}
-
 	return imm;
 }

@@ -873,14 +863,6 @@ b_epilogue:
 		default:
 			return -1;
 		}
-
-		if (ctx->flags & FLAG_IMM_OVERFLOW)
-			/*
-			 * this instruction generated an overflow when
-			 * trying to access the literal pool, so
-			 * delegate this filter to the kernel interpreter.
-			 */
-			return -1;
 	}

 	/* compute offsets only during the first pass */
@@ -939,14 +921,7 @@ void bpf_jit_compile(struct sk_filter *fp)

 	ctx.idx = 0;
 	build_prologue(&ctx);
-	if (build_body(&ctx) < 0) {
-#if __LINUX_ARM_ARCH__ < 7
-		if (ctx.imm_count)
-			kfree(ctx.imms);
-#endif
-		bpf_jit_binary_free(header);
-		goto out;
-	}
+	build_body(&ctx);
 	build_epilogue(&ctx);

 	flush_icache_range((u32)ctx.target, (u32)(ctx.target + ctx.idx));
--
1.9.1





More information about the kernel-team mailing list