[PATCH v2 3/3] net/ipv6/udp_tunnel: prefer SO_BINDTOIFINDEX over SO_BINDTODEVICE

2019-01-15 Thread David Herrmann
The udp-tunnel setup allows binding sockets to a network device. Prefer the new SO_BINDTOIFINDEX to avoid temporarily resolving the device-name just to look it up in the ioctl again. Reviewed-by: Tom Gundersen Signed-off-by: David Herrmann --- v2: - Rename to SO_BINDTOIFINDEX from SO_BINDTOIF

[PATCH v2 1/3] net: introduce SO_BINDTOIFINDEX sockopt

2019-01-15 Thread David Herrmann
depend on the name and can run network setup of dormant devices in parallel to the transition off the initrd. The SO_BINDTOIFINDEX ioctl plugs this race. Reviewed-by: Tom Gundersen Signed-off-by: David Herrmann --- v2: - Rename to SO_BINDTOIFINDEX from SO_BINDTOIF - skip 0x0040 SO-value on sparc

[PATCH v2 2/3] net/ipv4/udp_tunnel: prefer SO_BINDTOIFINDEX over SO_BINDTODEVICE

2019-01-15 Thread David Herrmann
The udp-tunnel setup allows binding sockets to a network device. Prefer the new SO_BINDTOIFINDEX to avoid temporarily resolving the device-name just to look it up in the ioctl again. Reviewed-by: Tom Gundersen Signed-off-by: David Herrmann --- v2: - Rename to SO_BINDTOIFINDEX from SO_BINDTOIF

Re: [PATCH 1/3] net: introduce SO_BINDTOIF sockopt

2019-01-10 Thread David Herrmann
Hi On Thu, Jan 10, 2019 at 5:38 PM David Ahern wrote: > > On 1/10/19 7:25 AM, David Herrmann wrote: > > This introduces a new generic SOL_SOCKET-level socket option called > > SO_BINDTOIF. It behaves similar to SO_BINDTODEVICE, but takes a network > > interface index as a

[PATCH 3/3] net/ipv6/udp_tunnel: prefer SO_BINDTOIF over SO_BINDTODEVICE

2019-01-10 Thread David Herrmann
The udp-tunnel setup allows binding sockets to a network device. Prefer the new SO_BINDTOIF to avoid temporarily resolving the device-name just to look it up in the ioctl again. Signed-off-by: David Herrmann --- net/ipv6/ip6_udp_tunnel.c | 15 +++ 1 file changed, 3 insertions(+), 12

[PATCH 1/3] net: introduce SO_BINDTOIF sockopt

2019-01-10 Thread David Herrmann
on the name and can run network setup of dormant devices in parallel to the transition off the initrd. The SO_BINDTOIF ioctl plugs this race. Signed-off-by: David Herrmann --- arch/alpha/include/uapi/asm/socket.h | 2 ++ arch/ia64/include/uapi/asm/socket.h | 2 ++ arch/mips/include/uapi/asm

[PATCH 2/3] net/ipv4/udp_tunnel: prefer SO_BINDTOIF over SO_BINDTODEVICE

2019-01-10 Thread David Herrmann
The udp-tunnel setup allows binding sockets to a network device. Prefer the new SO_BINDTOIF to avoid temporarily resolving the device-name just to look it up in the ioctl again. Signed-off-by: David Herrmann --- net/ipv4/udp_tunnel.c | 15 +++ 1 file changed, 3 insertions(+), 12

[PATCH v2 0/4] Introduce LSM-hook for socketpair(2)

2018-05-04 Thread David Herrmann
://www.spinics.net/lists/selinux/msg22674.html David Herrmann (3): security: add hook for socketpair() net: hook socketpair() into LSM selinux: provide socketpair callback Tom Gundersen (1): smack: provide socketpair callback include/linux/lsm_hooks.h | 7 +++ include/linux

[PATCH v2 3/4] selinux: provide socketpair callback

2018-05-04 Thread David Herrmann
Make sure to implement the new socketpair callback so the SO_PEERSEC call on socketpair(2)s will return correct information. Acked-by: Serge Hallyn Acked-by: Stephen Smalley Signed-off-by: Tom Gundersen Signed-off-by: David Herrmann --- security/selinux/hooks.c | 13 + 1 file

[PATCH v2 1/4] security: add hook for socketpair()

2018-05-04 Thread David Herrmann
igned-off-by: David Herrmann --- include/linux/lsm_hooks.h | 7 +++ include/linux/security.h | 7 +++ security/security.c | 6 ++ 3 files changed, 20 insertions(+) diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h index 9d0b286f3dba..8f1131c8dd54 100644 --- a/in

[PATCH v2 4/4] smack: provide socketpair callback

2018-05-04 Thread David Herrmann
From: Tom Gundersen Make sure to implement the new socketpair callback so the SO_PEERSEC call on socketpair(2)s will return correct information. Signed-off-by: Tom Gundersen Signed-off-by: David Herrmann --- security/smack/smack_lsm.c | 22 ++ 1 file changed, 22

[PATCH v2 2/4] net: hook socketpair() into LSM

2018-05-04 Thread David Herrmann
Use the newly created LSM-hook for socketpair(). The default hook return-value is 0, so behavior stays the same unless LSMs start using this hook. Acked-by: Serge Hallyn Signed-off-by: Tom Gundersen Signed-off-by: David Herrmann --- net/socket.c | 7 +++ 1 file changed, 7 insertions

Re: [PATCH 0/3] Introduce LSM-hook for socketpair(2)

2018-05-04 Thread David Herrmann
Hey On Wed, Apr 25, 2018 at 9:02 PM, James Morris wrote: > On Wed, 25 Apr 2018, Paul Moore wrote: > >> On Wed, Apr 25, 2018 at 2:44 PM, James Morris wrote: >> > On Mon, 23 Apr 2018, David Herrmann wrote: >> >> This patch series tries to close this gap and makes

[PATCH 0/3] Introduce LSM-hook for socketpair(2)

2018-04-23 Thread David Herrmann
/master/src/util/test-peersec.c [2] https://www.spinics.net/lists/selinux/msg22674.html David Herrmann (3): security: add hook for socketpair(AF_UNIX, ...) net/unix: hook unix_socketpair() into LSM selinux: provide unix_stream_socketpair callback include/linux/lsm_hooks.h | 8

[PATCH 3/3] selinux: provide unix_stream_socketpair callback

2018-04-23 Thread David Herrmann
Make sure to implement the new unix_stream_socketpair callback so the SO_PEERSEC call on socketpair(2)s will return correct information. Signed-off-by: David Herrmann --- security/selinux/hooks.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/security/selinux/hooks.c b

[PATCH 1/3] security: add hook for socketpair(AF_UNIX, ...)

2018-04-23 Thread David Herrmann
is is unexpected and makes socketpair() less useful in situations where the security context is crucial to the application. With the new socketpair-hook this disparity can be solved by making socketpair() return the expected security context. Signed-off-by: David Herrmann --- include/linux/lsm_ho

[PATCH 2/3] net/unix: hook unix_socketpair() into LSM

2018-04-23 Thread David Herrmann
Use the newly created LSM-hook for unix_socketpair(). The default hook return-value is 0, so behavior stays the same unless LSMs start using this hook. Signed-off-by: David Herrmann --- net/unix/af_unix.c | 5 + 1 file changed, 5 insertions(+) diff --git a/net/unix/af_unix.c b/net/unix

[PATCH] net/unix: drop obsolete fd-recursion limits

2017-07-17 Thread David Herrmann
with ETOOMANYREFS if a client maliciously modifies the FD while inflight. Cc: Alban Crequy Cc: Simon McVittie Signed-off-by: David Herrmann --- include/net/af_unix.h | 1 - net/unix/af_unix.c| 24 +--- 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/inc

[PATCH v2] net: introduce SO_PEERGROUPS getsockopt

2017-06-21 Thread David Herrmann
ccess-management based on groups) work without resorting to the user/group database. This new SO_PEERGROUPS ioctl would allow us to make dbus-daemon work without ever calling into NSS. Cc: Michal Sekletar Cc: Simon McVittie Reviewed-by: Tom Gundersen Signed-off-by: David Herrmann --- v2: - rebase o

[PATCH] net: introduce SO_PEERGROUPS getsockopt

2017-06-16 Thread David Herrmann
ccess-management based on groups) work without resorting to the user/group database. This new SO_PEERGROUPS ioctl would allow us to make dbus-daemon work without ever calling into NSS. Cc: Michal Sekletar Cc: Simon McVittie Cc: Tom Gundersen Signed-off-by: David Herrmann --- arch/alpha/include/uap

Re: [PATCH v3 1/2] bpf: add a longest prefix match trie map implementation

2017-01-18 Thread David Herrmann
Hi On Sat, Jan 14, 2017 at 5:55 PM, Alexei Starovoitov wrote: > Another alternative is to extend samples/bpf/map_perf_test > It has perf tests for most map types today (including lru) > and trie would be natural addition there. > I would prefer this latter option. I hooked into gettid() and inst

Re: [PATCH v2] unix: properly account for FDs passed over unix sockets

2016-02-03 Thread David Herrmann
Hi On Wed, Feb 3, 2016 at 12:36 PM, Simon McVittie wrote: > Am I right in saying that the advice I give to D-Bus users should be > something like this? > > * system services should not send fds at all, unless they trust the > dbus-daemon > * system services should not send fds via D-Bus that wi

Re: [PATCH v2] unix: properly account for FDs passed over unix sockets

2016-02-02 Thread David Herrmann
Hi On Sun, Jan 10, 2016 at 7:54 AM, Willy Tarreau wrote: > It is possible for a process to allocate and accumulate far more FDs than > the process' limit by sending them over a unix socket then closing them > to keep the process' fd count low. > > This change addresses this problem by keeping tra

[PATCH] net: drop write-only stack variable

2016-02-02 Thread David Herrmann
Signed-off-by: David Herrmann --- net/unix/af_unix.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index c5bf5ef..9f88193 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -1534,7 +1534,6 @@ static int unix_attach_fds(struct

Re: [patch] netlink: fix a limit in NETLINK_LIST_MEMBERSHIPS

2015-11-13 Thread David Herrmann
Hi On Fri, Nov 13, 2015 at 3:20 PM, Dan Carpenter wrote: > This condition doesn't work when len is smaller than expected and not a > multiple of 4. In that situation "len - pos" is negative and type > promoted to a high unsigned value and we do not break out of the loop. > It causes the program

[PATCH] netlink: fix locking around NETLINK_LIST_MEMBERSHIPS

2015-10-21 Thread David Herrmann
below handle_mm_fault(). Fix this by reducing locking of NETLINK_LIST_MEMBERSHIPS to a read-side lock. The write-lock was overkill in the first place, and the read-lock allows page-faults just fine. Cc: # 4.2+ Reported-by: Dmitry Vyukov Signed-off-by: David Herrmann --- net/netlink

[PATCH v2] netlink: add API to retrieve all group memberships

2015-06-17 Thread David Herrmann
-space can retry with a properly sized array in case it was too small. Signed-off-by: David Herrmann --- v2: - rebase on top of net-next conflict due to 59324cf35ab ('netlink: allow to listen "all" netns') include/uapi/linux/netlink.h | 17 + net/netlink/a

[PATCH] netlink: add API to retrieve all group memberships

2015-06-12 Thread David Herrmann
-space can retry with a properly sized array in case it was too small. Signed-off-by: David Herrmann --- include/uapi/linux/netlink.h | 15 --- net/netlink/af_netlink.c | 22 ++ 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/include/uapi/linux