Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpf: Fix register equivalence tracking. #239

Closed
wants to merge 2 commits into from

Commits on Oct 14, 2020

  1. adding ci files

    kernel-patches-bot committed Oct 14, 2020
    Configuration menu
    Copy the full SHA
    ce1d0fd View commit details
    Browse the repository at this point in the history
  2. bpf: Fix register equivalence tracking.

    The 64-bit JEQ/JNE handling in reg_set_min_max() was clearing reg->id in either
    true or false branch. In the case 'if (reg->id)' check was done on the other
    branch the counter part register would have reg->id == 0 when called into
    find_equal_scalars(). In such case the helper would incorrectly identify other
    registers with id == 0 as equivalent and propagate the state incorrectly.
    Fix it by preserving ID across reg_set_min_max().
    In other words any kind of comparison operator on the scalar register
    should preserve its ID to recognize:
    r1 = r2
    if (r1 == 20) {
      #1 here both r1 and r2 == 20
    } else if (r2 < 20) {
      #2 here both r1 and r2 < 20
    }
    
    The patch is addressing #1 case. The #2 was working correctly already.
    
    Fixes: 7574883 ("bpf: Propagate scalar ranges through register assignments.")
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Alexei Starovoitov authored and kernel-patches-bot committed Oct 14, 2020
    Configuration menu
    Copy the full SHA
    371712c View commit details
    Browse the repository at this point in the history