netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ma Xinjian <max.xinjian@intel.com>
To: john.fastabend@gmail.com, alexei.starovoitov@gmail.com,
	bpf@vger.kernel.org, daniel@iogearbox.net, ecree@solarflare.com,
	netdev@vger.kernel.org, yhs@fb.com
Subject: Re: [bpf-next PATCH 03/10] bpf: verifer, adjust_scalar_min_max_vals to always call update_reg_bounds()
Date: Mon, 27 Apr 2020 14:35:34 +0800	[thread overview]
Message-ID: <072ad6df-9136-bfb9-e260-f6003e7d8777@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 3374 bytes --]

Hi, John.


During our test, we noticed this commit not only cause test_verifier error

"bpf: test_verifier, #70 error message updates for 32-bit right shift"

But also cause test_align error:

```

"Test   9: dubious pointer arithmetic ... Failed to find match 7: 
R5_w=inv(id=0,var_off=(0x2; 0xfffffffffffffffc))"

"Test  10: variable subtraction ... Failed to find match 12: 
R6=inv(id=0,smin_value=-1006,smax_value=1034,var_off=(0x2; 
0xfffffffffffffffc))"

```

clang/llvm version: 11.0.0


Whole error message please refer to  the attachment.

part of error info:

```

# Test   9: dubious pointer arithmetic ... Failed to find match 7: 
R5_w=inv(id=0,var_off=(0x2; 0xfffffffffffffffc))
# func#0 @0
# 0: R1=ctx(id=0,off=0,imm=0) R10=fp0
# 0: (61) r2 = *(u32 *)(r1 +76)
# 1: R1=ctx(id=0,off=0,imm=0) R2_w=pkt(id=0,off=0,r=0,imm=0) R10=fp0
# 1: (61) r3 = *(u32 *)(r1 +80)
# 2: R1=ctx(id=0,off=0,imm=0) R2_w=pkt(id=0,off=0,r=0,imm=0) 
R3_w=pkt_end(id=0,off=0,imm=0) R10=fp0
# 2: (b7) r0 = 0
# 3: R0_w=inv0 R1=ctx(id=0,off=0,imm=0) R2_w=pkt(id=0,off=0,r=0,imm=0) 
R3_w=pkt_end(id=0,off=0,imm=0) R10=fp0
# 3: (bf) r5 = r3
# 4: R0_w=inv0 R1=ctx(id=0,off=0,imm=0) R2_w=pkt(id=0,off=0,r=0,imm=0) 
R3_w=pkt_end(id=0,off=0,imm=0) R5_w=pkt_end(id=0,off=0,imm=0) R10=fp0
# 4: (1f) r5 -= r2
# 5: R0_w=inv0 R1=ctx(id=0,off=0,imm=0) R2_w=pkt(id=0,off=0,r=0,imm=0) 
R3_w=pkt_end(id=0,off=0,imm=0) R5_w=inv(id=0) R10=fp0
# 5: (67) r5 <<= 2
# 6: R0_w=inv0 R1=ctx(id=0,off=0,imm=0) R2_w=pkt(id=0,off=0,r=0,imm=0) 
R3_w=pkt_end(id=0,off=0,imm=0) 
R5_w=inv(id=0,smax_value=9223372036854775804,umax_value=18446744073709551612,var_off=(0x0; 
0xfffffffffffffffc)) R10=fp0
# 6: (07) r5 += 14
[snip]

# 15: (61) r4 = *(u32 *)(r6 +0)
# invalid access to packet, off=0 size=4, R6(id=1,off=0,r=0)
# R6 offset is outside of the packet
# processed 16 insns (limit 1000000) max_states_per_insn 0 total_states 
1 peak_states 1 mark_read 1
# FAIL
# Test  10: variable subtraction ... Failed to find match 12: 
R6=inv(id=0,smin_value=-1006,smax_value=1034,var_off=(0x2; 
0xfffffffffffffffc))
# func#0 @0
# 0: R1=ctx(id=0,off=0,imm=0) R10=fp0
# 0: (61) r2 = *(u32 *)(r1 +76)
# 1: R1=ctx(id=0,off=0,imm=0) R2_w=pkt(id=0,off=0,r=0,imm=0) R10=fp0
# 1: (61) r3 = *(u32 *)(r1 +80)
# 2: R1=ctx(id=0,off=0,imm=0) R2_w=pkt(id=0,off=0,r=0,imm=0) 
R3_w=pkt_end(id=0,off=0,imm=0) R10=fp0
# 2: (bf) r0 = r2
# 3: R0_w=pkt(id=0,off=0,r=0,imm=0) R1=ctx(id=0,off=0,imm=0) 
R2_w=pkt(id=0,off=0,r=0,imm=0) R3_w=pkt_end(id=0,off=0,imm=0) R10=fp0
# 3: (07) r0 += 8
# 4: R0_w=pkt(id=0,off=8,r=0,imm=0) R1=ctx(id=0,off=0,imm=0) 
R2_w=pkt(id=0,off=0,r=0,imm=0) R3_w=pkt_end(id=0,off=0,imm=0) R10=fp0
# 4: (3d) if r3 >= r0 goto pc+1
#  R0_w=pkt(id=0,off=8,r=0,imm=0) R1=ctx(id=0,off=0,imm=0) 
R2_w=pkt(id=0,off=0,r=0,imm=0) R3_w=pkt_end(id=0,off=0,imm=0) R10=fp0
# 5: R0_w=pkt(id=0,off=8,r=0,imm=0) R1=ctx(id=0,off=0,imm=0) 
R2_w=pkt(id=0,off=0,r=0,imm=0) R3_w=pkt_end(id=0,off=0,imm=0) R10=fp0
# 5: (95) exit
# 6: R0_w=pkt(id=0,off=8,r=8,imm=0) R1=ctx(id=0,off=0,imm=0) 
R2_w=pkt(id=0,off=0,r=8,imm=0) R3_w=pkt_end(id=0,off=0,imm=0) R10=fp0
# 6: (71) r6 = *(u8 *)(r2 +0)
# 7: R0_w=pkt(id=0,off=8,r=8,imm=0) R1=ctx(id=0,off=0,imm=0) 
R2_w=pkt(id=0,off=0,r=8,imm=0) R3_w=pkt_end(id=0,off=0,imm=0) 
R6_w=inv(id=0,umax_value=255,var_off=(0x0; 0xff)) R10=fp0
# 7: (bf) r7 = r6
[snip]

```

---
Best Regards.
Ma Xinjian






[-- Attachment #2: bpf_test_align_log.gz --]
[-- Type: application/gzip, Size: 1503 bytes --]

             reply	other threads:[~2020-04-27  6:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-27  6:35 Ma Xinjian [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-03-24 17:37 [bpf-next PATCH 00/10] ALU32 bounds tracking support John Fastabend
2020-03-24 17:38 ` [bpf-next PATCH 03/10] bpf: verifer, adjust_scalar_min_max_vals to always call update_reg_bounds() John Fastabend

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=072ad6df-9136-bfb9-e260-f6003e7d8777@intel.com \
    --to=max.xinjian@intel.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=ecree@solarflare.com \
    --cc=john.fastabend@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).