linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bpf, x32: Fix regression caused by commit 24dea04767e6
@ 2018-07-25 16:46 Wang YanQing
  2018-07-25 16:58 ` Daniel Borkmann
  2018-07-28  7:23 ` mroos
  0 siblings, 2 replies; 3+ messages in thread
From: Wang YanQing @ 2018-07-25 16:46 UTC (permalink / raw)
  To: daniel
  Cc: ast, davem, illusionist.neo, tglx, mingo, hpa, x86, netdev,
	linux-kernel, arnd, mroos

Commit 24dea04767e6 ("bpf, x32: remove ld_abs/ld_ind")
removed the 4 /* Extra space for skb_copy_bits buffer */
from _STACK_SIZE, but it didn't fix the concerned code
in emit_prologue and emit_epilogue, and this error will
bring very strange kernel runtime errors.

This patch fix it.

Fixes: 24dea04767e6 ("bpf, x32: remove ld_abs/ld_ind")
Signed-off-by: Wang YanQing <udknight@gmail.com>
---
 arch/x86/net/bpf_jit_comp32.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/net/bpf_jit_comp32.c b/arch/x86/net/bpf_jit_comp32.c
index 5579987..8f6cc71 100644
--- a/arch/x86/net/bpf_jit_comp32.c
+++ b/arch/x86/net/bpf_jit_comp32.c
@@ -1441,8 +1441,8 @@ static void emit_prologue(u8 **pprog, u32 stack_depth)
 
 	/* sub esp,STACK_SIZE */
 	EMIT2_off32(0x81, 0xEC, STACK_SIZE);
-	/* sub ebp,SCRATCH_SIZE+4+12*/
-	EMIT3(0x83, add_1reg(0xE8, IA32_EBP), SCRATCH_SIZE + 16);
+	/* sub ebp,SCRATCH_SIZE+12*/
+	EMIT3(0x83, add_1reg(0xE8, IA32_EBP), SCRATCH_SIZE + 12);
 	/* xor ebx,ebx */
 	EMIT2(0x31, add_2reg(0xC0, IA32_EBX, IA32_EBX));
 
@@ -1475,8 +1475,8 @@ static void emit_epilogue(u8 **pprog, u32 stack_depth)
 	/* mov edx,dword ptr [ebp+off]*/
 	EMIT3(0x8B, add_2reg(0x40, IA32_EBP, IA32_EDX), STACK_VAR(r0[1]));
 
-	/* add ebp,SCRATCH_SIZE+4+12*/
-	EMIT3(0x83, add_1reg(0xC0, IA32_EBP), SCRATCH_SIZE + 16);
+	/* add ebp,SCRATCH_SIZE+12*/
+	EMIT3(0x83, add_1reg(0xC0, IA32_EBP), SCRATCH_SIZE + 12);
 
 	/* mov ebx,dword ptr [ebp-12]*/
 	EMIT3(0x8B, add_2reg(0x40, IA32_EBP, IA32_EBX), -12);
-- 
1.8.5.6.2.g3d8a54e.dirty

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] bpf, x32: Fix regression caused by commit 24dea04767e6
  2018-07-25 16:46 [PATCH] bpf, x32: Fix regression caused by commit 24dea04767e6 Wang YanQing
@ 2018-07-25 16:58 ` Daniel Borkmann
  2018-07-28  7:23 ` mroos
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Borkmann @ 2018-07-25 16:58 UTC (permalink / raw)
  To: Wang YanQing, ast, davem, illusionist.neo, tglx, mingo, hpa, x86,
	netdev, linux-kernel, arnd, mroos

On 07/25/2018 06:46 PM, Wang YanQing wrote:
> Commit 24dea04767e6 ("bpf, x32: remove ld_abs/ld_ind")
> removed the 4 /* Extra space for skb_copy_bits buffer */
> from _STACK_SIZE, but it didn't fix the concerned code
> in emit_prologue and emit_epilogue, and this error will
> bring very strange kernel runtime errors.
> 
> This patch fix it.
> 
> Fixes: 24dea04767e6 ("bpf, x32: remove ld_abs/ld_ind")
> Signed-off-by: Wang YanQing <udknight@gmail.com>

Applied, thanks Wang!

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] bpf, x32: Fix regression caused by commit 24dea04767e6
  2018-07-25 16:46 [PATCH] bpf, x32: Fix regression caused by commit 24dea04767e6 Wang YanQing
  2018-07-25 16:58 ` Daniel Borkmann
@ 2018-07-28  7:23 ` mroos
  1 sibling, 0 replies; 3+ messages in thread
From: mroos @ 2018-07-28  7:23 UTC (permalink / raw)
  To: Wang YanQing
  Cc: daniel, ast, davem, illusionist.neo, tglx, mingo, hpa, x86,
	netdev, Linux Kernel list, arnd

> Commit 24dea04767e6 ("bpf, x32: remove ld_abs/ld_ind")
> removed the 4 /* Extra space for skb_copy_bits buffer */
> from _STACK_SIZE, but it didn't fix the concerned code
> in emit_prologue and emit_epilogue, and this error will
> bring very strange kernel runtime errors.
> 
> This patch fix it.

For the record:

Tested it on top of 4.18.0-rc6-00192-g864af0d40cdc on the affected
machine and it worked.

-- 
Meelis Roos (mroos@linux.ee)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-07-28  7:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-25 16:46 [PATCH] bpf, x32: Fix regression caused by commit 24dea04767e6 Wang YanQing
2018-07-25 16:58 ` Daniel Borkmann
2018-07-28  7:23 ` mroos

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).