From patchwork Thu Oct 14 21:17:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stafford Horne X-Patchwork-Id: 46248 X-Patchwork-Delegate: azanella@linux.vnet.ibm.com Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 174BB3857C51 for ; Thu, 14 Oct 2021 21:18:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 174BB3857C51 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1634246290; bh=mCFM4BI/IfsDr2NAgPi1kyLnosRloDxrlDnBaTuruyM=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=R9Ahk0LlzHp2L/z+SE0MUk9OLJgKJHu0LiEoFAFIAnRhnwOV6Ef/Wv/q+Zbdh3Wd7 RIwBOkI5gyL3bOvyUfV5DNU6EpfxCF8w/Pf3mtRbOQ9UyXvSfTzuDwVOkNd8nircr7 GVCtotied95/nE31ELq51hVLOoVJm02OLNMEGcgY= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by sourceware.org (Postfix) with ESMTPS id 4754E3858412 for ; Thu, 14 Oct 2021 21:17:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4754E3858412 Received: by mail-pf1-x42f.google.com with SMTP id q19so6586390pfl.4 for ; Thu, 14 Oct 2021 14:17:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=mCFM4BI/IfsDr2NAgPi1kyLnosRloDxrlDnBaTuruyM=; b=2/XQlaAa2pt8co6+Rv7cXqO8qBMDZ2Ud2HagQ4eZ6qj3vQKzC79IfjgM/DbD+OEgpi kIl62qJ2ahpLC+Wa9u/3Aspxymw94KEvdHjdGp1BZsvHje/lZE8Bl9RGhkNnUG6n+7iq q5ildODY2VDyvKN6lBLWvJgraRnSbRyvrz8Ptk5Um6xA08+0GXqCo37KFRJzcTmyPakZ QrhFtxc7psgYTEEeRoTDDvuNZcG0lTkweWYj0sJzlfrwicZgVLqrD0Y3kJtdZ3uWOB2H BbcKZgNd8X75iacRSScSuzlsZk4vcmT6CXLTGw2A/f6eTzVpf7T4PpPSu7h2ZEke5ljA UJnA== X-Gm-Message-State: AOAM531HLuZcOGw1FNFqsmQgby3e23UwWHhr/mrkQdNPYzie4ROKD62A bYBLSfhu8PK6bWTu454Vq1/N5PeZQiE= X-Google-Smtp-Source: ABdhPJwh7GaCXBQzohWNHv8mc42IOnaxkD34p0avsyxOnJE55yT4lzzi8MQJpT8S/J+EMAM4CpJ9XQ== X-Received: by 2002:a05:6a00:1344:b0:44c:4cd7:4d4b with SMTP id k4-20020a056a00134400b0044c4cd74d4bmr7822411pfu.50.1634246265516; Thu, 14 Oct 2021 14:17:45 -0700 (PDT) Received: from localhost ([2409:10:24a0:4700:e8ad:216a:2a9d:6d0c]) by smtp.gmail.com with ESMTPSA id p4sm3093647pgc.15.2021.10.14.14.17.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Oct 2021 14:17:44 -0700 (PDT) To: GLIBC patches Subject: [PATCH] timex: Use 64-bit fields on 32-bit TIMESIZE=64 systems Date: Fri, 15 Oct 2021 06:17:41 +0900 Message-Id: <20211014211741.2615945-1-shorne@gmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Stafford Horne via Libc-alpha From: Stafford Horne Reply-To: Stafford Horne Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" This was found when testing the OpenRISC port I am working on. These two tests fail with SIGSEGV: FAIL: misc/tst-ntp_gettime FAIL: misc/tst-ntp_gettimex This was found to be due to the kernel overwriting the stack space allocated by the timex structure. The reason for the overwrite being that the kernel timex has 64-bit fields and user space code only allocates enough stack space for timex with 32-bit fields. On 32-bit systems with TIMESIZE=64 __USE_TIME_BITS64 is not defined. This causes the timex structure to use 32-bit fields with type __syscall_slong_t. This patch adjusts the ifdef condition to allow 32-bit systems with TIMESIZE=64 to use the 64-bit long long timex definition. Reviewed-by: Adhemerval Zanella --- sysdeps/unix/sysv/linux/bits/timex.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sysdeps/unix/sysv/linux/bits/timex.h b/sysdeps/unix/sysv/linux/bits/timex.h index ee37694e8f..4a5db6deca 100644 --- a/sysdeps/unix/sysv/linux/bits/timex.h +++ b/sysdeps/unix/sysv/linux/bits/timex.h @@ -25,7 +25,7 @@ struct timex { -# ifdef __USE_TIME_BITS64 +# if defined __USE_TIME_BITS64 || (__TIMESIZE == 64 && __WORDSIZE == 32) unsigned int modes; /* mode selector */ int :32; /* pad */ long long offset; /* time offset (usec) */