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:   Tue, 26 Oct 2021 10:45:05 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Jeremy Kerr' <jk@...econstruct.com.au>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>
CC:     "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Matt Johnston <matt@...econstruct.com.au>,
        Eugene Syromiatnikov <esyr@...hat.com>
Subject: RE: [PATCH net-next v6] mctp: Implement extended addressing

From: Jeremy Kerr
> 
> This change allows an extended address struct - struct sockaddr_mctp_ext
> - to be passed to sendmsg/recvmsg. This allows userspace to specify
> output ifindex and physical address information (for sendmsg) or receive
> the input ifindex/physaddr for incoming messages (for recvmsg). This is
> typically used by userspace for MCTP address discovery and assignment
> operations.
> 
...
> diff --git a/include/uapi/linux/mctp.h b/include/uapi/linux/mctp.h
> index 6acd4ccafbf7..07b0318716fc 100644
> --- a/include/uapi/linux/mctp.h
> +++ b/include/uapi/linux/mctp.h
> @@ -11,6 +11,7 @@
> 
>  #include <linux/types.h>
>  #include <linux/socket.h>
> +#include <linux/netdevice.h>
> 
>  typedef __u8			mctp_eid_t;
> 
> @@ -28,6 +29,14 @@ struct sockaddr_mctp {
>  	__u8			__smctp_pad1;
>  };
> 
> +struct sockaddr_mctp_ext {
> +	struct sockaddr_mctp	smctp_base;
> +	int			smctp_ifindex;
> +	__u8			smctp_halen;
> +	__u8			__smctp_pad0[3];
> +	__u8			smctp_haddr[MAX_ADDR_LEN];
> +};

You'd be better off 8-byte aligning smctp_haddr.
I also suspect that always copying the 32 bytes will be faster
and generate less code than the memset() + memcpy().

Oh and how did MAX_ADDR_LEN ever get into a uapi header??

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ