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-next>] [day] [month] [year] [list]
Date:	Fri, 5 Dec 2008 09:17:51 +0100
From:	"m m" <olsajiri@...il.com>
To:	linux-kernel@...r.kernel.org, linux-net@...r.kernel.org
Subject: netlink - notify when the socket gets closed

Hi,

I'm using netlink in my module. Based on the communication,
this module dynamically creates some internal structure, which
needs to be destroyed when the user level socket is closed (or
the application dies).

I found I could use the netlink_register_notifier function to register
NETLINK_URELEASE callback during the netlink_release function.
But since my module uses the multicast netlink socket communication,
it wont be called:

static int netlink_release(struct socket *sock)
{
        ...

        if (nlk->pid && !nlk->subscriptions) {
                struct netlink_notify n = {
                                                .net = sock_net(sk),
                                                .protocol = sk->sk_protocol,
                                                .pid = nlk->pid,
                                          };
                atomic_notifier_call_chain(&netlink_chain,
                                NETLINK_URELEASE, &n);
        }
        ...

Whats the reason this callback is not called for multicast sockets?

To workaround it I created simple misc device which the user application
opens before creating the netlink socket. This way I get some callbacks
inside the module when the application dies, at least.. pretty ugly :)

Is there a netlink mechanism to be notified when the netlink socket is
closed on the user level side? (when using multicast communication)

Or is there any other design I could use, since I think I'm not alone in
using internal module data which needs to be removed once the application dies.

thanks,
jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ