OSDN Git Service

bpf: Introduce BPF_PROG_TYPE_SK_REUSEPORT
[tomoyo/tomoyo-test1.git] / kernel / bpf / verifier.c
index 587468a..ca90679 100644 (file)
@@ -1310,6 +1310,7 @@ static bool may_access_direct_pkt_data(struct bpf_verifier_env *env,
        case BPF_PROG_TYPE_LWT_IN:
        case BPF_PROG_TYPE_LWT_OUT:
        case BPF_PROG_TYPE_LWT_SEG6LOCAL:
+       case BPF_PROG_TYPE_SK_REUSEPORT:
                /* dst_input() and dst_output() can't write for now */
                if (t == BPF_WRITE)
                        return false;
@@ -2166,6 +2167,10 @@ static int check_map_func_compatibility(struct bpf_verifier_env *env,
                    func_id != BPF_FUNC_msg_redirect_hash)
                        goto error;
                break;
+       case BPF_MAP_TYPE_REUSEPORT_SOCKARRAY:
+               if (func_id != BPF_FUNC_sk_select_reuseport)
+                       goto error;
+               break;
        default:
                break;
        }
@@ -2217,6 +2222,10 @@ static int check_map_func_compatibility(struct bpf_verifier_env *env,
                if (map->map_type != BPF_MAP_TYPE_CGROUP_STORAGE)
                        goto error;
                break;
+       case BPF_FUNC_sk_select_reuseport:
+               if (map->map_type != BPF_MAP_TYPE_REUSEPORT_SOCKARRAY)
+                       goto error;
+               break;
        default:
                break;
        }