From nobody Thu Apr 16 22:32:45 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 EB835242D76 for ; Wed, 25 Feb 2026 08:52:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772009569; cv=none; b=ZXrxi2u8QIkLLgy0H4febVEuDwQCA6/9QmqKp5Ud6XLneTcR4SuSJLfBRTWIeqXguo1mdQptTyUnVBxxzmy9Frq/hwXhZwf7f3fWZ35As1T6i/fpZuC/r8Se0dHt6wFEbv8EPW5AUmiLtpnWN6/L02q/UgNrcWXf0D8+jEPmvKY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772009569; c=relaxed/simple; bh=nlwcHieaogkhYGBVDJK5QIqzh4iagocitLgp3+B/GWY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=twK8FeQwwJP4lDB2WEDRiP+BFtYTXbwNkD7X5wjUvLfYYiMeIM75I41PGD9E91PZrMyem8mIWmVhunGVqVC1jC8r6v8TKb1LRkT1rwqzi7KnEl5X8MbZsimeGmXaJgCWVwSY+uv0nXYqMQllOLVbaFcNRj6j1nf5nca7WbKlBls= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=NFXg0A8Y; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="NFXg0A8Y" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1772009566; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=5csm7OwGqxyolbHBOaifA770KT7bP54pK95LyQoP9ns=; b=NFXg0A8YoPo/TPItgr45bM13EtkmbZ8ReT6F4g9rsUN3KzPkNgp4/z2Ie4VqRVgmr2CPvs 3wFfPRsNWKv110/IEXtF5jMtUl7R+jVCOIHvCxvGZoOB5ENulm9TLXRSgSOOjpXilNmI7m LoMmbpPu54xcLoqScbVJYBADNb86tM0= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-397-ElThbwaJPwet0viT2Zd68A-1; Wed, 25 Feb 2026 03:52:45 -0500 X-MC-Unique: ElThbwaJPwet0viT2Zd68A-1 X-Mimecast-MFC-AGG-ID: ElThbwaJPwet0viT2Zd68A_1772009564 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3C5141800366; Wed, 25 Feb 2026 08:52:44 +0000 (UTC) Received: from queeg (unknown [10.43.135.229]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 428B11800465; Wed, 25 Feb 2026 08:52:43 +0000 (UTC) From: Miroslav Lichvar To: Thomas Gleixner , linux-kernel@vger.kernel.org Cc: Miroslav Lichvar Subject: [PATCH] timekeeping: Fix timex status validation for auxiliary clocks Date: Wed, 25 Feb 2026 09:51:35 +0100 Message-ID: <20260225085231.276751-1-mlichvar@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Content-Type: text/plain; charset="utf-8" The timekeeping_validate_timex() function validated the timex status of an auxiliary system clock even when the status is not to be changed, which caused unexpected errors for applications that make read-only clock_adjtime() calls, or set some other timex fields, but without clearing the status field. Do the AUX-specific status validation only when the modes field contains ADJ_STATUS, i.e. the application is actually trying to change the status. This makes the AUX-specific clock_adjtime() behavior consistent with CLOCK_REALTIME. Fixes: 4eca49d0b621 ("timekeeping: Prepare do_adtimex() for auxiliary clock= s") Signed-off-by: Miroslav Lichvar --- kernel/time/timekeeping.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 91fa2003351c..c07e562ee4c1 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -2653,7 +2653,8 @@ static int timekeeping_validate_timex(const struct __= kernel_timex *txc, bool aux =20 if (aux_clock) { /* Auxiliary clocks are similar to TAI and do not have leap seconds */ - if (txc->status & (STA_INS | STA_DEL)) + if (txc->modes & ADJ_STATUS && + txc->status & (STA_INS | STA_DEL)) return -EINVAL; =20 /* No TAI offset setting */ @@ -2661,7 +2662,8 @@ static int timekeeping_validate_timex(const struct __= kernel_timex *txc, bool aux return -EINVAL; =20 /* No PPS support either */ - if (txc->status & (STA_PPSFREQ | STA_PPSTIME)) + if (txc->modes & ADJ_STATUS && + txc->status & (STA_PPSFREQ | STA_PPSTIME)) return -EINVAL; } =20 --=20 2.53.0