Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp514047lqb; Fri, 24 May 2024 05:44:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWTBZxnUVYmv2uDZ+lv+h4US0kyI/CyefnU+FRIua4YBwcP4+sR0VaZk2ANIomInzzcHeYWLBm7wZ+GI07gpV2GZWhs5ONyZBQTeg+jnw== X-Google-Smtp-Source: AGHT+IGyIwWVuhmuhnbT4Lp9j6oGt0jwcYEcQpIYABVgnD+UJG2zRVz2aPI2Shgap0gTdvgi/hR7 X-Received: by 2002:a05:6102:3186:b0:47c:2a81:a98 with SMTP id ada2fe7eead31-48a385f189amr2372374137.20.1716554672552; Fri, 24 May 2024 05:44:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716554672; cv=pass; d=google.com; s=arc-20160816; b=uytblC5bOOcnZNDvDxejtcqbsoQd8Z6fbzu0eszhCvkFyQLGk+FcQU78Y6TpM9pojx e4Mz7Gt42BZIF+LK0PG/AobZKSoVoSlphyPgFyhxtdsJ2ZzBxk7HPJzLupBzn/+rbkXJ 1OYafCcMNbFmXAGjjtne1se+ioCDT0dGtzPmTzJ+VsvFUmGFOl0WpOv7Trs0wUhk8Ab9 VZfQlLee0NzxUKAXBeHnQFH2yLJAQx0v3uyT8F5MrAHcNRRl+uyNWdb5OBYnPHVTtCUx kAOoUxtkdQ8zMN2gAFtveHyQ1AUZdK07XbWf9XTbvF9uP4oN6NIMzvMQSRhZK5ZYCXv9 1A2A== 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=0TKtE8H0MnGIpMIfgmjmWqr87+04SmxZZt6+GpG7ZW4=; fh=kh1BEgL3RhIDbDvnY7/63dOFmL4tiYD8Um4YfBF6jjc=; b=dLP1b0hJ0y7NwrNPOov/f7fq3my5lq8lZ84lUfhwlPG8chPDGH5/JPK/6oiOjJlWFm prtmTNPIWMjMy4stUeD7rqUcZqC0r6W3dbOb0Y61kidCLiO1dBIwh8fuc7G28sz1sBC2 aRR4A+MlAutnUWZZpaZC0vqD8sgSBAYPB3YsAYdRTlrpBqTf1XlO5Iyafrhg3cX8D/2W BXk0cpcbpMb/EqXtGlqOlmrgUgCfhOl/vaghZoz6r5fUWErSpKZGeE1l34lW1GqyD2er mQwmmaLV34z/Oa3gJjwY8b8s3/4wK1egqrUDmU6jZ3CI1IhWMXzuKJpIWndEpZ4gu5yt R8Ug==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Q0USLNg9; 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-188697-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188697-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-43fb17b98ddsi17775221cf.106.2024.05.24.05.44.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 05:44:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-188697-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Q0USLNg9; 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-188697-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188697-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 24F951C20FC0 for ; Fri, 24 May 2024 12:44:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AFCD78662E; Fri, 24 May 2024 12:44:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Q0USLNg9"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="zm3qwWMA" 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 5C9E286622; Fri, 24 May 2024 12:44:21 +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=1716554662; cv=none; b=k8jL/qjplAwzzUntN0vtv4z4CpiSn++XJELKUXtUkgcVU/M0+H7q1FDQ3FWfjp10QA+SUPvF7WXwmVhTWsiL9AglyH3Pzshz4HouwlwQl+6acumt385gtZ7GQcuCDWJmYjrzI5798FrR3wSrDlDiVhnUJ8SL5PVFdGdYtDXrzfs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716554662; c=relaxed/simple; bh=+akjN8xEx7ZjnuU29UI3tF++BPRLwXDCghjCuPkJXYQ=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=i7APZoKqY5r/i0awwAtLiEimYp0BRgCnpwznpSMX2oRqGyrUBiGjrDBiRXlmRQD9IG4FrfgTZQYQPdF9Zit9XfS7kJ3lEnbgW3CzJZ+XWYMQVclhq3hPvCPRcuqgz4LprslU1/r59b1aqbyDNt4ltMX+Izgc38KNVc3tgq9Mtg8= 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=Q0USLNg9; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=zm3qwWMA; 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=1716554659; 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=0TKtE8H0MnGIpMIfgmjmWqr87+04SmxZZt6+GpG7ZW4=; b=Q0USLNg9FkCK0bAbRJH/vQChKJpiOvUDzTAq6adJ0+UZ0W7hwi0munxXQUYHU14Es5wi3P vTv/ptZXdLqtKlIfuMvm93olHd/kL5qxt5UTEWIQJbCTUEgInmkUxId7GTYotxSiSC0ynb bBt/dB2ZoQyPnLA9Hq+oaiKjpJro25sy89b6FmmSxT+g3mFECPJ34CqCpGDFkccIeqBFmr 9PWQtzyJrUOZqmIQSLnnc5eEQw1k0TERAk7flEtY788gnRTcj+IaC9WhnhXnxnCy1FpVJn eJx3GXlCZwjX5chX9rSokxCYDNHn6WeOzAtOxCj6QxMsuLAQUfIFoaA61jA8rw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1716554659; 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=0TKtE8H0MnGIpMIfgmjmWqr87+04SmxZZt6+GpG7ZW4=; b=zm3qwWMAEB6bhwOW7DFXwhENPq6FNgdmtSZ6OBbWRhe76cGHKj7deScesyNnzT+7R5ZQq2 QLr5kjqtkO6L8EBw== To: Justin Stitt , John Stultz , Stephen Boyd , Nathan Chancellor , Bill Wendling , Nick Desaulniers Cc: linux-kernel@vger.kernel.org, llvm@lists.linux.dev, linux-hardening@vger.kernel.org, Justin Stitt , Miroslav Lichvar Subject: Re: [PATCH v2] ntp: remove accidental integer wrap-around In-Reply-To: <87ed9re7i4.ffs@tglx> References: <20240517-b4-sio-ntp-usec-v2-1-d539180f2b79@google.com> <87ed9re7i4.ffs@tglx> Date: Fri, 24 May 2024 14:44:19 +0200 Message-ID: <87bk4ve5wc.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 Fri, May 24 2024 at 14:09, Thomas Gleixner wrote: > On Fri, May 17 2024 at 20:22, Justin Stitt wrote: > I dug into history to find a Fixes tag. That unearthed something > interesting. Exactly this check used to be there until commit > eea83d896e31 ("ntp: NTP4 user space bits update") which landed in > 2.6.30. The change log says: > > "If some values for adjtimex() are outside the acceptable range, they > are now simply normalized instead of letting the syscall fail." > > The problem with that commit is that it did not do any normalization at > all and just relied on the actual time_maxerror handling in > second_overflow(), which is both insufficient and also prone to that > overflow issue. > > 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. 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. Thanks, tglx