Re: [PATCH] BPF : arch/x86/net/bpf_jit_comp.c : fix wrong condition code in jit compiler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 9/25/24 10:23 AM, zyf wrote:
change 'case BPF_ALU64 | BPF_END | BPF_FROM_LE' to 'case BPF_ALU64 | BPF_END | BPF_FROM_BE'

Signed-off-by: zyf <zhouyangfan20s@xxxxxxxxx>
---
  arch/x86/net/bpf_jit_comp.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c
index 06b080b61aa5..7f954d76b3a6 100644
--- a/arch/x86/net/bpf_jit_comp.c
+++ b/arch/x86/net/bpf_jit_comp.c
@@ -1786,7 +1786,7 @@ static int do_jit(struct bpf_prog *bpf_prog, int *addrs, u8 *image, u8 *rw_image
  			break;
case BPF_ALU | BPF_END | BPF_FROM_BE:
-		case BPF_ALU64 | BPF_END | BPF_FROM_LE:
+		case BPF_ALU64 | BPF_END | BPF_FROM_BE:
  			switch (imm32) {
  			case 16:
  				/* Emit 'ror %ax, 8' to swap lower 2 bytes */
Please elaborate on the exact issue you've encountered. Right now it looks
like you did this change just based on code review but not based on a real
world bug?

BPF_ALU64 | BPF_END | BPF_FROM_LE instruction is unconditonal swap,
see also commit 0845c3db7bf5c4ceb ("bpf: Support new unconditional bswap instruction").
As it stands your change additionally breaks BPF selftests.




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux