Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp487982lqb; Wed, 29 May 2024 01:27:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXTKkv4IrZWmXysBev2vPYC2/22VbrMXmLJG6s7OMqBOAjWzbMJIDZrB+rGq6g655LuMP4rftrrF0Vrc9ppzXkCBlRl9m0DeS8322KUNQ== X-Google-Smtp-Source: AGHT+IHILVFi2C2sPDHONMpev0cNrsmRIHldHz65udRkH8qo7hodstQ3r+Non8ZWUyPcMHrFH/6d X-Received: by 2002:a50:d510:0:b0:572:3bcc:8370 with SMTP id 4fb4d7f45d1cf-578517bcac4mr10236669a12.0.1716971233368; Wed, 29 May 2024 01:27:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716971233; cv=pass; d=google.com; s=arc-20160816; b=Qzta55vz5Rxrdj5ZzNxmc93dzHy8kDwF5W5XvA3Ek1UkQ0K3HIS5Q2t9LsAJUiCgO1 r3bQknunJm0R7fuVg1ETZ/iJhb40I1lITejP0kU+24F3iU6NJplloSYHgG1ygI+5StcG yF6RC4j+ZoLkbaXTQYNfV2lP8nTGan+OGPDcDch34Y3A2ko4ONAk+jDMmQ2GvcWJogMn niRnVBqg5Eu9j81l7xfqQgW6wWjJrh1C0pXcTAZF2VEoJxmwrrHadMa1ruK8ihXPY17X HyahzYYO9PEL6s7/6A6o45VlHMtyKxsrfWXN8FfK8/QG1p0jfPRkDQ8jWrL0w5s4SB4r k8RA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:references:in-reply-to:subject:cc:to:dkim-signature :dkim-signature:from; bh=VisuJquPIChpxFSeuXKm3BwthCpocWOziwbjGlkW3mo=; fh=DpzidMjPZQsndovP9TyP3r6X2N5vYE/q2r8ZZ+Frh+Y=; b=uJFmSYBt7uQFDW+PGXFDIJ7VRwZgFqmocEmrl/mss9iz7oP18EOE1qqZ3dCcvDlrLU 6EYEtruIIJE1/ruXK5xwavp396RZEdinVTKARngdm7YbTnyFdAii4Pv9/Numj1NBtJur LKq2k2T9ikDSTowxJy0q2aZtl78iC2VldvDF3tPc9QHYtl11T6224/T9zM3YE1IMTCYW XvXn0ss10XCb3ujXOe0scwFTVAHRY06EhZze7QLO7vOOxwfuniFz5tzj4qi/luoysaDG UmX3TY41sejgEZ08ZdZT6dsfnACoOaAJJOFrb6oRXJyZdSJmPxNlhRNy3otlrzBJ5WX2 RQuA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=BoTz8w7t; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-193716-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-193716-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-578524b53aasi6100317a12.553.2024.05.29.01.27.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 01:27:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-193716-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=BoTz8w7t; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-193716-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-193716-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id A63791F26FA1 for ; Wed, 29 May 2024 08:23:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 049DD17BB2F; Wed, 29 May 2024 08:18:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="BoTz8w7t"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="LE2Cl4ZK" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D9AB1179957; Wed, 29 May 2024 08:18:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716970688; cv=none; b=e8NgN6K1aa4/WnHTNqrpT6CZwfk6+r8gSHKGUTRQx6ajGclqT43gdZ3Nk9AjLNjHIkdtcnJ5bU87kU8RK42OA1rfLNGRAL9rw/umskthof9lFnfzOR5eAF20kvPho0l74sSr89dxgpIYVwCWAHbangNlU4uuNzqZ1Pvo6iwrNkc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716970688; c=relaxed/simple; bh=PH3g73IUBo++D2q6c/meuMRPW8F0op+ZjovpZ13rJYs=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=FXWKv4E+BCdU/KoMXimOXIXMxjIbKMdpaTA2fburUQRRMZEAtx7DZXf77RyaVCa4rFt6ZsNf3eoa2A7HibtbLbBMudBPbsyRlmdzuX5TJM46H8s2tqTg+73AnH0vismFh276H5zrBlO9K6Yz7CNXhDug2f4DGvXemEIHeyy/nss= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=BoTz8w7t; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=LE2Cl4ZK; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1716970685; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=VisuJquPIChpxFSeuXKm3BwthCpocWOziwbjGlkW3mo=; b=BoTz8w7tg+5pAYB3WTkk6jnPjCzUS9z0neRfqMZHzrq9h+LZXnODAKPSUNjExMTjFrP/ce H9jCBY90DjR7iN/BVH4DOQ23kvwi0/pDfliMzNOhHg5+J60YMJvq9GKVSubLijrywm8KjK SfQVRI6Y7uXPnXipACHzqpdfosQejx6RkEpBR7Cw87JqbAaoYfcYvcyA3Sy8icnc43LzC4 nmMAGGPgsu+Q7056MyjftnY+X0e7WXcRPs7xiNjr7/nHCwRQCgVSVESc9ey1IgtnnU8nym XYjh9P24bmqXuI5/zp4pyX0XHUtHntvGgzrDdMj2R3DpDgIvoBcdt71ABn6c/g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1716970685; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=VisuJquPIChpxFSeuXKm3BwthCpocWOziwbjGlkW3mo=; b=LE2Cl4ZKSn5lUeDv71XnuhlGbLGoUjoiAiNlV/X+VkyTc0Dm60QzyXAasSVhUphLhPtuYY NoynSjDEiFaegtDA== To: Miroslav Lichvar Cc: Justin Stitt , John Stultz , Stephen Boyd , Nathan Chancellor , Bill Wendling , Nick Desaulniers , linux-kernel@vger.kernel.org, llvm@lists.linux.dev, linux-hardening@vger.kernel.org Subject: Re: [PATCH v2] ntp: remove accidental integer wrap-around In-Reply-To: References: <20240517-b4-sio-ntp-usec-v2-1-d539180f2b79@google.com> <87ed9re7i4.ffs@tglx> <87bk4ve5wc.ffs@tglx> Date: Wed, 29 May 2024 10:18:04 +0200 Message-ID: <8734q19glf.ffs@tglx> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On Mon, May 27 2024 at 10:26, Miroslav Lichvar wrote: > On Fri, May 24, 2024 at 02:44:19PM +0200, Thomas Gleixner wrote: >> On Fri, May 24 2024 at 14:09, Thomas Gleixner wrote: >> > So instead of turning the clock back, we might be better off to actually >> > put the normalization in place at the assignment: >> > >> > time_maxerror = min(max(0, txc->maxerror), NTP_PHASE_LIMIT); >> > >> > or something like that. > > Yes, I think that's a better approach. Failing the system call could > break existing applications, e.g. ntpd can be configured to accept a > large root distance and it doesn't clamp the maxerror value, while > updating the PLL offset in the same adjtimex() call. Thanks for confirming. I suspected that, but the original change logs are pretty useless in that regard. >> So that commit also removed the sanity check for time_esterror, but >> that's not doing anything in the kernel other than being reset in >> clear_ntp() and being handed back to user space. No idea what this is >> actually used for. > > It's a lower-bound estimate of the clock error, which applications can > check if it's acceptable for them. I think it should be clamped too. > It doesn't make much sense for it to be larger than the maximum error. Ok. > Another possible improvement of adjtimex() would be to set the UNSYNC > flag immediately in the call if maxerror >= 16s to avoid the delay of > up to 1 second for applications which check only that flag instead of > the maxerror value. That needs to be a seperate change. Thanks, tglx