Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2065522ybl; Sat, 11 Jan 2020 08:22:03 -0800 (PST) X-Google-Smtp-Source: APXvYqzoe93f7AchtucFymmyaRHTAh13tRAfL7JfVLwGl2Ti4FAfj8BXowgVkU5jS4a5f/lIKYaM X-Received: by 2002:aca:43c1:: with SMTP id q184mr6418203oia.116.1578759723265; Sat, 11 Jan 2020 08:22:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578759723; cv=none; d=google.com; s=arc-20160816; b=PIsPT+zpK4WHrBhzLOqr+A87E9usrIns454qSc5/aqTZcp/zfugcB74yjTz7biUyBC RSiz7sRY5ptN7/0fIx3PzBRpGtRPoeJHxuevxJrBjFtGhVX+UEHYzf+WLPrL3ZHJAINQ 0llMssi4eZ88g0OLK8XZ+BKZ8m+74jtbTNc1rRcq/FwY8J8JLamyy/qMZeiNGkb+xh7i X3z4i+VvR1zJP3y71ng+/IftPPgjP4YGFPJzYfjei8jx+2Zhn6nhPyHglRgEwAJmxolo caqFpYpWmOT8oNWgnTpB3LKOPS3u2fVGHQP550xVbF7kZ4sRFXZy3MC+HTMBH1jNRVnI b92w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=i403KRTHVzWE11Fqgpzh69HFIcXaOW0vTUzSUn0a2XA=; b=qQeapiV1h1zQ9WLbTXv/UFF3mQY3REov38c52wTGSY+0sB6C9s9G6njHeh2o7ugctX YGVzppex5QwjcIXItrodQUp5UpRT7g49QD+1HMs0rnrWnLjWEtmpNp9H/mpYWM65eKlh bR94zfCaPJjyBwJIxyGb22a5v2lZWgdMac5MI7PmYbaYy596qrp9g8b5jTFNkpth17sH LLJliX0pDBJPWxADB5aA8LbhgnJke4exSfdOuFm3sNgdjsfRgZQc8i6ZpfjZL8kPKrCU A+JQYLW3bQH0bXFFJmn4r5DoHxbYxC+QGXKUP3QED5zcQse2fYPiwjCQXWEI0umHLnEF W3bA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d9si1022012otf.81.2020.01.11.08.21.36; Sat, 11 Jan 2020 08:22:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730198AbgAKQVe (ORCPT + 99 others); Sat, 11 Jan 2020 11:21:34 -0500 Received: from mout.kundenserver.de ([212.227.17.13]:50873 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730168AbgAKQVe (ORCPT ); Sat, 11 Jan 2020 11:21:34 -0500 Received: from mail-qk1-f178.google.com ([209.85.222.178]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPSA (Nemesis) id 1MA7Om-1ixR3u1dyE-00BcEp; Sat, 11 Jan 2020 17:21:32 +0100 Received: by mail-qk1-f178.google.com with SMTP id z76so4845525qka.2; Sat, 11 Jan 2020 08:21:32 -0800 (PST) X-Gm-Message-State: APjAAAV+xPOTNIum1DTMGzBc32GfFKrD36xosqYU5whPE6L0ypkGfhN0 e/CWuzZwKUbcQ5CNQtd/J+PdGWaImwViev6zB/Y= X-Received: by 2002:a37:84a:: with SMTP id 71mr8365643qki.138.1578759691126; Sat, 11 Jan 2020 08:21:31 -0800 (PST) MIME-Version: 1.0 References: <20200110204903.3495832-1-arnd@arndb.de> <20200110210512.GB30412@brightrain.aerifal.cx> <0BF859F5-AA95-4941-A80D-7D33F7AC3636@alum.mit.edu> In-Reply-To: <0BF859F5-AA95-4941-A80D-7D33F7AC3636@alum.mit.edu> From: Arnd Bergmann Date: Sat, 11 Jan 2020 17:21:15 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] hcidump: add support for time64 based libc To: Guy Harris Cc: Rich Felker , Bluez mailing list , y2038 Mailman List , Johan Hedberg , Linux Kernel Mailing List , Deepa Dinamani Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:ZHrUmBaNX1d8ZysSWkioreCOyec215J+zph9SYHp039wOh7ZKTy nPo0hXRNl5bned2hNeZDNMgZ4yGTUF6x9U9vX2zHk4mxmaqAh8RuK7WOY1JqNjot/LgcNO3 6A9pAAcKddt2iEi2kFMksnzQa/k1pBQTC8mJRWb0GAC+Kc7VZ5zMC1xNT7nFX0SS2130Hj6 cbd3tIpksoLMBDiD9naZA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:8qeHBL42Pyw=:YBchiJbJMNRjohDgudsLeC eQe6ASoSR5d3ftFDgzuG7CB6HtZZI89pfS1kA5MZj7cDFfauBAC3NvdwhNU2+/TDVZqgXkbpv ucNTrqGZaefkX5e3o3wpNYYyjBRaeyTNsCcmTQ9xBXyRxgTO83GXdusT32mZjE3haU44f+6Xq m+qHguAQYQH1ng3Ko2XG+dWU5L+Cqxrb4ZT+FTOgSbBHWc9AxpYBDv1W7wp5aW06bOuPO+hy+ AD1eEhx7uBGxOPuY9H1BUGdDfk3xM4mwNxCsKNVEd+hnxwkJJhy5vK5utADYh0D+nG5QzeR6L YGIZs+4a0265r4liIvowdQ8T0uz8maKcn4ZSen148gZl4nI18jfVFV00h8OvRAbs1zBVrkiGC 9HHidcd1DMQ1376vdji1iLprF1YRizlNGrlMbvI6Jm07aqlkJyAjpKqcvBKojW2/hFz7DMA91 S/gIAOKnnfsrgnE3cJbGogo/uVkTScjMyQwSqR9f4pMbgcTwTUFVB/4AGJj+mZzYrorZwZ34k CT4OWeshSkio0UaA0+pbaOi1ygq2n6U0GgNmOpEntaLo2TRqgRrggDWIY2TtTPANaOpvlfoM+ 6fAlyL1upnEE79eaJTvpbZe/NUNwBc2fUILffcnmBZRXHi7OfChK1TbDfFrJTtUDbb/Sddzpr nouCajXeYYS3INICEmtTxlHy12vrXoU8FRuw8nbtjLf/oI7jLROXorEnbWPnrj3DFJ6NOwPN6 A8ZijVwFBT/o/tOeB8deN8DPtaCMTKhc3csKS2pLE6kChUB40wGruugtJJv9QWM6tVJEjjQuB JXUuoQAuJOTi9IVsjDveUVHaDg7s/yum7S5rDAsX12BlurpSICCBRp6ahc27pmU4kXFf2duOP tIdjp+QlmLCJymaF55UA== Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org was On Sat, Jan 11, 2020 at 12:32 AM Guy Harris wrote: > > On Jan 10, 2020, at 1:19 PM, Arnd Bergmann wrote: > > > On Fri, Jan 10, 2020 at 10:05 PM Rich Felker wrote: > >> > >> On Fri, Jan 10, 2020 at 09:49:03PM +0100, Arnd Bergmann wrote: > >>> musl is moving to a default of 64-bit time_t on all architectures, > >>> glibc will follow later. This breaks reading timestamps through cmsg > >>> data with the HCI_TIME_STAMP socket option. > >>> > >>> Change both copies of hcidump to work on all architectures. This also > >>> fixes x32, which has never worked, and carefully avoids breaking sparc64, > >>> which is another special case. > >> > >> Won't it be broken on rv32 though? Based on my (albeit perhaps > >> incomplete) reading of the thread, I think use of HCI_TIME_STAMP > >> should just be dropped entirely in favor of using SO_TIMESTAMPNS -- my > >> understanding was that it works with bluetooth sockets too. > > > > All 32-bit architectures use old_timeval32 timestamps in the kernel > > here, even rv32 and x32. As a rule, we keep the types bug-for-bug > > compatible between architectures and fix them all at the same time. > > > > Changing hcidump to SO_TIMESTAMPNS would work as well, but > > that is a much bigger change and I don't know how to test that. > > If so, maybe I'll just do that for libpcap. Libpcap *does* have an API to request >capturing with nanoseconds in tv_usec (and I plan to give it pcapng-flavored APIs > to deliver higher-resolution time stamps, as well as metadata such as "incoming" > vs. "outgoing", as well). Sounds good to me, just make sure that you no longer reference HCI_TIME_STAMP and it should be fine with both old and new libc versions. SO_TIMESTAMPNS was first added to the kernel in linux-2.6.22, which is probably older than anything you care about, but I'm not sure what you need to do to use it on bluetooth. It appears to have first been added along with the monitor channel support in linux-3.4. On a semi-related note, I see that there is a y2038 compatibility in the libpcap definition of struct pcap_timeval, which uses a *signed* tv_sec field. I assume the sizes of the fields cannot be changed, but it would be good to investigate if you can just make it unsigned instead, changing the supported time range from 1902...2038 to 1970...2106. It probably makes sense to do this together with supporting nanosecond timestamps. You could also consider changing the format to use a 64-bit nanosecond value starting at either 1970 or 1902 to give an even larger range. Arnd