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:   Sun, 12 Nov 2017 10:00:41 +0100
From:   Jiri Pirko <jiri@...nulli.us>
To:     Jakub Kicinski <jakub.kicinski@...ronome.com>
Cc:     netdev@...r.kernel.org, oss-drivers@...ronome.com,
        alexei.starovoitov@...il.com, daniel@...earbox.net
Subject: Re: [PATCH net-next v2 05/15] xdp: allow attaching programs loaded
 for specific device

Fri, Nov 03, 2017 at 09:56:20PM CET, jakub.kicinski@...ronome.com wrote:
>Pass the netdev pointer to bpf_prog_get_type().  This way
>BPF code can decide whether the device matches what the
>code was loaded/translated for.
>

[...]


>diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
>index 3217c20ea91b..68f9123acd39 100644
>--- a/kernel/bpf/syscall.c
>+++ b/kernel/bpf/syscall.c
>@@ -1057,7 +1057,22 @@ struct bpf_prog *bpf_prog_inc_not_zero(struct bpf_prog *prog)
> }
> EXPORT_SYMBOL_GPL(bpf_prog_inc_not_zero);
> 
>-static struct bpf_prog *__bpf_prog_get(u32 ufd, enum bpf_prog_type *attach_type)
>+static bool bpf_prog_can_attach(struct bpf_prog *prog,
>+				enum bpf_prog_type *attach_type,
>+				struct net_device *netdev)
>+{
>+	struct bpf_dev_offload *offload = prog->aux->offload;
>+
>+	if (prog->type != *attach_type)
>+		return false;
>+	if (offload && offload->netdev != netdev)

This means you return false in case netdev function arg is NULL. Is that
intentional?

Seems wrong to me because for example in cls_bpf_prog_from_efd, you
would get an error in case TCA_CLS_FLAGS_SKIP_SW is not set.




>+		return false;
>+
>+	return true;
>+}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ