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: <12294bf5-c791-8dea-617c-20f2b812c1b0@hartkopp.net>
Date:   Thu, 1 Oct 2020 13:03:21 +0200
From:   Oliver Hartkopp <socketcan@...tkopp.net>
To:     Vincent Mailhol <mailhol.vincent@...adoo.fr>,
        linux-can@...r.kernel.org
Cc:     Marc Kleine-Budde <mkl@...gutronix.de>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>, linux-kernel@...r.kernel.org,
        netdev@...r.kernel.org
Subject: Re: [PATCH] can: raw: add missing error queue support



On 26.09.20 18:24, Vincent Mailhol wrote:
> Error queue are not yet implemented in CAN-raw sockets.
> 
> The problem: a userland call to recvmsg(soc, msg, MSG_ERRQUEUE) on a
> CAN-raw socket would unqueue messages from the normal queue without
> any kind of error or warning. As such, it prevented CAN drivers from
> using the functionalities that relies on the error queue such as
> skb_tx_timestamp().
> 
> SCM_CAN_RAW_ERRQUEUE is defined as the type for the CAN raw error
> queue. SCM stands for "Socket control messages". The name is inspired
> from SCM_J1939_ERRQUEUE of include/uapi/linux/can/j1939.h.
> 
> Signed-off-by: Vincent Mailhol <mailhol.vincent@...adoo.fr>

Acked-by: Oliver Hartkopp <socketcan@...tkopp.net>

Thanks Vincent!

> ---
>   include/uapi/linux/can/raw.h | 3 +++
>   net/can/raw.c                | 4 ++++
>   2 files changed, 7 insertions(+)
> 
> diff --git a/include/uapi/linux/can/raw.h b/include/uapi/linux/can/raw.h
> index 6a11d308eb5c..3386aa81fdf2 100644
> --- a/include/uapi/linux/can/raw.h
> +++ b/include/uapi/linux/can/raw.h
> @@ -49,6 +49,9 @@
>   #include <linux/can.h>
>   
>   #define SOL_CAN_RAW (SOL_CAN_BASE + CAN_RAW)
> +enum {
> +	SCM_CAN_RAW_ERRQUEUE = 1,
> +};
>   
>   /* for socket options affecting the socket (not the global system) */
>   
> diff --git a/net/can/raw.c b/net/can/raw.c
> index 94a9405658dc..98abab119136 100644
> --- a/net/can/raw.c
> +++ b/net/can/raw.c
> @@ -804,6 +804,10 @@ static int raw_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
>   	noblock =  flags & MSG_DONTWAIT;
>   	flags   &= ~MSG_DONTWAIT;
>   
> +	if (flags & MSG_ERRQUEUE)
> +		return sock_recv_errqueue(sk, msg, size,
> +					  SOL_CAN_RAW, SCM_CAN_RAW_ERRQUEUE);
> +
>   	skb = skb_recv_datagram(sk, flags, noblock, &err);
>   	if (!skb)
>   		return err;
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ