From nobody Tue Jan 02 01:13:01 2024 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 4T3vws6vZgz563CS; Tue, 2 Jan 2024 01:13:01 +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 4T3vws646lz3ZgB; Tue, 2 Jan 2024 01:13:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704157981; 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=+MgFeabOqtQD8mJkj365exxSCS823Iw+xcKDSovOD6E=; b=UlcE8qRW1atWMONLadQLtTyjd0AfWyirn8Jnl8Wgpjo8KEqyHtfC7Nk/id3c43sXZ6DrU3 WsoAP9FuASLP1xPv4bKHtLmmKnADWmsy8+30NZixGUQr4cZQXISDk67D4NPyvuzJhvOOLL Z9rfIK8ERjewsvEy0ddG0IbxpWK21uCwnqiDvaF5hbVGMAayspE9iMOUkhWRkfOIRVoKJo GrY1LnBKB34HylKaZFFmPUJnLz6yyYPpLOytDuExAmLpF01gmmjklSgYn9j9fV0fFi/iEa CB8MWO/IMmTghWOiWCMxw8mcb83tdn0PwIRJjjDUqMC34EtdnWzwJVS/hY4pEg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1704157981; a=rsa-sha256; cv=none; b=lZok4zq/O8kO+8qx57Ev72DWXcThswmqjQ+nHpiNqHxCx9FLibFnK37a7tRQ8ryvNEJ/+n 4ileBSdacnNFU1l86ml4sz+QTH6IyXSqYMnkTRZfhdQ8Qps3DvP/X2XJTIXcgEnNjInkca HGxOj95jYqZeZd9DukY5goQ9AjeHY5EfU/+ZOoPzEYmQxDtJ0NTM1wDHF5zTYyxwzc1X5k dpHTjmVsxcmcON6vZajGesu7pfMndY0IbykQQKKFrKG/C9XM3bz/xLacfAIo2cjMH6W2o8 Qe8LhhXpf+4IfMpumdACbmXwWdSQYWu5TvMn2tudLG9Ff1BY9+0UF3wxVAnPGQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704157981; 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=+MgFeabOqtQD8mJkj365exxSCS823Iw+xcKDSovOD6E=; b=wbWK16Mw0b34aEv8UlEhJJ8gzqz+y29Dj/SOp4/iTCqTePZEi/KMeI5WJmmWiSrYmtvPUJ Xz2fXyVoP/MLYvOsVjRWBbuZFmXBIotEwEptOG8r68oTmXIf+GjnF09fghUUybNGDXqteo bPydd2ovfppKHpYJF2xT293zWTfYf4xPbAfLw5NwshwGrB69ubILEGaI7pkJPPGqSG4hVk KiFL8P69n2fi5KMDpayW6O5EZaj21Mw85y/K4l6OG8WZlGoOI0VCEcgy5SbTvrOiJeQHF3 J7voDKRyQIs6iIup6IFrqda7MCVNoYD712QPcpd6+ZLLPKrVL2oBA7RNslNXRA== 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 4T3vws5081zgdm; Tue, 2 Jan 2024 01:13:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 4021D1Zw054891; Tue, 2 Jan 2024 01:13:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4021D14a054888; Tue, 2 Jan 2024 01:13:01 GMT (envelope-from git) Date: Tue, 2 Jan 2024 01:13:01 GMT Message-Id: <202401020113.4021D14a054888@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: dc2622bb27f7 - stable/13 - linux: Check for copyout errors in linux_fixup() 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: dc2622bb27f78b1119eb9cbd9db0e0c2b16fa099 Auto-Submitted: auto-generated The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=dc2622bb27f78b1119eb9cbd9db0e0c2b16fa099 commit dc2622bb27f78b1119eb9cbd9db0e0c2b16fa099 Author: Mark Johnston AuthorDate: 2023-12-26 01:40:05 +0000 Commit: Mark Johnston CommitDate: 2024-01-02 01:12:45 +0000 linux: Check for copyout errors in linux_fixup() This is in preparation for annotating copyin() and related functions with __result_use_check. Reviewed by: olce, dchagin MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D43104 (cherry picked from commit 3fde275167ce1f1455a03586d29840546d06d97a) --- sys/i386/linux/linux_sysvec.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c index ab29da91f64a..86e475866026 100644 --- a/sys/i386/linux/linux_sysvec.c +++ b/sys/i386/linux/linux_sysvec.c @@ -127,11 +127,14 @@ linux_fixup(uintptr_t *stack_base, struct image_params *imgp) argv = base; envp = base + (imgp->args->argc + 1); base--; - suword(base, (intptr_t)envp); + if (suword(base, (intptr_t)envp) != 0) + return (EFAULT); base--; - suword(base, (intptr_t)argv); + if (suword(base, (intptr_t)argv) != 0) + return (EFAULT); base--; - suword(base, imgp->args->argc); + if (suword(base, imgp->args->argc) != 0) + return (EFAULT); *stack_base = (uintptr_t)base; return (0); }