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]
Date:	Thu, 21 Nov 2013 12:57:07 -0500 (EST)
From:	David Miller <davem@...emloft.net>
To:	eric.dumazet@...il.com
Cc:	vyasevich@...il.com, netdev@...r.kernel.org
Subject: Re: [PATCH] net: rework recvmsg handler msg_name and msg_namelen
 logic

From: Eric Dumazet <eric.dumazet@...il.com>
Date: Thu, 21 Nov 2013 07:00:14 -0800

> So a protocol should use BUILD_BUG_ON() to make sure sockaddr_storage is
> big enough.

Hannes mentioned trying to do this, somehow, automatically.  Best I could
come up with is something like:

#define DECLARE_RECVMSG_HANDLER(name, ..., sockaddr_type) \
static ... __name(...); \
static ... name(...)	\
{	\
	BUILD_BUG_ON(sizeof(sockaddr_type) > sizeof(sockaddr_storage); \
	__name(...); \
} \
static ... __name(...)

And then the protocols go:

DECLARE_RECVMSG_HANDLER(udp_recvmsg, ..., struct sockaddr_in)
{
	struct inet_sock *inet = inet_sk(sk);
	struct sockaddr_in *sin = (struct sockaddr_in *)msg->msg_name;
 ...

You get the idea.

Slightly convoluted, and we can do something special with types or the
prot ops member name to enforce usage of the macro.

--
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