Re: [PATCH net] net: validate SO_TXTIME clockid coming from userspace

From: Martin KaFai Lau
Date: Tue May 28 2024 - 21:16:20 EST


On 5/28/24 3:49 PM, Abhishek Chauhan wrote:
Currently there are no strict checks while setting SO_TXTIME
from userspace. With the recent development in skb->tstamp_type
clockid with unsupported clocks results in warn_on_once, which causes
unnecessary aborts in some systems which enables panic on warns.

Add validation in setsockopt to support only CLOCK_REALTIME,
CLOCK_MONOTONIC and CLOCK_TAI to be set from userspace.

Link: https://lore.kernel.org/netdev/bc037db4-58bb-4861-ac31-a361a93841d3@xxxxxxxxx/
Link: https://lore.kernel.org/lkml/20240509211834.3235191-1-quic_abchauha@xxxxxxxxxxx/
Fixes: 1693c5db6ab8 ("net: Add additional bit to support clockid_t timestamp type")

Patch lgtm. This should target for net-next instead of net. The Fixes patch is in net-next only.

Acked-by: Martin KaFai Lau <martin.lau@xxxxxxxxxx>