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:   Wed,  7 Jul 2021 10:27:31 +0100
From:   Sergei Trofimovich <slyfox@...too.org>
To:     netdev@...r.kernel.org, Florian Westphal <fw@...len.de>,
        "David S . Miller" <davem@...emloft.net>
Cc:     linux-kernel@...r.kernel.org,
        Sergei Trofimovich <slyfox@...too.org>,
        Paolo Abeni <pabeni@...hat.com>,
        Mat Martineau <mathew.j.martineau@...ux.intel.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Eric Dumazet <edumazet@...gle.com>
Subject: [PATCH] net: core: fix SO_TIMESTAMP_* option setting

I noticed the problem as a systemd-timesyncd (and ntpsec) sync failures:

    systemd-timesyncd[586]: Timed out waiting for reply from ...
    systemd-timesyncd[586]: Invalid packet timestamp.

Bisected it down to commit 371087aa476
("sock: expose so_timestamp options for mptcp").

The commit should be a no-op but it accidentally reordered option type
and option value:

    +void sock_set_timestamp(struct sock *sk, int optname, bool valbool);
    ...
    -     __sock_set_timestamps(sk, valbool, true, true);
    +     sock_set_timestamp(sk, valbool, optname);

Tested the fix on systemd-timesyncd. The sync failures went away.

CC: Paolo Abeni <pabeni@...hat.com>
CC: Florian Westphal <fw@...len.de>
CC: Mat Martineau <mathew.j.martineau@...ux.intel.com>
CC: David S. Miller <davem@...emloft.net>
CC: Jakub Kicinski <kuba@...nel.org>
CC: Eric Dumazet <edumazet@...gle.com>
Signed-off-by: Sergei Trofimovich <slyfox@...too.org>
---
 net/core/sock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/sock.c b/net/core/sock.c
index ba1c0f75cd45..060892372ac5 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1068,7 +1068,7 @@ int sock_setsockopt(struct socket *sock, int level, int optname,
 	case SO_TIMESTAMP_NEW:
 	case SO_TIMESTAMPNS_OLD:
 	case SO_TIMESTAMPNS_NEW:
-		sock_set_timestamp(sk, valbool, optname);
+		sock_set_timestamp(sk, optname, valbool);
 		break;
 
 	case SO_TIMESTAMPING_NEW:
-- 
2.32.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ