android_kernel_oneplus_msm8998/include
Lorenzo Colitti 04ac0fa0d1 net: core: Add a UID field to struct sock.
Protocol sockets (struct sock) don't have UIDs, but most of the
time, they map 1:1 to userspace sockets (struct socket) which do.

Various operations such as the iptables xt_owner match need
access to the "UID of a socket", and do so by following the
backpointer to the struct socket. This involves taking
sk_callback_lock and doesn't work when there is no socket
because userspace has already called close().

Simplify this by adding a sk_uid field to struct sock whose value
matches the UID of the corresponding struct socket. The semantics
are as follows:

1. Whenever sk_socket is non-null: sk_uid is the same as the UID
   in sk_socket, i.e., matches the return value of sock_i_uid.
   Specifically, the UID is set when userspace calls socket(),
   fchown(), or accept().
2. When sk_socket is NULL, sk_uid is defined as follows:
   - For a socket that no longer has a sk_socket because
     userspace has called close(): the previous UID.
   - For a cloned socket (e.g., an incoming connection that is
     established but on which userspace has not yet called
     accept): the UID of the socket it was cloned from.
   - For a socket that has never had an sk_socket: UID 0 inside
     the user namespace corresponding to the network namespace
     the socket belongs to.

Kernel sockets created by sock_create_kern are a special case
of #1 and sk_uid is the user that created them. For kernel
sockets created at network namespace creation time, such as the
per-processor ICMP and TCP sockets, this is the user that created
the network namespace.

Bug: 16355602
Change-Id: Idbc3e9a0cec91c4c6e01916b967b6237645ebe59
Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-01-02 14:06:41 +05:30
..
acpi
asm-generic asm-generic: Fix local variable shadow in __set_fixmap_offset 2016-10-20 16:23:45 +08:00
clocksource arm64: KVM: Implement timer save/restore 2016-11-09 22:15:41 +08:00
crypto crypto: ghash-generic - move common definitions to a new header file 2016-10-22 12:26:56 +02:00
drm drm/prime: Pass the right module owner through to dma_buf_export() 2016-10-31 04:13:57 -06:00
dt-bindings
keys
kvm KVM: arm/arm64: vgic-v3: Make the LR indexing macro public 2016-11-09 22:15:40 +08:00
linux Merge branch 'linux-linaro-lsk-v4.4' into linux-linaro-lsk-v4.4-android 2016-12-20 13:48:11 +08:00
math-emu
media
memory
misc
net net: core: Add a UID field to struct sock. 2017-01-02 14:06:41 +05:30
pcmcia
ras
rdma
rxrpc
scsi
soc
sound
target target: Make EXTENDED_COPY 0xe4 failure return COPY TARGET DEVICE NOT REACHABLE 2016-10-28 03:01:36 -04:00
trace sched: fix wrong truncation of walt_avg 2017-01-02 13:54:08 +05:30
uapi Revert "net: core: Support UID-based routing." 2017-01-02 14:05:44 +05:30
video
xen
Kbuild