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: <CALx6S37SvPk319=hC8mVwLHsa8T_6wed41wcqLgudR8yj3akdg@mail.gmail.com>
Date:	Wed, 2 Dec 2015 08:12:48 -0800
From:	Tom Herbert <tom@...bertland.com>
To:	Lorenzo Colitti <lorenzo@...gle.com>
Cc:	Linux Kernel Network Developers <netdev@...r.kernel.org>,
	"David S. Miller" <davem@...emloft.net>,
	Hannes Frederic Sowa <hannes@...essinduktion.org>,
	Eric Dumazet <eric.dumazet@...il.com>,
	Erik Kline <ek@...gle.com>,
	Maciej Żenczykowski <zenczykowski@...il.com>
Subject: Re: Add a SOCK_DESTROY operation to close sockets from userspace

On Wed, Dec 2, 2015 at 7:18 AM, Lorenzo Colitti <lorenzo@...gle.com> wrote:
> On Tue, Dec 1, 2015 at 11:53 AM, Tom Herbert <tom@...bertland.com> wrote:
>> This is awesome! The only thing I would suggest is to make
>> sock_destroy a proto_op so that it can be called from within the
>> kernel. This should be preferred to externally calling tcp_done
>> (hopefully we can unexport that symbol then).
>
> I'm not sure there is value in making it a proto op. The sock_diag
> code that finds the socket based on the netlink diag request is
> specific to both the protocol family (e.g., the sock_diag structures
> for inet and unix differ) and protocol (e.g., TCP, UDPv4 and UDPv6 use
> different hash tables).
>
> So even if we add a proto_op (or struct proto function pointer) to
> destroy a socket, we can't just have a generic function (or even an
> inet-specific function) that just finds a socket and does "return
> sk->sk_prot->diag_destroy(sk)" regardless of what protocol that socket
> is.
>
> The code does look better if the protocol-specific code is moved to a
> new tcp_abort function that just takes a pointer to the sk.

The in kernel caller would already have a pointer to the socket so the
call would just be sk->sk_prot->destroy(sk). That call should make its
way down to same backend function in TCP that the diag path would use.
We need this in the kernel for the same reasons you want this in
userspace, if a third party hits an unrecoverable error on the socket
it needs to signal this condition to the owner of the socket but can't
actually close the socket (useful to RDS, KCM, probably
TLS-in-kernel).
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ