lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 24 Apr 2019 23:01:43 +0200
From:   Jann Horn <jannh@...gle.com>
To:     Stanislav Fomichev <sdf@...gle.com>
Cc:     Network Development <netdev@...r.kernel.org>, bpf@...r.kernel.org,
        "David S. Miller" <davem@...emloft.net>,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        jakub.kicinski@...ronome.com, quentin.monnet@...ronome.com
Subject: Re: [PATCH bpf-next v2 1/2] bpf: support BPF_PROG_QUERY for
 BPF_FLOW_DISSECTOR attach_type

On Wed, Apr 24, 2019 at 6:09 PM Stanislav Fomichev <sdf@...gle.com> wrote:
> target_fd is target namespace. If there is a flow dissector BPF program
> attached to that namespace, its (single) id is returned.
>
> v2:
> * don't sleep in rcu critical section (Jakub Kicinski)
> * check input prog_cnt (exit early)
>
> Signed-off-by: Stanislav Fomichev <sdf@...gle.com>
[...]
> +int skb_flow_dissector_prog_query(const union bpf_attr *attr,
> +                                 union bpf_attr __user *uattr)
> +{
[...]
> +       net = get_net_ns_by_fd(attr->query.target_fd);
> +       if (IS_ERR(net))
> +               return PTR_ERR(net);

At this point, you're holding a refcounted reference to `net`. It
looks like that reference is never dropped?

> +
> +       rcu_read_lock();
> +       attached = rcu_dereference(net->flow_dissector_prog);
> +       if (attached) {
> +               prog_cnt = 1;
> +               prog_id = attached->aux->id;
> +       }
> +       rcu_read_unlock();
> +
> +       if (copy_to_user(&uattr->query.attach_flags, &flags, sizeof(flags)))
> +               return -EFAULT;
[...]
> +}

Powered by blists - more mailing lists