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]
Message-ID: <737b6f8a-78a2-71f1-cd31-6d1b5e4223d2@fb.com>
Date:   Fri, 10 Nov 2017 09:43:28 +0900
From:   Alexei Starovoitov <ast@...com>
To:     Vlad Dumitrescu <vlad@...itrescu.ro>, <davem@...emloft.net>,
        <daniel@...earbox.net>, <brakmo@...com>
CC:     <netdev@...r.kernel.org>, <kraigatgoog@...il.com>
Subject: Re: [PATCH net-next] bpf: add support for SO_PRIORITY in
 bpf_getsockopt

On 11/10/17 8:04 AM, Vlad Dumitrescu wrote:
> From: Vlad Dumitrescu <vladum@...gle.com>
>
> Allows BPF_PROG_TYPE_SOCK_OPS programs to read sk_priority.
>
> Signed-off-by: Vlad Dumitrescu <vladum@...gle.com>
> ---
>  net/core/filter.c | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/net/core/filter.c b/net/core/filter.c
> index 1afa17935954..61c791f9f628 100644
> --- a/net/core/filter.c
> +++ b/net/core/filter.c
> @@ -3292,8 +3292,20 @@ BPF_CALL_5(bpf_getsockopt, struct bpf_sock_ops_kern *, bpf_sock,
>  	if (!sk_fullsock(sk))
>  		goto err_clear;
>
> +	if (level == SOL_SOCKET) {
> +		if (optlen != sizeof(int))
> +			goto err_clear;
> +
> +		switch (optname) {
> +		case SO_PRIORITY:
> +			*((int *)optval) = sk->sk_priority;

would be cleaner to add sk_priority to 'struct bpf_sock_ops' instead.
Faster runtime too.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ