From patchwork Tue Oct 27 13:44:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 312453 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA55EC838A2 for ; Tue, 27 Oct 2020 15:48:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9016421D42 for ; Tue, 27 Oct 2020 15:48:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603813717; bh=skxQn2Q8BFuMrIntLxxY4y0j8PNdzBpcUrS+8INXU2k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=BtxRU5zfh29ex9yW6UtBIErVJ1sak5nSRuOxX7wRXbTryCEvHHZhGV4TmXCDmQS3s E6XciSkxKXGnteYoqrstWVqeA2Lqbe8UDOIN6ZH03Qpf0gOP858x4+9+6DbgpCyEbA xPd713YB+sX2x4RajHREH++DbQRVpqouaoYeLUzA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1802420AbgJ0Psb (ORCPT ); Tue, 27 Oct 2020 11:48:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:55760 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1796415AbgJ0PSW (ORCPT ); Tue, 27 Oct 2020 11:18:22 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E1D4122281; Tue, 27 Oct 2020 15:18:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603811895; bh=skxQn2Q8BFuMrIntLxxY4y0j8PNdzBpcUrS+8INXU2k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jZfVZp0ANbMc3xItZ71hyPFB+S4aJASOspLLdGO7z0Xjc1ql3xDoajhzG9hMgiT4s NRiZPgyvQ7oVF3qM4ks+BWzGvyW+p3JHe+CgDrmWeprRltrmhp0RWN3xmUE9mGyRSM anYkFXZhxFIcMN43JRjjdYrdC4Ij94rXslv1tE/s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christian Eggers , Willem de Bruijn , Deepa Dinamani , Jakub Kicinski Subject: [PATCH 5.9 021/757] socket: dont clear SOCK_TSTAMP_NEW when SO_TIMESTAMPNS is disabled Date: Tue, 27 Oct 2020 14:44:31 +0100 Message-Id: <20201027135451.514946399@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135450.497324313@linuxfoundation.org> References: <20201027135450.497324313@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Christian Eggers [ Upstream commit 4e3bbb33e6f36e4b05be1b1b9b02e3dd5aaa3e69 ] SOCK_TSTAMP_NEW (timespec64 instead of timespec) is also used for hardware time stamps (configured via SO_TIMESTAMPING_NEW). User space (ptp4l) first configures hardware time stamping via SO_TIMESTAMPING_NEW which sets SOCK_TSTAMP_NEW. In the next step, ptp4l disables SO_TIMESTAMPNS(_NEW) (software time stamps), but this must not switch hardware time stamps back to "32 bit mode". This problem happens on 32 bit platforms were the libc has already switched to struct timespec64 (from SO_TIMExxx_OLD to SO_TIMExxx_NEW socket options). ptp4l complains with "missing timestamp on transmitted peer delay request" because the wrong format is received (and discarded). Fixes: 887feae36aee ("socket: Add SO_TIMESTAMP[NS]_NEW") Fixes: 783da70e8396 ("net: add sock_enable_timestamps") Signed-off-by: Christian Eggers Acked-by: Willem de Bruijn Acked-by: Deepa Dinamani Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/core/sock.c | 1 - 1 file changed, 1 deletion(-) --- a/net/core/sock.c +++ b/net/core/sock.c @@ -769,7 +769,6 @@ static void __sock_set_timestamps(struct } else { sock_reset_flag(sk, SOCK_RCVTSTAMP); sock_reset_flag(sk, SOCK_RCVTSTAMPNS); - sock_reset_flag(sk, SOCK_TSTAMP_NEW); } }