From nobody Wed Mar 30 03:09:32 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 61B811A5148F; Wed, 30 Mar 2022 03:09:33 +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 4KSry52FgZz3hWx; Wed, 30 Mar 2022 03:09:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648609773; 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=jdyH7tuU938CO98qYmEVMf/rkmJpLdQYLkIDM5EVGr8=; b=GI1pC96OxoXvG5qXX0ZvKypNUh+eohRGFIoXCnEjmu+J3bARsl8DfmzBN0qhf6/re5xpPS HJrV18gP9MaUWVxOrC9BWRfQtXa5l4Rz7Y/GyutdUczeiHVkizXQNCz4fF1ZuY6Dfw3VsV vOMTqy3Un9kHG9C1H1Qi6oYP8o6qAlcqkkbi5vYkaJIE4kgW/qbvWw5fTwUE9vb8nBDkhx 0dawTK5nUtgsJ6ymU7xsxQ6GIetmsH6ywNKAgNsBjCLo4dcvB+tTNhkRNFG2wiSaFtKEzq RPe7ptGV/RV7DpHKsGPNXna/aJZFSnATT5N1UPrxsdgXtbGqpjchDhzq0cIlVw== 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 28F2D29E8; Wed, 30 Mar 2022 03:09:33 +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 22U39Wih092832; Wed, 30 Mar 2022 03:09:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22U39WvV092831; Wed, 30 Mar 2022 03:09:32 GMT (envelope-from git) Date: Wed, 30 Mar 2022 03:09:32 GMT Message-Id: <202203300309.22U39WvV092831@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 015991cb9715 - releng/13.1 - Clear non-x86 compat stat syscall kernel stack memory disclosure 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.1 X-Git-Reftype: branch X-Git-Commit: 015991cb9715c4af620e11d3aa5da20eff7eac5d Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648609773; 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=jdyH7tuU938CO98qYmEVMf/rkmJpLdQYLkIDM5EVGr8=; b=rYC8yYosheiWDglEdQXk3Nr5nar2FbT0NKFtrPHEzCBU4HlmfXEL0FY97qeyAvOeufRmJ2 xeAY+WLKMqG/M2jtBi9NH5xAhvDbbkz4P2ZQfwIz7EBdhQGfMzH5kX4TTSAzn4W++69hKT A1BGK1x/gEIwKX5AG42opYvOF7xYSKm3B4smJnHFa1+6BxHT8GIkVOieuI5jcFbTxtGa7g FrIwyby3MC7Cb08x4o1V+XtRGc2fek4vGgnRoxxPIwID+pI5RRkz4RxLjhm81EQTLQ4v0c DaBBrSZxGqT1GEG0fJKwmdSIZLAw19V4LRXlj+nz0FjhvcSKChen9NwMX15yVg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1648609773; a=rsa-sha256; cv=none; b=N8JLZi/dtGxShi9b8E2qZMsMR/Vr98eMTdMnSnxNt27wt9RW5l4BJfOdJNEKSX1N++/8xb LbWPFu2WIKNI+zKaEDrg8XpYQi6C0euXcZi90PXmk+Ub4/ka0jt+NIt+op4K1Emaha6Mnm bKPrtz10ZJe4NXNfIWVbDhkWRLoj3smf8VQVCFUffHDqPKjwQgt0zIGRZ0FFGePMV8lgMI OHwTvyA+XUQQHL7z4aD8YKojJTutyVbGHb7D8YKCyyYk1gWWNVxbGPpvNoZcUzJ44w5Ff6 uUxb4jPQ9OMevDW9cSNRemZI7+Ufj8o2v6GJVpYZvdaGw4THPWTBdlBUMp4l+A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.1 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=015991cb9715c4af620e11d3aa5da20eff7eac5d commit 015991cb9715c4af620e11d3aa5da20eff7eac5d Author: Ed Maste AuthorDate: 2022-03-29 17:55:21 +0000 Commit: Ed Maste CommitDate: 2022-03-30 01:25:34 +0000 Clear non-x86 compat stat syscall kernel stack memory disclosure 32-bit architectures other than i386 have 64-bit time_t which results in a struct timespec with 12 bytes for tv_sec and tv_nsec, and 4 bytes of padding. Zero the padding holes in struct stat32 and struct freebsd11_stat32. i386 has 32-bit time_t; struct timespec is 8 bytes and has no padding. Found by inspection, prompted by a report by Reno Robert of Trend Micro Zero Day Initiative. The originally reported issue (ZDI-CAN-14538) is already fixed in all supported FreeBSD versions (it was addressed incidentally as part of the 64-bit inode project). Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D34709 (cherry picked from commit f90cd1ae30b5f49e9f6ea58a0628ce1c8d8822bc) (cherry picked from commit ccd701d27a747ea7266f434170169072e8686f30) Approved by: re (gjb) --- sys/compat/freebsd32/freebsd32_misc.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index e56ab423f538..4ef33774d6bb 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -2135,6 +2135,17 @@ static void copy_stat(struct stat *in, struct stat32 *out) { +#ifndef __amd64__ + /* + * 32-bit architectures other than i386 have 64-bit time_t. This + * results in struct timespec32 with 12 bytes for tv_sec and tv_nsec, + * and 4 bytes of padding. Zero the padding holes in struct stat32. + */ + bzero(&out->st_atim, sizeof(out->st_atim)); + bzero(&out->st_mtim, sizeof(out->st_mtim)); + bzero(&out->st_ctim, sizeof(out->st_ctim)); + bzero(&out->st_birthtim, sizeof(out->st_birthtim)); +#endif CP(*in, *out, st_dev); CP(*in, *out, st_ino); CP(*in, *out, st_mode); @@ -2296,6 +2307,18 @@ static int freebsd11_cvtstat32(struct stat *in, struct freebsd11_stat32 *out) { +#ifndef __amd64__ + /* + * 32-bit architectures other than i386 have 64-bit time_t. This + * results in struct timespec32 with 12 bytes for tv_sec and tv_nsec, + * and 4 bytes of padding. Zero the padding holes in freebsd11_stat32. + */ + bzero(&out->st_atim, sizeof(out->st_atim)); + bzero(&out->st_mtim, sizeof(out->st_mtim)); + bzero(&out->st_ctim, sizeof(out->st_ctim)); + bzero(&out->st_birthtim, sizeof(out->st_birthtim)); +#endif + CP(*in, *out, st_ino); if (in->st_ino != out->st_ino) { switch (ino64_trunc_error) {