Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1934653yba; Mon, 15 Apr 2019 01:12:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqwNs7NYSwpeT5uNkgxDkO7icEty6pOhUuT0HzauPtbRoOGXZerQ4zFBEdItlqYmuYcn9wWz X-Received: by 2002:a65:4bce:: with SMTP id p14mr70533286pgr.376.1555315941147; Mon, 15 Apr 2019 01:12:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555315941; cv=none; d=google.com; s=arc-20160816; b=SfPSPvzz/Z2JBzlpEztsy1tAMbqhVKGEWwV0nas3uKMYmV+fmnLxHSXF6z3EiwCpwc Yi8uomrBTo6RjCjJKxwGryFo19UpNW/M5VMWWQIVL6/NzPUaLOljkJP+/JbIGt0rqqME 0gGFV5QDqzn085VUMchQJN3p8Wg387ElFBUAgCJXWTgmLdwnA3OxPTxFRP6LSUlXIhx/ 2dFt0JwmsMhB6Pyuy+rTZZF3B3kWObkAABZjjZqzXuFFbgz3RggE0+5ZQmOew/YXQiSH zgi6oKj3KlUK7O17Tj1xj3UpALY9ImcDleBWdM9oWHRuMsFdLoc+hy7HCK9g7Kht1df/ jnSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=C6OWntz2C3XtivSygEejiXvaCp9zEP7hKxlpr3doSks=; b=M5HC/SCMX2qLVEDK/C+BC4uJ2dnPQOhFKp+o49Akb3bIOsAZPuh+cJNribc4Bhfr9O 34fTTbpr5FWXJvp8D4jaBbIQYOaeLgP+x8IYOKl3dAHtraTO3sg0dEf1Hakfhkj9Bqvf zMFRXSeIf5Affvl11d264+qczry1CoF2uz+06zq/ukaftuL9dHYLpEmWtSjKjmWuA1PM dh+BynuSinSBGO/umV7jUdECfjN5vmgLqE+FYug2p/3k4HrQpXi/ikZw1LETs87ciR7B f4oiHsZRPOeDAfoLTki2lwIM9EHm2x/xR/HurWMYhDLank6Vv/JENE/NT7K/TMfW2BvT vhEg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 t21si44043010plr.366.2019.04.15.01.12.04; Mon, 15 Apr 2019 01:12:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726683AbfDOIJz (ORCPT + 99 others); Mon, 15 Apr 2019 04:09:55 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:44744 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725794AbfDOIJz (ORCPT ); Mon, 15 Apr 2019 04:09:55 -0400 Received: from [5.158.153.52] (helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1hFwgX-0001w6-HX; Mon, 15 Apr 2019 10:09:49 +0200 Date: Mon, 15 Apr 2019 10:09:43 +0200 (CEST) From: Thomas Gleixner To: Ondrej Mosnacek cc: Roman Zippel , John Stultz , Stephen Boyd , Miroslav Lichvar , Andrew Morton , Linux kernel mailing list Subject: Re: kernel/time/ntp.c: Possible off-by-one error in TAI range check? In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 15 Apr 2019, Ondrej Mosnacek wrote: CC+ Miroslav > On Mon, Apr 8, 2019 at 10:47 AM Ondrej Mosnacek wrote: > > Hello, > > > > while writing tests for clock adjustment auditing [1] [2], I stumbled > > upon a strange behavior of adjtimex(2) when setting the TAI offset... > > > > Commit 153b5d054ac2 ("ntp: support for TAI") added a possibility to > > change the TAI offset from userspace via adjtimex(2). The code checks > > if the input value (txc->constant) is greater than 0 and if it is not, > > then it doesn't modify the value. Ignoring the fact that this check > > should probably be in timekeeping_validate_timex() and cause -EINVAL > > to be returned when false, I find it strange that the check doesn't > > allow to set the value to 0, which seems to be the default value... > > > > Was this behavior intended or should the code actually check for > > txc->constant >= 0 instead of txc->constant > 0? > > Ping? > > > > > Thanks, > > > > [1] https://github.com/linux-audit/audit-kernel/issues/10 > > [2] https://github.com/linux-audit/audit-kernel/wiki/RFE-More-detailed-auditing-of-changes-to-system-clock > > > > -- > > Ondrej Mosnacek > > Software Engineer, Security Technologies > > Red Hat, Inc. > > -- > Ondrej Mosnacek > Software Engineer, Security Technologies > Red Hat, Inc. >