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

datapath: Fix back-edge in bpf_sock for older kernels #11739

Merged
merged 1 commit into from May 28, 2020

Commits on May 28, 2020

  1. datapath: Fix back-edge in bpf_sock for older kernels

    The commit 4fa26a4 ("datapath: Enable sessionAffinity for older
    kernels") enabled the session affinity feature in bpf_sock when running
    on older kernels (e.g. 4.19.57). However, the feature was broken on such
    kernels due to the back-edge detected by the BPF verifier:
    
    msg="+ tc exec bpf pin /sys/fs/bpf/tc/globals/cilium_cgroups_connect6 obj
    bpf_sock.o type sockaddr attach_type connect6 sec connect6" subsys=datapath-loader
    subsys=datapath-loader
    msg="Prog section 'connect6' rejected: Invalid argument (22)!" subsys=datapath-loader
    msg=" - Type:         18" subsys=datapath-loader
    msg=" - Attach Type:  11" subsys=datapath-loader
    msg=" - Instructions: 740 (0 over limit)" subsys=datapath-loader
    msg=" - License:      GPL" subsys=datapath-loader
    subsys=datapath-loader
    msg="Verifier analysis:" subsys=datapath-loader
    subsys=datapath-loader
    msg="back-edge from insn 624 to 570" subsys=datapath-loader
    subsys=datapath-loader
    msg="Error fetching program/map!" subsys=datapath-loader
    
    This was happening, as in the backend reselection case (when a backend from
    affinity cannot be found) we goto to previous lines in the code.
    
    Fix it by immediately checking whether the backend from affinity exists.
    
    Fixes: 4fa26a4 ("datapath: Enable sessionAffinity for older kernels")
    Reported-by: Paul Chaignon <paul@cilium.io>
    Signed-off-by: Martynas Pumputis <m@lambda.lt>
    brb committed May 28, 2020
    Copy the full SHA
    2b5f3b2 View commit details
    Browse the repository at this point in the history