From nobody Fri Jun 17 19:40:04 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 60D0285CA2D; Fri, 17 Jun 2022 19:40:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LPqBY3y4bz3hGX; Fri, 17 Jun 2022 19:40:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655494805; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yvHTKPKKcXHGoux6b261PsKo7jh+popAz23ukLkJ1Gk=; b=jBbsg+hrgxVGwxMHqm0iM4D4jYHKjrtbEys/hFi0NybHmZx4aCImC+So5A7nmMAgejOsBp g8WGkk33nsiLIw2b1xSSdpMB/xrdOuuQi4OhlfhqhSDHZZTYCRvCRU0BHuoBKEqVc6yhkd p0+3kDU1RpAHRBlADP1E+UQI5td0DfgAsQ4ZXlSlAYaDj0pgEHZlqCPFQX+UBuGFj+cQVK Phi/Iwrg30euBhja/LaAcbAUE0oI6bKNaYnAEac9Cjc5nSc8x1RqxZ4Rvg/Btlwbsy1twR scwPUDtrNa615FlGqWqVlJu5M3CMs2L5iPvBn++lbrUnlefma7Em7mlszsWf9w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F38D5257E6; Fri, 17 Jun 2022 19:40:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 25HJe4xv019298; Fri, 17 Jun 2022 19:40:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25HJe4se019296; Fri, 17 Jun 2022 19:40:04 GMT (envelope-from git) Date: Fri, 17 Jun 2022 19:40:04 GMT Message-Id: <202206171940.25HJe4se019296@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Chagin Subject: git: 34f633b6a7aa - stable/13 - linux(4): Prevent time_t overflows on i386. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 34f633b6a7aa2ad953239619563c446e8da16ec0 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655494805; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yvHTKPKKcXHGoux6b261PsKo7jh+popAz23ukLkJ1Gk=; b=Mt63Q8KVjnpQHdpfvdC1vMm4rD43+SonIqtN4Lz5Lfm6veAL/nX1Xm1vG1WaKT6LeEDc5q y9BF+ADdW2roqG/DwE50veC+9XJLR1YJ26SepYQnSe+B3b+LDuOu/EZer2MtcvgX/EPHPj P9hiwdqEa/R1++Jql1wr1Ecf5UIKt+y0JM0ODGkASH7iSzvtRrdVaixh6hrVa0ZrSQmaWt ys4GfGnE6+6f87zNZnbhpfQvR37asaTa1mgfkmmjputHc2hkQvWQJZwiCWf9VLI5uDMHwB 33eoywyWcUC6IlDxsthJDCM/liL4jQCqRbcraPBviMjsucaBF+/1/5fO5HBYZg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1655494805; a=rsa-sha256; cv=none; b=v7Vm6BYq7DXtTZQw97z3HCGuOBdFdGlRMOJVpoAYUyfvgkhWM+ZVh+YpNS0R0d1JmCq4zX UwrVUmEH90iNXtQQyih3MG5POHM7FPfejaa0rTDRcy51LLD2zIOjjnApDYwRfLx6XSb4F2 KISme6qFH09A+HGqgR1zNQG7YkscNqdoWiXnUAyDuEyT3m2E5PqIY0kyGlHXUgzi+4GtDC TPGen0r/re0i5wfvk4MpptvLTvad/eUO8hdH+fBoOZL4a0qggxm5tXrJZwAEuYpp8mf/4m w9v/yTxTPZtaZ/bOc1zKHBSpG+arVLsDTzAylIYvIiuB3aNi0FqfMAmT/De8pw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=34f633b6a7aa2ad953239619563c446e8da16ec0 commit 34f633b6a7aa2ad953239619563c446e8da16ec0 Author: Dmitry Chagin AuthorDate: 2022-05-08 12:39:09 +0000 Commit: Dmitry Chagin CommitDate: 2022-06-17 19:34:59 +0000 linux(4): Prevent time_t overflows on i386. As native i386 time_t is still 32-bit, check that the user-provided 64-bit tv_sec value fits to the kernel time_t, return EOVERFLOW if not. MFC after: 2 weeks (cherry picked from commit 3dc2a06752b593acd1a76e784b169f3d60e81d00) --- sys/compat/linux/linux_time.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/compat/linux/linux_time.c b/sys/compat/linux/linux_time.c index d4f502eee7c6..0f1af6b3a5cf 100644 --- a/sys/compat/linux/linux_time.c +++ b/sys/compat/linux/linux_time.c @@ -177,6 +177,11 @@ int linux_to_native_timespec64(struct timespec *ntp, struct l_timespec64 *ltp64) { +#if defined(__i386__) + /* i386 time_t is still 32-bit */ + if (ltp64->tv_sec > INT_MAX || ltp64->tv_sec < INT_MIN) + return (EOVERFLOW); +#endif /* Zero out the padding in compat mode. */ ntp->tv_nsec = ltp64->tv_nsec & 0xFFFFFFFFUL; ntp->tv_sec = ltp64->tv_sec;