From nobody Tue May 6 14:16:03 2025 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 4ZsL6D1v7jz5tspZ; Tue, 06 May 2025 14:16:04 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ZsL6D1FqSz497N; Tue, 06 May 2025 14:16:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1746540964; 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=WleD1uXpNduxMOlxU4OgsYPlQhhuuU6K5/wSgI7cb0k=; b=xfHNxygTzwGt3lNLQS61hf5lGZpiE1cVQLT7uUZeJW8uzyI3BbOPxoZlKXaMRP10t47p0Y 3UQn+AJKdGJU8GTg6Z0iPyROJfXokxTF34tiuwCSZv6GvnV3DuAkqonhKA6VD2v/6WKddA shP/L9TO+mcLpsBoSUfS6ZglybayBN6weqW59Mk7B5KNFjf07ffh5DJ+AuiAcCjevwsgn2 3arP58J4nBRYRF6BAUeWxDcYNVrIOnTFXedIYDD4t6yrrJ05Tou/qxvkLAQ7XYv5PfITeG DjwfCeElxbO0pt9Hksw6DRHoAlsXnOcstsC81TSnczICQVBywSR4myELSWIKGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1746540964; 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=WleD1uXpNduxMOlxU4OgsYPlQhhuuU6K5/wSgI7cb0k=; b=DANipuOGj8FNCgLIKeHpGWijED7K2dSkcb0CPth/cwVej5GME1AvTK4HtBPMkcKX7zbbE3 zpp8hYDczCmXhX/DX0yCUry3vI0tYQpV2U9LlFFGqZZGedE1g3mawwxMp4P7POlhaOS34B +uOuZQlfMb+ZVmkmlmuuifM5O8g8YC5VqUomllE/E2bYhJA8D4S0ipf8qkKDaE4eXMwaF5 XfFmVsMj9SNfImF4tug5CcmFE2T2tirsoamkku/75d+CEvrKN6mtNqbrLdJ4+PNsPvELhy Ky1p+0CnMygDnvsJsJG6AVqslIvzSg8Q+B/O8GeeSMh1NwMKtx0YWhISkcF1Fg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1746540964; a=rsa-sha256; cv=none; b=CVJ4xlJ+8Y/iXg7JRUSRKmMEag39DFxeA6E9rFeAIvZiBzX7Et+zMJOjCDgX57lMHgQ1OJ V/1cNDktA80A/0FW9yHp6m3wr4j3futQXyOLYhOM7I99OiHPy8wR/EDXFNoJckbBuJslaG 0S92PE7Bo5PqpoPqEm77+s+pIEhwwY+l8SY8wc3KDMwiWTa5R7ZUG/BGTmvUYxIRBrLDsv febDA+1sSfBgHNLbjyLUg0OH4pSNxVuZAyQx682PL+KbbX19JxZeGySCnIJRYdwKYgkQAz GJx0aE+D2da3OFStNjJoFTuGzCNT9QoyuOL4DYa/bEF3vSgAnQ9W9AeSTXtyMQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4ZsL6D0JyYz13Sm; Tue, 06 May 2025 14:16:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 546EG35W051166; Tue, 6 May 2025 14:16:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 546EG37u051163; Tue, 6 May 2025 14:16:03 GMT (envelope-from git) Date: Tue, 6 May 2025 14:16:03 GMT Message-Id: <202505061416.546EG37u051163@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: 773ef40696c6 - stable/14 - exec: Remove parameter 'segflg' from exec_copyin_args() 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-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/14 X-Git-Reftype: branch X-Git-Commit: 773ef40696c6335a1ed8ffaa6401777ac0ce716d Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=773ef40696c6335a1ed8ffaa6401777ac0ce716d commit 773ef40696c6335a1ed8ffaa6401777ac0ce716d Author: Wuyang Chung AuthorDate: 2025-02-05 06:54:54 +0000 Commit: Mark Johnston CommitDate: 2025-05-06 14:15:38 +0000 exec: Remove parameter 'segflg' from exec_copyin_args() In kern "copyin" means copy data from user address space to kernel address space. But in the function exec_copyin_args() there is a parameter 'segflg' that is used to specify the address space of the parameter 'fname'. In the source code there are two places where 'segflg' are not UIO_USERSPACE. In both cases the 'fname' argument are NULL so the argument 'segflg' are not important there. So it is safe to remove the parameter 'segflg' from the function exec_copyin_args(). Reviewed by: markj, jhb MFC after: 2 weeks Pull Request: https://github.com/freebsd/freebsd-src/pull/1590 (cherry picked from commit 15581af7c2d30360313dcad74dc5dc83c02f9df0) --- sys/compat/freebsd32/freebsd32_misc.c | 11 +++++------ sys/compat/freebsd32/freebsd32_util.h | 2 +- sys/compat/linux/linux_misc.c | 8 ++++---- sys/kern/kern_exec.c | 13 +++++-------- sys/sys/imgact.h | 3 +-- 5 files changed, 16 insertions(+), 21 deletions(-) diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index 81715ed102b3..a8331897316d 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -401,7 +401,7 @@ freebsd32_sigaltstack(struct thread *td, */ int freebsd32_exec_copyin_args(struct image_args *args, const char *fname, - enum uio_seg segflg, uint32_t *argv, uint32_t *envv) + uint32_t *argv, uint32_t *envv) { char *argp, *envp; uint32_t *p32, arg; @@ -422,7 +422,7 @@ freebsd32_exec_copyin_args(struct image_args *args, const char *fname, /* * Copy the file name. */ - error = exec_args_add_fname(args, fname, segflg); + error = exec_args_add_fname(args, fname, UIO_USERSPACE); if (error != 0) goto err_exit; @@ -477,8 +477,8 @@ freebsd32_execve(struct thread *td, struct freebsd32_execve_args *uap) error = pre_execve(td, &oldvmspace); if (error != 0) return (error); - error = freebsd32_exec_copyin_args(&eargs, uap->fname, UIO_USERSPACE, - uap->argv, uap->envv); + error = freebsd32_exec_copyin_args(&eargs, uap->fname, uap->argv, + uap->envv); if (error == 0) error = kern_execve(td, &eargs, NULL, oldvmspace); post_execve(td, error, oldvmspace); @@ -496,8 +496,7 @@ freebsd32_fexecve(struct thread *td, struct freebsd32_fexecve_args *uap) error = pre_execve(td, &oldvmspace); if (error != 0) return (error); - error = freebsd32_exec_copyin_args(&eargs, NULL, UIO_SYSSPACE, - uap->argv, uap->envv); + error = freebsd32_exec_copyin_args(&eargs, NULL, uap->argv, uap->envv); if (error == 0) { eargs.fd = uap->fd; error = kern_execve(td, &eargs, NULL, oldvmspace); diff --git a/sys/compat/freebsd32/freebsd32_util.h b/sys/compat/freebsd32/freebsd32_util.h index 93b574ec9422..d18dd50e4951 100644 --- a/sys/compat/freebsd32/freebsd32_util.h +++ b/sys/compat/freebsd32/freebsd32_util.h @@ -120,7 +120,7 @@ void freebsd32_rusage_out(const struct rusage *s, struct rusage32 *s32); struct image_args; int freebsd32_exec_copyin_args(struct image_args *args, const char *fname, - enum uio_seg segflg, uint32_t *argv, uint32_t *envv); + uint32_t *argv, uint32_t *envv); struct kinfo_knote; struct kinfo_knote32; diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index b87c05322e16..855c1d885164 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -2586,7 +2586,7 @@ linux_seccomp(struct thread *td, struct linux_seccomp_args *args) */ static int linux_exec_copyin_args(struct image_args *args, const char *fname, - enum uio_seg segflg, l_uintptr_t *argv, l_uintptr_t *envv) + l_uintptr_t *argv, l_uintptr_t *envv) { char *argp, *envp; l_uintptr_t *ptr, arg; @@ -2607,7 +2607,7 @@ linux_exec_copyin_args(struct image_args *args, const char *fname, /* * Copy the file name. */ - error = exec_args_add_fname(args, fname, segflg); + error = exec_args_add_fname(args, fname, UIO_USERSPACE); if (error != 0) goto err_exit; @@ -2670,8 +2670,8 @@ linux_execve(struct thread *td, struct linux_execve_args *args) LINUX_CTR(execve); - error = linux_exec_copyin_args(&eargs, args->path, UIO_USERSPACE, - args->argp, args->envp); + error = linux_exec_copyin_args(&eargs, args->path, args->argp, + args->envp); if (error == 0) error = linux_common_execve(td, &eargs); AUDIT_SYSCALL_EXIT(error == EJUSTRETURN ? 0 : error, td); diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 6727872b5b10..f4197609a700 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -225,8 +225,7 @@ sys_execve(struct thread *td, struct execve_args *uap) error = pre_execve(td, &oldvmspace); if (error != 0) return (error); - error = exec_copyin_args(&args, uap->fname, UIO_USERSPACE, - uap->argv, uap->envv); + error = exec_copyin_args(&args, uap->fname, uap->argv, uap->envv); if (error == 0) error = kern_execve(td, &args, NULL, oldvmspace); post_execve(td, error, oldvmspace); @@ -251,8 +250,7 @@ sys_fexecve(struct thread *td, struct fexecve_args *uap) error = pre_execve(td, &oldvmspace); if (error != 0) return (error); - error = exec_copyin_args(&args, NULL, UIO_SYSSPACE, - uap->argv, uap->envv); + error = exec_copyin_args(&args, NULL, uap->argv, uap->envv); if (error == 0) { args.fd = uap->fd; error = kern_execve(td, &args, NULL, oldvmspace); @@ -282,8 +280,7 @@ sys___mac_execve(struct thread *td, struct __mac_execve_args *uap) error = pre_execve(td, &oldvmspace); if (error != 0) return (error); - error = exec_copyin_args(&args, uap->fname, UIO_USERSPACE, - uap->argv, uap->envv); + error = exec_copyin_args(&args, uap->fname, uap->argv, uap->envv); if (error == 0) error = kern_execve(td, &args, uap->mac_p, oldvmspace); post_execve(td, error, oldvmspace); @@ -1319,7 +1316,7 @@ out: */ int exec_copyin_args(struct image_args *args, const char *fname, - enum uio_seg segflg, char **argv, char **envv) + char **argv, char **envv) { u_long arg, env; int error; @@ -1339,7 +1336,7 @@ exec_copyin_args(struct image_args *args, const char *fname, /* * Copy the file name. */ - error = exec_args_add_fname(args, fname, segflg); + error = exec_args_add_fname(args, fname, UIO_USERSPACE); if (error != 0) goto err_exit; diff --git a/sys/sys/imgact.h b/sys/sys/imgact.h index 4f0c8aff9f42..c1c94a2eabfd 100644 --- a/sys/sys/imgact.h +++ b/sys/sys/imgact.h @@ -119,8 +119,7 @@ int exec_map_stack(struct image_params *); int exec_new_vmspace(struct image_params *, struct sysentvec *); void exec_setregs(struct thread *, struct image_params *, uintptr_t); int exec_shell_imgact(struct image_params *); -int exec_copyin_args(struct image_args *, const char *, enum uio_seg, - char **, char **); +int exec_copyin_args(struct image_args *, const char *, char **, char **); int pre_execve(struct thread *td, struct vmspace **oldvmspace); void post_execve(struct thread *td, int error, struct vmspace *oldvmspace); #endif