Commit c87ef24
bpf: Fix mask direction swap upon off reg sign change
commit bb01a1b upstream.
Masking direction as indicated via mask_to_left is considered to be
calculated once and then used to derive pointer limits. Thus, this
needs to be placed into bpf_sanitize_info instead so we can pass it
to sanitize_ptr_alu() call after the pointer move. Piotr noticed a
corner case where the off reg causes masking direction change which
then results in an incorrect final aux->alu_limit.
Fixes: 7fedb63 ("bpf: Tighten speculative pointer arithmetic mask")
Reported-by: Piotr Krysiuk <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
Reviewed-by: Piotr Krysiuk <[email protected]>
Acked-by: Alexei Starovoitov <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>1 parent 4e2c7b2 commit c87ef24
1 file changed
+12
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5666 | 5666 | | |
5667 | 5667 | | |
5668 | 5668 | | |
5669 | | - | |
5670 | | - | |
| 5669 | + | |
5671 | 5670 | | |
5672 | | - | |
5673 | | - | |
5674 | | - | |
5675 | 5671 | | |
5676 | 5672 | | |
5677 | | - | |
5678 | | - | |
5679 | | - | |
5680 | | - | |
5681 | 5673 | | |
5682 | 5674 | | |
5683 | 5675 | | |
| |||
5745 | 5737 | | |
5746 | 5738 | | |
5747 | 5739 | | |
| 5740 | + | |
5748 | 5741 | | |
5749 | 5742 | | |
5750 | 5743 | | |
| |||
5776 | 5769 | | |
5777 | 5770 | | |
5778 | 5771 | | |
5779 | | - | |
| 5772 | + | |
| 5773 | + | |
| 5774 | + | |
| 5775 | + | |
| 5776 | + | |
| 5777 | + | |
| 5778 | + | |
| 5779 | + | |
| 5780 | + | |
| 5781 | + | |
5780 | 5782 | | |
5781 | 5783 | | |
5782 | 5784 | | |
| |||
0 commit comments