Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Jan 2024 01:13:01 GMT
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: dc2622bb27f7 - stable/13 - linux: Check for copyout errors in linux_fixup()
Message-ID:  <202401020113.4021D14a054888@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=dc2622bb27f78b1119eb9cbd9db0e0c2b16fa099

commit dc2622bb27f78b1119eb9cbd9db0e0c2b16fa099
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2023-12-26 01:40:05 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
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);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202401020113.4021D14a054888>