From patchwork Wed Apr 15 20:59:03 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 133150 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 48F644BA2E1F for ; Wed, 15 Apr 2026 21:00:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 48F644BA2E1F X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from sonata.ens-lyon.org (domu-toccata.ens-lyon.fr [140.77.166.138]) by sourceware.org (Postfix) with ESMTPS id A6A5C4BA2E14 for ; Wed, 15 Apr 2026 20:59:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A6A5C4BA2E14 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=bounce.ens-lyon.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A6A5C4BA2E14 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=140.77.166.138 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776286749; cv=none; b=eVnnHjHZlSeN01FiooBj3WUpYdCHg7Rn5y724zKklQMcoNNj5yiYph3lwuKmlnfdCjK+7RnQ7MTFtOl49yjEDM9AbqsoEafmMVFOcvJeVQn4eZhfZKSkC/GlATSFRcZ5ugkA62Nz9/ABGkU9eciA8cuZ/iBBN1iDx545NvuyPdk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776286749; c=relaxed/simple; bh=w1P3YV/sRszm3QaHHO72OVVCcy6SFz2UFob1Nl+iKF4=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=s35/ZLPvxLuj0MvOgcJqdyH0YJj1uI59+IzcpBuWhSsTLL+ILnUXYYioiz+CH1zkOSyQlQ9RA895NWRR3/jOhBpvHjZVAEFNkzWOebVGafR6f8gmmqIaTCqOR2TyGS4ynrsq02hyvIdtq4FEq0VUykBZC2BC3BDcAl1VahKV7qQ= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A6A5C4BA2E14 Received: from localhost (localhost [127.0.0.1]) by sonata.ens-lyon.org (Postfix) with ESMTP id 33D6CA027C; Wed, 15 Apr 2026 22:59:07 +0200 (CEST) Received: from sonata.ens-lyon.org ([127.0.0.1]) by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QoPOtX22NYBn; Wed, 15 Apr 2026 22:59:07 +0200 (CEST) Received: from end (aamiens-653-1-40-48.w83-192.abo.wanadoo.fr [83.192.199.48]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by sonata.ens-lyon.org (Postfix) with ESMTPSA id 96B35A0230; Wed, 15 Apr 2026 22:59:06 +0200 (CEST) Received: from samy by end with local (Exim 4.99.1) (envelope-from ) id 1wD7KE-00000005HEu-0Wqg; Wed, 15 Apr 2026 22:59:06 +0200 From: Samuel Thibault To: libc-alpha@sourceware.org Cc: Michael Kelly , commit-hurd@gnu.org Subject: [hurd, commited 1/3] hurd: Make adjtime reject out-of-range tv_usec values Date: Wed, 15 Apr 2026 22:59:03 +0200 Message-ID: <20260415205905.1257892-2-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260415205905.1257892-1-samuel.thibault@ens-lyon.org> References: <20260415205905.1257892-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org From: Michael Kelly --- sysdeps/mach/hurd/adjtime.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sysdeps/mach/hurd/adjtime.c b/sysdeps/mach/hurd/adjtime.c index c25b666a22..915b86da13 100644 --- a/sysdeps/mach/hurd/adjtime.c +++ b/sysdeps/mach/hurd/adjtime.c @@ -37,6 +37,13 @@ __adjtime (const struct timeval *delta, struct timeval *olddelta) if (olddelta == NULL) olddelta = &dummy; + if (delta != NULL) + { + if (delta->tv_usec >= TIME_MICROS_MAX || + delta->tv_usec <= -TIME_MICROS_MAX) + return EINVAL; + } + err = __host_adjust_time (hostpriv, /* `time_value_t' and `struct timeval' are in fact identical with the names changed. */ From patchwork Wed Apr 15 20:59:04 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 133149 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 2A15E4BA2E2B for ; Wed, 15 Apr 2026 20:59:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2A15E4BA2E2B X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from sonata.ens-lyon.org (sonata.ens-lyon.org [140.77.166.138]) by sourceware.org (Postfix) with ESMTPS id 49D6F4BA543C for ; Wed, 15 Apr 2026 20:59:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 49D6F4BA543C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=bounce.ens-lyon.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 49D6F4BA543C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=140.77.166.138 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776286749; cv=none; b=AXBWuFPpS8ehlOeE/B+5KlP1jyLE1jKaZF25J60PehT0uIm0omCk4rFK38qVuYKHLkODxgQI5TRuy5jKSLhASOLTsQNq0D77GUetP4IhwgzkVYvX0CxRoNgdMfWKrvpfx4SDUwKXalpZ8H8ZU47OA4jDnj6v8G52lQUVPUHhiyY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776286749; c=relaxed/simple; bh=hM/1qyYVkg+Sxci98ZqZZJHoCrZ+Mxs4a649KqDTGP4=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=oX4SfNWsJD6nWrMTTv5skYLVx3xlMmIK3S5dmHRHf4Fh4X54v98a0KklVt97kThy6kn2VxRQqJecWKEFFtvG6PWzkEFRCyE+cGGzqIePHF7Rmvl6kZXM0gvJvvY849IyiEB7Z26A8WW1iWKOsicrIztrAAGXUU1sY8l+vm+FV7E= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 49D6F4BA543C Received: from localhost (localhost [127.0.0.1]) by sonata.ens-lyon.org (Postfix) with ESMTP id 4A84FA0230; Wed, 15 Apr 2026 22:59:07 +0200 (CEST) Received: from sonata.ens-lyon.org ([127.0.0.1]) by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SSyGCPf8AT11; Wed, 15 Apr 2026 22:59:07 +0200 (CEST) Received: from end (aamiens-653-1-40-48.w83-192.abo.wanadoo.fr [83.192.199.48]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by sonata.ens-lyon.org (Postfix) with ESMTPSA id 93AB3A022F; Wed, 15 Apr 2026 22:59:06 +0200 (CEST) Received: from samy by end with local (Exim 4.99.1) (envelope-from ) id 1wD7KE-00000005HEx-0awS; Wed, 15 Apr 2026 22:59:06 +0200 From: Samuel Thibault To: libc-alpha@sourceware.org Cc: Michael Kelly , commit-hurd@gnu.org Subject: [hurd, commited 2/3] hurd: __adjtime(): struct timeval and time_value_t are not identical. Date: Wed, 15 Apr 2026 22:59:04 +0200 Message-ID: <20260415205905.1257892-3-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260415205905.1257892-1-samuel.thibault@ens-lyon.org> References: <20260415205905.1257892-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org From: Michael Kelly 'struct timeval' and 'struct time_value' have different types for the microseconds component: int and long int. Casting one to the other leads to negative numbers not being preserved properly within the called code. Message-ID: <20260415180318.109742-3-mike@weatherwax.co.uk> --- sysdeps/mach/hurd/adjtime.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/sysdeps/mach/hurd/adjtime.c b/sysdeps/mach/hurd/adjtime.c index 915b86da13..9d01533b23 100644 --- a/sysdeps/mach/hurd/adjtime.c +++ b/sysdeps/mach/hurd/adjtime.c @@ -28,31 +28,36 @@ __adjtime (const struct timeval *delta, struct timeval *olddelta) { error_t err; mach_port_t hostpriv; - struct timeval dummy; + time_value_t rpc_delta, rpc_olddelta; err = __get_privileged_ports (&hostpriv, NULL); if (err) return __hurd_fail (EPERM); - if (olddelta == NULL) - olddelta = &dummy; - if (delta != NULL) { if (delta->tv_usec >= TIME_MICROS_MAX || delta->tv_usec <= -TIME_MICROS_MAX) return EINVAL; + + rpc_delta.seconds = delta->tv_sec; + rpc_delta.microseconds = delta->tv_usec; } + else + return EINVAL; - err = __host_adjust_time (hostpriv, - /* `time_value_t' and `struct timeval' are in - fact identical with the names changed. */ - *(time_value_t *) delta, - (time_value_t *) olddelta); + err = __host_adjust_time (hostpriv, rpc_delta, &rpc_olddelta); __mach_port_deallocate (__mach_task_self (), hostpriv); if (err) return __hurd_fail (err); + + if (olddelta != NULL) + { + olddelta->tv_sec = rpc_olddelta.seconds; + olddelta->tv_usec = rpc_olddelta.microseconds; + } + return 0; } From patchwork Wed Apr 15 20:59:05 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 133148 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 1DE9B4BA2E2B for ; Wed, 15 Apr 2026 20:59:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1DE9B4BA2E2B X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from sonata.ens-lyon.org (sonata.ens-lyon.org [140.77.166.138]) by sourceware.org (Postfix) with ESMTPS id 4FC434BA2E10 for ; Wed, 15 Apr 2026 20:59:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4FC434BA2E10 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=bounce.ens-lyon.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4FC434BA2E10 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=140.77.166.138 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776286749; cv=none; b=aZX+uoFWVzj961zJ7cZaxEYs0D4QXs9yX/UdiJY8zEZOR9k+dq5PqgBj0gNqCapINZepgPWb8mwi9ifOJnwG9Jd4TDUO4LJb3lad3l6zt1YY5fOZMX8E41dJruBHD1reH1YraqSI5mlbScClf+aux7T5vpxnA+AA1ZFsSeMJcjk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776286749; c=relaxed/simple; bh=RV+UbgvL/fzsBl717634iazNW3bzo+X8edDLHh6ESzc=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=nHcYny9w26u05D5Yt+DcZRnAna1m3Ex37rdL/Tq1uswDa290WpaIQB/g7ka1ezH6/tbPlH7fJcdJNx2cEl+dgmLmAHs5crh2JKZS7fSfJV2wOU2T1YzzFodYXKP4W9Duz+QTi2w8cW9JFL7C0MvFwBiDEHY3o9ilzc0NzEGtZdw= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4FC434BA2E10 Received: from localhost (localhost [127.0.0.1]) by sonata.ens-lyon.org (Postfix) with ESMTP id 26681A01E2; Wed, 15 Apr 2026 22:59:07 +0200 (CEST) Received: from sonata.ens-lyon.org ([127.0.0.1]) by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sgDmPnxzuTnA; Wed, 15 Apr 2026 22:59:07 +0200 (CEST) Received: from end (aamiens-653-1-40-48.w83-192.abo.wanadoo.fr [83.192.199.48]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by sonata.ens-lyon.org (Postfix) with ESMTPSA id 9D0D2A027C; Wed, 15 Apr 2026 22:59:06 +0200 (CEST) Received: from samy by end with local (Exim 4.99.1) (envelope-from ) id 1wD7KE-00000005HF0-0fCN; Wed, 15 Apr 2026 22:59:06 +0200 From: Samuel Thibault To: libc-alpha@sourceware.org Cc: Michael Kelly , commit-hurd@gnu.org Subject: [hurd, commited 3/3] hurd: __adjtime() to support NULL delta whilst returning olddelta. Date: Wed, 15 Apr 2026 22:59:05 +0200 Message-ID: <20260415205905.1257892-4-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260415205905.1257892-1-samuel.thibault@ens-lyon.org> References: <20260415205905.1257892-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org From: Michael Kelly This is required to obtain the remaining time of day adjustment without altering the required adjustment. Message-ID: <20260415180318.109742-4-mike@weatherwax.co.uk> --- sysdeps/mach/hurd/adjtime.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sysdeps/mach/hurd/adjtime.c b/sysdeps/mach/hurd/adjtime.c index 9d01533b23..4408b1cff5 100644 --- a/sysdeps/mach/hurd/adjtime.c +++ b/sysdeps/mach/hurd/adjtime.c @@ -18,6 +18,7 @@ #include #include #include +#include /* Adjust the current time of day by the amount in DELTA. If OLDDELTA is not NULL, it is filled in with the amount @@ -44,7 +45,18 @@ __adjtime (const struct timeval *delta, struct timeval *olddelta) rpc_delta.microseconds = delta->tv_usec; } else +#ifdef MACH_ADJTIME_USECS_OMIT + { + /* gnumach will not attempt to update the system time if the + specified 'microseconds' is specifically + MACH_ADJTIME_USECS_OMIT. It will still return the olddelta + under these circumstances. */ + rpc_delta.seconds = 0; + rpc_delta.microseconds = MACH_ADJTIME_USECS_OMIT; + } +#else return EINVAL; +#endif err = __host_adjust_time (hostpriv, rpc_delta, &rpc_olddelta); __mach_port_deallocate (__mach_task_self (), hostpriv);