From nobody Sun May 08 13:17:10 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 761B01AD7B3D; Sun, 8 May 2022 13:17:11 +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 4Kx4bC0J82z4qNk; Sun, 8 May 2022 13:17:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652015831; 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=jlb2TZMzv+n3THDP4rtlDpUt67r79nwROrXcqZqA6Mw=; b=nUXpCgyC3wTa61rNq99KHZuyAZrMXwDDpxMmkyWxF27Uo8pUyOadT7wzpaNmkgBEpfQLY1 CW3I1aSG4nzrm40UJoIwo1pWz9PeKrTScfz6rKwA1YXn/QRLKW/pQq1raHPdPwnE4bDfKQ 7SFisQnLLnYGOjKJl9q/6Nj5PG+lB+Gf9gbk01cJt0axANJK7+0lzQeFiU0UhFceMDzvjc /Wsl0TpPoPA8QVpgWGLpk2L6LUB8GLfGbjZ3QpBPU1pIIJ14HBP79j09Hnfam3oWXkwVBb QvB/azJJFNxApnrxEdhJCkYnKy14gKHHUdpnZEWNRaf7LE+zgJVT3JOZz+tUJA== 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 B482425761; Sun, 8 May 2022 13:17:10 +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 248DHARM044061; Sun, 8 May 2022 13:17:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 248DHAHb044060; Sun, 8 May 2022 13:17:10 GMT (envelope-from git) Date: Sun, 8 May 2022 13:17:10 GMT Message-Id: <202205081317.248DHAHb044060@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 3dc2a06752b5 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 3dc2a06752b593acd1a76e784b169f3d60e81d00 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652015831; 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=jlb2TZMzv+n3THDP4rtlDpUt67r79nwROrXcqZqA6Mw=; b=nuFYwKfwlJSnWDHZN5x1ErnE2aYyyrGQhizGOihVTGE/MPovbLcwu8MpshQGAYde5hHPrL Xw/fZ58avoRRyAKBh/a+XAnaeW5MoWUuJIxtmMin8Tdg3lg4MZTR7eOvDFAwOQRAff9FmX KO2jsfgjv6anOIpgpcDLGyn7Rls4dD3Ff0mf0uB4epCzV8O8Xud1vZeh0+Pgm582aOdcE8 qc4FPMZtJam+Rj/3F/RqJXH5ADH5blo0A0XHvpR6Fpk6SEK/u76vG+xZAGjVzhCIpA1xHK 5blDkknklQWQJHDKJVINL1g/MspumfOcRhtaWVpKiAkjqpr55tTHIDWiA6FUIw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1652015831; a=rsa-sha256; cv=none; b=cnQf81mhNZyDw8R/jEOMG7WVZVWI5Kvt7EOHNiYxWFuU5iSCqtJ98rz2LFWZwVjijjcqbD D8jQBv2VF++ML5khrlNO0CLoeoK2JSZZ+sigT/1cRr7T7RKcgSmie80VnvlkYF0HqrwDsa qvdwUYZ7Vb1loWlduWO7MjPaSTJLXU5jXElx8yEvr5Xc4NmA05SGKUx41W4kZJtRVp3DXU U5jVR/e0/ilq0XwX3CP8dgyIjszAyi/ldJPu/ASjD2CyQq4PsOeZEKxAJv7x+rATyTQeN+ HtkWeDmR6e1w8jK2rV4jGMJBPTI0Ws/a5NUcYtOM46J3qMbNuA2yP/w3mkqRrA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=3dc2a06752b593acd1a76e784b169f3d60e81d00 commit 3dc2a06752b593acd1a76e784b169f3d60e81d00 Author: Dmitry Chagin AuthorDate: 2022-05-08 12:39:09 +0000 Commit: Dmitry Chagin CommitDate: 2022-05-08 12:39:09 +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 --- 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;