alistair23-linux/include
Eric Dumazet 8d650cdeda tcp: fix tcp_set_congestion_control() use from bpf hook
Neal reported incorrect use of ns_capable() from bpf hook.

bpf_setsockopt(...TCP_CONGESTION...)
  -> tcp_set_congestion_control()
   -> ns_capable(sock_net(sk)->user_ns, CAP_NET_ADMIN)
    -> ns_capable_common()
     -> current_cred()
      -> rcu_dereference_protected(current->cred, 1)

Accessing 'current' in bpf context makes no sense, since packets
are processed from softirq context.

As Neal stated : The capability check in tcp_set_congestion_control()
was written assuming a system call context, and then was reused from
a BPF call site.

The fix is to add a new parameter to tcp_set_congestion_control(),
so that the ns_capable() call is only performed under the right
context.

Fixes: 91b5b21c7c ("bpf: Add support for changing congestion control")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Lawrence Brakmo <brakmo@fb.com>
Reported-by: Neal Cardwell <ncardwell@google.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Acked-by: Lawrence Brakmo <brakmo@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-07-18 20:33:48 -07:00
..
acpi It's been a relatively busy cycle for docs: 2019-07-09 12:34:26 -07:00
asm-generic asm-generic: remove ptrace.h 2019-07-12 15:41:33 -07:00
clocksource clocksource/drivers: Continue making Hyper-V clocksource ISA agnostic 2019-07-03 11:00:59 +02:00
crypto Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2019-07-08 20:57:08 -07:00
drm
dt-bindings Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2019-07-11 10:55:49 -07:00
keys request_key improvements 2019-07-08 19:19:37 -07:00
kvm KVM: arm/arm64: Support chained PMU counters 2019-07-05 13:56:22 +01:00
linux Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf 2019-07-18 14:04:45 -07:00
math-emu
media media updates for v5.3-rc1 2019-07-09 09:47:22 -07:00
memory
misc powerpc updates for 5.3 2019-07-13 16:08:36 -07:00
net tcp: fix tcp_set_congestion_control() use from bpf hook 2019-07-18 20:33:48 -07:00
pcmcia It's been a relatively busy cycle for docs: 2019-07-09 12:34:26 -07:00
ras
rdma
scsi SCSI misc on 20190709 2019-07-11 15:14:01 -07:00
soc
sound ASoC: Updates for v5.3 2019-07-08 14:45:34 +02:00
target
trace f2fs-for-5.3-rc1 2019-07-12 17:28:24 -07:00
uapi Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf 2019-07-18 14:04:45 -07:00
vdso
video fbdev changes for v5.3: 2019-07-09 09:55:45 -07:00
xen
Kbuild kbuild: compile-test kernel headers to ensure they are self-contained 2019-07-09 21:44:37 +09:00