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

Update 5.4-2.3.x-imx up to v5.4.116 #325

Merged
merged 10 commits into from
May 2, 2021

Commits on May 2, 2021

  1. bpf: Move off_reg into sanitize_ptr_alu

    commit 6f55b2f upstream.
    
    Small refactor to drag off_reg into sanitize_ptr_alu(), so we later on can
    use off_reg for generalizing some of the checks for all pointer types.
    
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Reviewed-by: John Fastabend <john.fastabend@gmail.com>
    Acked-by: Alexei Starovoitov <ast@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    borkmann authored and gregkh committed May 2, 2021
    Configuration menu
    Copy the full SHA
    4a163b1 View commit details
    Browse the repository at this point in the history
  2. bpf: Ensure off_reg has no mixed signed bounds for all types

    commit 24c109b upstream.
    
    The mixed signed bounds check really belongs into retrieve_ptr_limit()
    instead of outside of it in adjust_ptr_min_max_vals(). The reason is
    that this check is not tied to PTR_TO_MAP_VALUE only, but to all pointer
    types that we handle in retrieve_ptr_limit() and given errors from the latter
    propagate back to adjust_ptr_min_max_vals() and lead to rejection of the
    program, it's a better place to reside to avoid anything slipping through
    for future types. The reason why we must reject such off_reg is that we
    otherwise would not be able to derive a mask, see details in 9d7ecee
    ("bpf: restrict unknown scalars of mixed signed bounds for unprivileged").
    
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Reviewed-by: John Fastabend <john.fastabend@gmail.com>
    Acked-by: Alexei Starovoitov <ast@kernel.org>
    [fllinden@amazon.com: backport to 5.4]
    Signed-off-by: Frank van der Linden <fllinden@amazon.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    borkmann authored and gregkh committed May 2, 2021
    Configuration menu
    Copy the full SHA
    f7fbedc View commit details
    Browse the repository at this point in the history
  3. bpf: Rework ptr_limit into alu_limit and add common error path

    commit b658bbb upstream.
    
    Small refactor with no semantic changes in order to consolidate the max
    ptr_limit boundary check.
    
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Reviewed-by: John Fastabend <john.fastabend@gmail.com>
    Acked-by: Alexei Starovoitov <ast@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    borkmann authored and gregkh committed May 2, 2021
    Configuration menu
    Copy the full SHA
    15de0c5 View commit details
    Browse the repository at this point in the history
  4. bpf: Improve verifier error messages for users

    commit a6aaece upstream.
    
    Consolidate all error handling and provide more user-friendly error messages
    from sanitize_ptr_alu() and sanitize_val_alu().
    
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Reviewed-by: John Fastabend <john.fastabend@gmail.com>
    Acked-by: Alexei Starovoitov <ast@kernel.org>
    [fllinden@amazon.com: backport to 5.4]
    Signed-off-by: Frank van der Linden <fllinden@amazon.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    borkmann authored and gregkh committed May 2, 2021
    Configuration menu
    Copy the full SHA
    4158e5f View commit details
    Browse the repository at this point in the history
  5. bpf: Refactor and streamline bounds check into helper

    commit 073815b upstream.
    
    Move the bounds check in adjust_ptr_min_max_vals() into a small helper named
    sanitize_check_bounds() in order to simplify the former a bit.
    
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Reviewed-by: John Fastabend <john.fastabend@gmail.com>
    Acked-by: Alexei Starovoitov <ast@kernel.org>
    [fllinden@amazon.com: backport to 5.4]
    Signed-off-by: Frank van der Linden <fllinden@amazon.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    borkmann authored and gregkh committed May 2, 2021
    Configuration menu
    Copy the full SHA
    876d1ce View commit details
    Browse the repository at this point in the history
  6. bpf: Move sanitize_val_alu out of op switch

    commit f528819 upstream.
    
    Add a small sanitize_needed() helper function and move sanitize_val_alu()
    out of the main opcode switch. In upcoming work, we'll move sanitize_ptr_alu()
    as well out of its opcode switch so this helps to streamline both.
    
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Reviewed-by: John Fastabend <john.fastabend@gmail.com>
    Acked-by: Alexei Starovoitov <ast@kernel.org>
    [fllinden@amazon.com: backported to 5.4]
    Signed-off-by: Frank van der Linden <fllinden@amazon.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    borkmann authored and gregkh committed May 2, 2021
    Configuration menu
    Copy the full SHA
    4dc6e55 View commit details
    Browse the repository at this point in the history
  7. bpf: Tighten speculative pointer arithmetic mask

    commit 7fedb63 upstream.
    
    This work tightens the offset mask we use for unprivileged pointer arithmetic
    in order to mitigate a corner case reported by Piotr and Benedict where in
    the speculative domain it is possible to advance, for example, the map value
    pointer by up to value_size-1 out-of-bounds in order to leak kernel memory
    via side-channel to user space.
    
    Before this change, the computed ptr_limit for retrieve_ptr_limit() helper
    represents largest valid distance when moving pointer to the right or left
    which is then fed as aux->alu_limit to generate masking instructions against
    the offset register. After the change, the derived aux->alu_limit represents
    the largest potential value of the offset register which we mask against which
    is just a narrower subset of the former limit.
    
    For minimal complexity, we call sanitize_ptr_alu() from 2 observation points
    in adjust_ptr_min_max_vals(), that is, before and after the simulated alu
    operation. In the first step, we retieve the alu_state and alu_limit before
    the operation as well as we branch-off a verifier path and push it to the
    verification stack as we did before which checks the dst_reg under truncation,
    in other words, when the speculative domain would attempt to move the pointer
    out-of-bounds.
    
    In the second step, we retrieve the new alu_limit and calculate the absolute
    distance between both. Moreover, we commit the alu_state and final alu_limit
    via update_alu_sanitation_state() to the env's instruction aux data, and bail
    out from there if there is a mismatch due to coming from different verification
    paths with different states.
    
    Reported-by: Piotr Krysiuk <piotras@gmail.com>
    Reported-by: Benedict Schlueter <benedict.schlueter@rub.de>
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Reviewed-by: John Fastabend <john.fastabend@gmail.com>
    Acked-by: Alexei Starovoitov <ast@kernel.org>
    Tested-by: Benedict Schlueter <benedict.schlueter@rub.de>
    [fllinden@amazon.com: backported to 5.4]
    Signed-off-by: Frank van der Linden <fllinden@amazon.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    borkmann authored and gregkh committed May 2, 2021
    Configuration menu
    Copy the full SHA
    ef4e68f View commit details
    Browse the repository at this point in the history
  8. bpf: Update selftests to reflect new error states

    commit d7a5091 upstream.
    
    Update various selftest error messages:
    
     * The 'Rx tried to sub from different maps, paths, or prohibited types'
       is reworked into more specific/differentiated error messages for better
       guidance.
    
     * The change into 'value -4294967168 makes map_value pointer be out of
       bounds' is due to moving the mixed bounds check into the speculation
       handling and thus occuring slightly later than above mentioned sanity
       check.
    
     * The change into 'math between map_value pointer and register with
       unbounded min value' is similarly due to register sanity check coming
       before the mixed bounds check.
    
     * The case of 'map access: known scalar += value_ptr from different maps'
       now loads fine given masks are the same from the different paths (despite
       max map value size being different).
    
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Reviewed-by: John Fastabend <john.fastabend@gmail.com>
    Acked-by: Alexei Starovoitov <ast@kernel.org>
    [fllinden@amazon - skip bounds.c test mods, they won't change error msg on 5.4]
    Signed-off-by: Frank van der Linden <fllinden@amazon.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    borkmann authored and gregkh committed May 2, 2021
    Configuration menu
    Copy the full SHA
    e23967a View commit details
    Browse the repository at this point in the history
  9. Linux 5.4.116

    Tested-by: Fox Chen <foxhlchen@gmail.com>
    Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
    Tested-by: Jon Hunter <jonathanh@nvidia.com>
    Tested-by: Guenter Roeck <linux@roeck-us.net>
    Link: https://lore.kernel.org/r/20210430141910.899518186@linuxfoundation.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    gregkh committed May 2, 2021
    Configuration menu
    Copy the full SHA
    370636f View commit details
    Browse the repository at this point in the history
  10. Merge tag 'v5.4.116' into 5.4-2.3.x-imx

    This is the 5.4.116 stable release
    
    Signed-off-by: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>
    zandrey committed May 2, 2021
    Configuration menu
    Copy the full SHA
    2f748db View commit details
    Browse the repository at this point in the history