git: af4051d25055 - main - linux: remove the always curthread argument from lconvpath

From: Mateusz Guzik <mjg_at_FreeBSD.org>
Date: Thu, 25 Nov 2021 22:50:48 UTC
The branch main has been updated by mjg:

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

commit af4051d25055fee086c0f78421e68fec20640f17
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2021-11-25 21:42:13 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2021-11-25 22:50:42 +0000

    linux: remove the always curthread argument from lconvpath
---
 sys/amd64/linux/linux_machdep.c     |  2 +-
 sys/amd64/linux32/linux32_machdep.c |  2 +-
 sys/arm64/linux/linux_machdep.c     |  2 +-
 sys/compat/linux/linux_emul.c       |  5 ++-
 sys/compat/linux/linux_file.c       | 70 ++++++++++++++++++-------------------
 sys/compat/linux/linux_misc.c       | 14 ++++----
 sys/compat/linux/linux_stats.c      | 22 ++++++------
 sys/compat/linux/linux_uid16.c      |  4 +--
 sys/compat/linux/linux_util.c       |  4 +--
 sys/compat/linux/linux_util.h       | 18 +++++-----
 sys/i386/linux/linux_machdep.c      |  2 +-
 11 files changed, 72 insertions(+), 73 deletions(-)

diff --git a/sys/amd64/linux/linux_machdep.c b/sys/amd64/linux/linux_machdep.c
index 67429a1c049f..18be62dab9ae 100644
--- a/sys/amd64/linux/linux_machdep.c
+++ b/sys/amd64/linux/linux_machdep.c
@@ -111,7 +111,7 @@ linux_execve(struct thread *td, struct linux_execve_args *args)
 		error = exec_copyin_args(&eargs, args->path, UIO_USERSPACE,
 		    args->argp, args->envp);
 	} else {
-		LCONVPATHEXIST(td, args->path, &path);
+		LCONVPATHEXIST(args->path, &path);
 		error = exec_copyin_args(&eargs, path, UIO_SYSSPACE, args->argp,
 		    args->envp);
 		LFREEPATH(path);
diff --git a/sys/amd64/linux32/linux32_machdep.c b/sys/amd64/linux32/linux32_machdep.c
index 86f7bdc918d8..9dd988452a1c 100644
--- a/sys/amd64/linux32/linux32_machdep.c
+++ b/sys/amd64/linux32/linux32_machdep.c
@@ -134,7 +134,7 @@ linux_execve(struct thread *td, struct linux_execve_args *args)
 	char *path;
 	int error;
 
-	LCONVPATHEXIST(td, args->path, &path);
+	LCONVPATHEXIST(args->path, &path);
 
 	error = freebsd32_exec_copyin_args(&eargs, path, UIO_SYSSPACE,
 	    args->argp, args->envp);
diff --git a/sys/arm64/linux/linux_machdep.c b/sys/arm64/linux/linux_machdep.c
index 89b7099dc752..749e097730f7 100644
--- a/sys/arm64/linux/linux_machdep.c
+++ b/sys/arm64/linux/linux_machdep.c
@@ -74,7 +74,7 @@ linux_execve(struct thread *td, struct linux_execve_args *uap)
 		error = exec_copyin_args(&eargs, uap->path, UIO_USERSPACE,
 		    uap->argp, uap->envp);
 	} else {
-		LCONVPATHEXIST(td, uap->path, &path);
+		LCONVPATHEXIST(uap->path, &path);
 		error = exec_copyin_args(&eargs, path, UIO_SYSSPACE,
 		    uap->argp, uap->envp);
 		LFREEPATH(path);
diff --git a/sys/compat/linux/linux_emul.c b/sys/compat/linux/linux_emul.c
index 83c82fc84fee..f99f31fb668b 100644
--- a/sys/compat/linux/linux_emul.c
+++ b/sys/compat/linux/linux_emul.c
@@ -238,9 +238,8 @@ linux_exec_imgact_try(struct image_params *imgp)
 		 * alternate path is found, use our stringspace to store it.
 		 */
 		if ((error = exec_shell_imgact(imgp)) == 0) {
-			linux_emul_convpath(FIRST_THREAD_IN_PROC(imgp->proc),
-			    imgp->interpreter_name, UIO_SYSSPACE, &rpath, 0,
-			    AT_FDCWD);
+			linux_emul_convpath(imgp->interpreter_name, UIO_SYSSPACE,
+			    &rpath, 0, AT_FDCWD);
 			if (rpath != NULL)
 				imgp->args->fname_buf =
 				    imgp->interpreter_name = rpath;
diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c
index bda843286b26..285faaf8927b 100644
--- a/sys/compat/linux/linux_file.c
+++ b/sys/compat/linux/linux_file.c
@@ -115,7 +115,7 @@ linux_creat(struct thread *td, struct linux_creat_args *args)
 		return (kern_openat(td, AT_FDCWD, args->path, UIO_USERSPACE,
 		    O_WRONLY | O_CREAT | O_TRUNC, args->mode));
 	}
-	LCONVPATHEXIST(td, args->path, &path);
+	LCONVPATHEXIST(args->path, &path);
 	error = kern_openat(td, AT_FDCWD, path, UIO_SYSSPACE,
 	    O_WRONLY | O_CREAT | O_TRUNC, args->mode);
 	LFREEPATH(path);
@@ -234,9 +234,9 @@ linux_openat(struct thread *td, struct linux_openat_args *args)
 		    args->mode, UIO_USERSPACE));
 	}
 	if (args->flags & LINUX_O_CREAT)
-		LCONVPATH_AT(td, args->filename, &path, 1, dfd);
+		LCONVPATH_AT(args->filename, &path, 1, dfd);
 	else
-		LCONVPATH_AT(td, args->filename, &path, 0, dfd);
+		LCONVPATH_AT(args->filename, &path, 0, dfd);
 
 	error = linux_common_open(td, dfd, path, args->flags, args->mode,
 	    UIO_SYSSPACE);
@@ -256,9 +256,9 @@ linux_open(struct thread *td, struct linux_open_args *args)
 		    args->mode, UIO_USERSPACE));
 	}
 	if (args->flags & LINUX_O_CREAT)
-		LCONVPATHCREAT(td, args->path, &path);
+		LCONVPATHCREAT(args->path, &path);
 	else
-		LCONVPATHEXIST(td, args->path, &path);
+		LCONVPATHEXIST(args->path, &path);
 
 	error = linux_common_open(td, AT_FDCWD, path, args->flags, args->mode,
 	    UIO_SYSSPACE);
@@ -299,7 +299,7 @@ linux_name_to_handle_at(struct thread *td,
 	} else {
 		char *path;
 
-		LCONVPATH_AT(td, args->name, &path, 0, fd);
+		LCONVPATH_AT(args->name, &path, 0, fd);
 		error = kern_getfhat(td, bsd_flags, fd, path, UIO_SYSSPACE,
 		    &fh, UIO_SYSSPACE);
 		LFREEPATH(path);
@@ -665,7 +665,7 @@ linux_access(struct thread *td, struct linux_access_args *args)
 		error = kern_accessat(td, AT_FDCWD, args->path, UIO_USERSPACE, 0,
 		    args->amode);
 	} else {
-		LCONVPATHEXIST(td, args->path, &path);
+		LCONVPATHEXIST(args->path, &path);
 		error = kern_accessat(td, AT_FDCWD, path, UIO_SYSSPACE, 0,
 		    args->amode);
 		LFREEPATH(path);
@@ -690,7 +690,7 @@ linux_do_accessat(struct thread *td, int ldfd, const char *filename,
 	if (!LUSECONVPATH(td)) {
 		error = kern_accessat(td, dfd, filename, UIO_USERSPACE, flags, amode);
 	} else {
-		LCONVPATHEXIST_AT(td, filename, &path, dfd);
+		LCONVPATHEXIST_AT(filename, &path, dfd);
 		error = kern_accessat(td, dfd, path, UIO_SYSSPACE, flags, amode);
 		LFREEPATH(path);
 	}
@@ -747,7 +747,7 @@ linux_unlink(struct thread *td, struct linux_unlink_args *args)
 			}
 		}
 	} else {
-		LCONVPATHEXIST(td, args->path, &path);
+		LCONVPATHEXIST(args->path, &path);
 		error = kern_funlinkat(td, AT_FDCWD, path, FD_NONE, UIO_SYSSPACE, 0, 0);
 		if (error == EPERM) {
 			/* Introduce POSIX noncompliant behaviour of Linux */
@@ -797,7 +797,7 @@ linux_unlinkat(struct thread *td, struct linux_unlinkat_args *args)
 		return (linux_unlinkat_impl(td, UIO_USERSPACE, args->pathname,
 		    dfd, args));
 	}
-	LCONVPATHEXIST_AT(td, args->pathname, &path, dfd);
+	LCONVPATHEXIST_AT(args->pathname, &path, dfd);
 	error = linux_unlinkat_impl(td, UIO_SYSSPACE, path, dfd, args);
 	LFREEPATH(path);
 	return (error);
@@ -811,7 +811,7 @@ linux_chdir(struct thread *td, struct linux_chdir_args *args)
 	if (!LUSECONVPATH(td)) {
 		return (kern_chdir(td, args->path, UIO_USERSPACE));
 	}
-	LCONVPATHEXIST(td, args->path, &path);
+	LCONVPATHEXIST(args->path, &path);
 	error = kern_chdir(td, path, UIO_SYSSPACE);
 	LFREEPATH(path);
 	return (error);
@@ -828,7 +828,7 @@ linux_chmod(struct thread *td, struct linux_chmod_args *args)
 		return (kern_fchmodat(td, AT_FDCWD, args->path, UIO_USERSPACE,
 		    args->mode, 0));
 	}
-	LCONVPATHEXIST(td, args->path, &path);
+	LCONVPATHEXIST(args->path, &path);
 	error = kern_fchmodat(td, AT_FDCWD, path, UIO_SYSSPACE, args->mode, 0);
 	LFREEPATH(path);
 	return (error);
@@ -846,7 +846,7 @@ linux_fchmodat(struct thread *td, struct linux_fchmodat_args *args)
 		return (kern_fchmodat(td, dfd, args->filename, UIO_USERSPACE,
 		    args->mode, 0));
 	}
-	LCONVPATHEXIST_AT(td, args->filename, &path, dfd);
+	LCONVPATHEXIST_AT(args->filename, &path, dfd);
 	error = kern_fchmodat(td, dfd, path, UIO_SYSSPACE, args->mode, 0);
 	LFREEPATH(path);
 	return (error);
@@ -862,7 +862,7 @@ linux_mkdir(struct thread *td, struct linux_mkdir_args *args)
 	if (!LUSECONVPATH(td)) {
 		return (kern_mkdirat(td, AT_FDCWD, args->path, UIO_USERSPACE, args->mode));
 	}
-	LCONVPATHCREAT(td, args->path, &path);
+	LCONVPATHCREAT(args->path, &path);
 	error = kern_mkdirat(td, AT_FDCWD, path, UIO_SYSSPACE, args->mode);
 	LFREEPATH(path);
 	return (error);
@@ -879,7 +879,7 @@ linux_mkdirat(struct thread *td, struct linux_mkdirat_args *args)
 	if (!LUSECONVPATH(td)) {
 		return (kern_mkdirat(td, dfd, args->pathname, UIO_USERSPACE, args->mode));
 	}
-	LCONVPATHCREAT_AT(td, args->pathname, &path, dfd);
+	LCONVPATHCREAT_AT(args->pathname, &path, dfd);
 	error = kern_mkdirat(td, dfd, path, UIO_SYSSPACE, args->mode);
 	LFREEPATH(path);
 	return (error);
@@ -896,7 +896,7 @@ linux_rmdir(struct thread *td, struct linux_rmdir_args *args)
 		return (kern_frmdirat(td, AT_FDCWD, args->path, FD_NONE,
 		    UIO_USERSPACE, 0));
 	}
-	LCONVPATHEXIST(td, args->path, &path);
+	LCONVPATHEXIST(args->path, &path);
 	error = kern_frmdirat(td, AT_FDCWD, path, FD_NONE, UIO_SYSSPACE, 0);
 	LFREEPATH(path);
 	return (error);
@@ -912,9 +912,9 @@ linux_rename(struct thread *td, struct linux_rename_args *args)
 		return (kern_renameat(td, AT_FDCWD, args->from, AT_FDCWD,
 		    args->to, UIO_USERSPACE));
 	}
-	LCONVPATHEXIST(td, args->from, &from);
+	LCONVPATHEXIST(args->from, &from);
 	/* Expand LCONVPATHCREATE so that `from' can be freed on errors */
-	error = linux_emul_convpath(td, args->to, UIO_USERSPACE, &to, 1, AT_FDCWD);
+	error = linux_emul_convpath(args->to, UIO_USERSPACE, &to, 1, AT_FDCWD);
 	if (to == NULL) {
 		LFREEPATH(from);
 		return (error);
@@ -973,9 +973,9 @@ linux_renameat2(struct thread *td, struct linux_renameat2_args *args)
 		return (kern_renameat(td, olddfd, args->oldname, newdfd,
 		    args->newname, UIO_USERSPACE));
 	}
-	LCONVPATHEXIST_AT(td, args->oldname, &from, olddfd);
+	LCONVPATHEXIST_AT(args->oldname, &from, olddfd);
 	/* Expand LCONVPATHCREATE so that `from' can be freed on errors */
-	error = linux_emul_convpath(td, args->newname, UIO_USERSPACE, &to, 1, newdfd);
+	error = linux_emul_convpath(args->newname, UIO_USERSPACE, &to, 1, newdfd);
 	if (to == NULL) {
 		LFREEPATH(from);
 		return (error);
@@ -997,9 +997,9 @@ linux_symlink(struct thread *td, struct linux_symlink_args *args)
 		return (kern_symlinkat(td, args->path, AT_FDCWD, args->to,
 		    UIO_USERSPACE));
 	}
-	LCONVPATHEXIST(td, args->path, &path);
+	LCONVPATHEXIST(args->path, &path);
 	/* Expand LCONVPATHCREATE so that `path' can be freed on errors */
-	error = linux_emul_convpath(td, args->to, UIO_USERSPACE, &to, 1, AT_FDCWD);
+	error = linux_emul_convpath(args->to, UIO_USERSPACE, &to, 1, AT_FDCWD);
 	if (to == NULL) {
 		LFREEPATH(path);
 		return (error);
@@ -1022,9 +1022,9 @@ linux_symlinkat(struct thread *td, struct linux_symlinkat_args *args)
 		return (kern_symlinkat(td, args->oldname, dfd, args->newname,
 		    UIO_USERSPACE));
 	}
-	LCONVPATHEXIST(td, args->oldname, &path);
+	LCONVPATHEXIST(args->oldname, &path);
 	/* Expand LCONVPATHCREATE so that `path' can be freed on errors */
-	error = linux_emul_convpath(td, args->newname, UIO_USERSPACE, &to, 1, dfd);
+	error = linux_emul_convpath(args->newname, UIO_USERSPACE, &to, 1, dfd);
 	if (to == NULL) {
 		LFREEPATH(path);
 		return (error);
@@ -1046,7 +1046,7 @@ linux_readlink(struct thread *td, struct linux_readlink_args *args)
 		return (kern_readlinkat(td, AT_FDCWD, args->name, UIO_USERSPACE,
 		    args->buf, UIO_USERSPACE, args->count));
 	}
-	LCONVPATHEXIST(td, args->name, &name);
+	LCONVPATHEXIST(args->name, &name);
 	error = kern_readlinkat(td, AT_FDCWD, name, UIO_SYSSPACE,
 	    args->buf, UIO_USERSPACE, args->count);
 	LFREEPATH(name);
@@ -1065,7 +1065,7 @@ linux_readlinkat(struct thread *td, struct linux_readlinkat_args *args)
 		return (kern_readlinkat(td, dfd, args->path, UIO_USERSPACE,
 		    args->buf, UIO_USERSPACE, args->bufsiz));
 	}
-	LCONVPATHEXIST_AT(td, args->path, &name, dfd);
+	LCONVPATHEXIST_AT(args->path, &name, dfd);
 	error = kern_readlinkat(td, dfd, name, UIO_SYSSPACE, args->buf,
 	    UIO_USERSPACE, args->bufsiz);
 	LFREEPATH(name);
@@ -1081,7 +1081,7 @@ linux_truncate(struct thread *td, struct linux_truncate_args *args)
 	if (!LUSECONVPATH(td)) {
 		return (kern_truncate(td, args->path, UIO_USERSPACE, args->length));
 	}
-	LCONVPATHEXIST(td, args->path, &path);
+	LCONVPATHEXIST(args->path, &path);
 	error = kern_truncate(td, path, UIO_SYSSPACE, args->length);
 	LFREEPATH(path);
 	return (error);
@@ -1104,7 +1104,7 @@ linux_truncate64(struct thread *td, struct linux_truncate64_args *args)
 	if (!LUSECONVPATH(td)) {
 		return (kern_truncate(td, args->path, UIO_USERSPACE, length));
 	}
-	LCONVPATHEXIST(td, args->path, &path);
+	LCONVPATHEXIST(args->path, &path);
 	error = kern_truncate(td, path, UIO_SYSSPACE, length);
 	LFREEPATH(path);
 	return (error);
@@ -1145,9 +1145,9 @@ linux_link(struct thread *td, struct linux_link_args *args)
 		return (kern_linkat(td, AT_FDCWD, AT_FDCWD, args->path, args->to,
 		    UIO_USERSPACE, AT_SYMLINK_FOLLOW));
 	}
-	LCONVPATHEXIST(td, args->path, &path);
+	LCONVPATHEXIST(args->path, &path);
 	/* Expand LCONVPATHCREATE so that `path' can be freed on errors */
-	error = linux_emul_convpath(td, args->to, UIO_USERSPACE, &to, 1, AT_FDCWD);
+	error = linux_emul_convpath(args->to, UIO_USERSPACE, &to, 1, AT_FDCWD);
 	if (to == NULL) {
 		LFREEPATH(path);
 		return (error);
@@ -1179,9 +1179,9 @@ linux_linkat(struct thread *td, struct linux_linkat_args *args)
 		return (kern_linkat(td, olddfd, newdfd, args->oldname,
 		    args->newname, UIO_USERSPACE, flag));
 	}
-	LCONVPATHEXIST_AT(td, args->oldname, &path, olddfd);
+	LCONVPATHEXIST_AT(args->oldname, &path, olddfd);
 	/* Expand LCONVPATHCREATE so that `path' can be freed on errors */
-	error = linux_emul_convpath(td, args->newname, UIO_USERSPACE, &to, 1, newdfd);
+	error = linux_emul_convpath(args->newname, UIO_USERSPACE, &to, 1, newdfd);
 	if (to == NULL) {
 		LFREEPATH(path);
 		return (error);
@@ -1775,7 +1775,7 @@ linux_chown(struct thread *td, struct linux_chown_args *args)
 		return (kern_fchownat(td, AT_FDCWD, args->path, UIO_USERSPACE,
 		    args->uid, args->gid, 0));
 	}
-	LCONVPATHEXIST(td, args->path, &path);
+	LCONVPATHEXIST(args->path, &path);
 	error = kern_fchownat(td, AT_FDCWD, path, UIO_SYSSPACE, args->uid,
 	    args->gid, 0);
 	LFREEPATH(path);
@@ -1805,7 +1805,7 @@ linux_fchownat(struct thread *td, struct linux_fchownat_args *args)
 		return (kern_fchownat(td, dfd, args->filename, UIO_USERSPACE,
 		    args->uid, args->gid, flag));
 	}
-	LCONVPATHEXIST_AT(td, args->filename, &path, dfd);
+	LCONVPATHEXIST_AT(args->filename, &path, dfd);
 	error = kern_fchownat(td, dfd, path, UIO_SYSSPACE, args->uid, args->gid,
 	    flag);
 	LFREEPATH(path);
@@ -1823,7 +1823,7 @@ linux_lchown(struct thread *td, struct linux_lchown_args *args)
 		return (kern_fchownat(td, AT_FDCWD, args->path, UIO_USERSPACE, args->uid,
 		    args->gid, AT_SYMLINK_NOFOLLOW));
 	}
-	LCONVPATHEXIST(td, args->path, &path);
+	LCONVPATHEXIST(args->path, &path);
 	error = kern_fchownat(td, AT_FDCWD, path, UIO_SYSSPACE, args->uid, args->gid,
 	    AT_SYMLINK_NOFOLLOW);
 	LFREEPATH(path);
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index 589ad911266f..7960f8b80fa1 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -279,7 +279,7 @@ linux_uselib(struct thread *td, struct linux_uselib_args *args)
 		    UIO_USERSPACE, args->library, td);
 		error = namei(&ni);
 	} else {
-		LCONVPATHEXIST(td, args->library, &library);
+		LCONVPATHEXIST(args->library, &library);
 		NDINIT(&ni, LOOKUP, ISOPEN | FOLLOW | LOCKLEAF | AUDITVNODE1,
 		    UIO_SYSSPACE, library, td);
 		error = namei(&ni);
@@ -759,7 +759,7 @@ linux_utime(struct thread *td, struct linux_utime_args *args)
 		error = kern_utimesat(td, AT_FDCWD, args->fname, UIO_USERSPACE,
 		    tvp, UIO_SYSSPACE);
 	} else {
-		LCONVPATHEXIST(td, args->fname, &fname);
+		LCONVPATHEXIST(args->fname, &fname);
 		error = kern_utimesat(td, AT_FDCWD, fname, UIO_SYSSPACE, tvp,
 		    UIO_SYSSPACE);
 		LFREEPATH(fname);
@@ -791,7 +791,7 @@ linux_utimes(struct thread *td, struct linux_utimes_args *args)
 		error = kern_utimesat(td, AT_FDCWD, args->fname, UIO_USERSPACE,
 		    tvp, UIO_SYSSPACE);
 	} else {
-		LCONVPATHEXIST(td, args->fname, &fname);
+		LCONVPATHEXIST(args->fname, &fname);
 		error = kern_utimesat(td, AT_FDCWD, fname, UIO_SYSSPACE,
 		    tvp, UIO_SYSSPACE);
 		LFREEPATH(fname);
@@ -859,7 +859,7 @@ linux_common_utimensat(struct thread *td, int ldfd, const char *pathname,
 	}
 
 	if (pathname != NULL)
-		LCONVPATHEXIST_AT(td, pathname, &path, dfd);
+		LCONVPATHEXIST_AT(pathname, &path, dfd);
 	else if (lflags != 0)
 		return (EINVAL);
 
@@ -978,7 +978,7 @@ linux_futimesat(struct thread *td, struct linux_futimesat_args *args)
 		error = kern_utimesat(td, dfd, args->filename, UIO_USERSPACE,
 		    tvp, UIO_SYSSPACE);
 	} else {
-		LCONVPATHEXIST_AT(td, args->filename, &fname, dfd);
+		LCONVPATHEXIST_AT(args->filename, &fname, dfd);
 		error = kern_utimesat(td, dfd, fname, UIO_SYSSPACE,
 		    tvp, UIO_SYSSPACE);
 		LFREEPATH(fname);
@@ -1152,7 +1152,7 @@ linux_mknod(struct thread *td, struct linux_mknod_args *args)
 		path = args->path;
 		seg = UIO_USERSPACE;
 	} else {
-		LCONVPATHCREAT(td, args->path, &path);
+		LCONVPATHCREAT(args->path, &path);
 		seg = UIO_SYSSPACE;
 	}
 
@@ -1208,7 +1208,7 @@ linux_mknodat(struct thread *td, struct linux_mknodat_args *args)
 		path = __DECONST(char *, args->filename);
 		seg = UIO_USERSPACE;
 	} else {
-		LCONVPATHCREAT_AT(td, args->filename, &path, dfd);
+		LCONVPATHCREAT_AT(args->filename, &path, dfd);
 		seg = UIO_SYSSPACE;
 	}
 
diff --git a/sys/compat/linux/linux_stats.c b/sys/compat/linux/linux_stats.c
index 97bace941943..9dc7686cb963 100644
--- a/sys/compat/linux/linux_stats.c
+++ b/sys/compat/linux/linux_stats.c
@@ -241,7 +241,7 @@ linux_newstat(struct thread *td, struct linux_newstat_args *args)
 	if (!LUSECONVPATH(td)) {
 		error = linux_kern_stat(td, args->path, UIO_USERSPACE, &buf);
 	} else {
-		LCONVPATHEXIST(td, args->path, &path);
+		LCONVPATHEXIST(args->path, &path);
 		error = linux_kern_stat(td, path, UIO_SYSSPACE, &buf);
 		LFREEPATH(path);
 	}
@@ -260,7 +260,7 @@ linux_newlstat(struct thread *td, struct linux_newlstat_args *args)
 	if (!LUSECONVPATH(td)) {
 		error = linux_kern_lstat(td, args->path, UIO_USERSPACE, &sb);
 	} else {
-		LCONVPATHEXIST(td, args->path, &path);
+		LCONVPATHEXIST(args->path, &path);
 		error = linux_kern_lstat(td, path, UIO_SYSSPACE, &sb);
 		LFREEPATH(path);
 	}
@@ -323,7 +323,7 @@ linux_stat(struct thread *td, struct linux_stat_args *args)
 	if (!LUSECONVPATH(td)) {
 		error = linux_kern_stat(td, args->path, UIO_USERSPACE, &buf);
 	} else {
-		LCONVPATHEXIST(td, args->path, &path);
+		LCONVPATHEXIST(args->path, &path);
 		error = linux_kern_stat(td, path, UIO_SYSSPACE, &buf);
 		LFREEPATH(path);
 	}
@@ -343,7 +343,7 @@ linux_lstat(struct thread *td, struct linux_lstat_args *args)
 	if (!LUSECONVPATH(td)) {
 		error = linux_kern_lstat(td, args->path, UIO_USERSPACE, &buf);
 	} else {
-		LCONVPATHEXIST(td, args->path, &path);
+		LCONVPATHEXIST(args->path, &path);
 		error = linux_kern_lstat(td, path, UIO_SYSSPACE, &buf);
 		LFREEPATH(path);
 	}
@@ -455,7 +455,7 @@ linux_statfs(struct thread *td, struct linux_statfs_args *args)
 		bsd_statfs = malloc(sizeof(struct statfs), M_STATFS, M_WAITOK);
 		error = kern_statfs(td, args->path, UIO_USERSPACE, bsd_statfs);
 	} else {
-		LCONVPATHEXIST(td, args->path, &path);
+		LCONVPATHEXIST(args->path, &path);
 		bsd_statfs = malloc(sizeof(struct statfs), M_STATFS, M_WAITOK);
 		error = kern_statfs(td, path, UIO_SYSSPACE, bsd_statfs);
 		LFREEPATH(path);
@@ -503,7 +503,7 @@ linux_statfs64(struct thread *td, struct linux_statfs64_args *args)
 		bsd_statfs = malloc(sizeof(struct statfs), M_STATFS, M_WAITOK);
 		error = kern_statfs(td, args->path, UIO_USERSPACE, bsd_statfs);
 	} else {
-		LCONVPATHEXIST(td, args->path, &path);
+		LCONVPATHEXIST(args->path, &path);
 		bsd_statfs = malloc(sizeof(struct statfs), M_STATFS, M_WAITOK);
 		error = kern_statfs(td, path, UIO_SYSSPACE, bsd_statfs);
 		LFREEPATH(path);
@@ -617,7 +617,7 @@ linux_stat64(struct thread *td, struct linux_stat64_args *args)
 	if (!LUSECONVPATH(td)) {
 		error = linux_kern_stat(td, args->filename, UIO_USERSPACE, &buf);
 	} else {
-		LCONVPATHEXIST(td, args->filename, &filename);
+		LCONVPATHEXIST(args->filename, &filename);
 		error = linux_kern_stat(td, filename, UIO_SYSSPACE, &buf);
 		LFREEPATH(filename);
 	}
@@ -636,7 +636,7 @@ linux_lstat64(struct thread *td, struct linux_lstat64_args *args)
 	if (!LUSECONVPATH(td)) {
 		error = linux_kern_lstat(td, args->filename, UIO_USERSPACE, &sb);
 	} else {
-		LCONVPATHEXIST(td, args->filename, &filename);
+		LCONVPATHEXIST(args->filename, &filename);
 		error = linux_kern_lstat(td, filename, UIO_SYSSPACE, &sb);
 		LFREEPATH(filename);
 	}
@@ -681,7 +681,7 @@ linux_fstatat64(struct thread *td, struct linux_fstatat64_args *args)
 		error = linux_kern_statat(td, flag, dfd, args->pathname,
 		    UIO_USERSPACE, &buf);
 	} else {
-		LCONVPATHEXIST_AT(td, args->pathname, &path, dfd);
+		LCONVPATHEXIST_AT(args->pathname, &path, dfd);
 		error = linux_kern_statat(td, flag, dfd, path, UIO_SYSSPACE, &buf);
 		LFREEPATH(path);
 	}
@@ -716,7 +716,7 @@ linux_newfstatat(struct thread *td, struct linux_newfstatat_args *args)
 		error = linux_kern_statat(td, flag, dfd, args->pathname,
 		    UIO_USERSPACE, &buf);
 	} else {
-		LCONVPATHEXIST_AT(td, args->pathname, &path, dfd);
+		LCONVPATHEXIST_AT(args->pathname, &path, dfd);
 		error = linux_kern_statat(td, flag, dfd, path, UIO_SYSSPACE, &buf);
 		LFREEPATH(path);
 	}
@@ -790,7 +790,7 @@ linux_statx(struct thread *td, struct linux_statx_args *args)
 		error = linux_kern_statat(td, flags, dirfd, args->pathname,
 		    UIO_USERSPACE, &buf);
 	} else {
-		LCONVPATHEXIST_AT(td, args->pathname, &path, dirfd);
+		LCONVPATHEXIST_AT(args->pathname, &path, dirfd);
 		error = linux_kern_statat(td, flags, dirfd, path, UIO_SYSSPACE, &buf);
 		LFREEPATH(path);
 	}
diff --git a/sys/compat/linux/linux_uid16.c b/sys/compat/linux/linux_uid16.c
index 5d0bfdde083c..4dd4129cfa0b 100644
--- a/sys/compat/linux/linux_uid16.c
+++ b/sys/compat/linux/linux_uid16.c
@@ -84,7 +84,7 @@ linux_chown16(struct thread *td, struct linux_chown16_args *args)
 		error = kern_fchownat(td, AT_FDCWD, args->path, UIO_USERSPACE,
 		    CAST_NOCHG(args->uid), CAST_NOCHG(args->gid), 0);
 	} else {
-		LCONVPATHEXIST(td, args->path, &path);
+		LCONVPATHEXIST(args->path, &path);
 		/*
 		 * The DTrace probes have to be after the LCONVPATHEXIST, as
 		 * LCONVPATHEXIST may return on its own and we do not want to
@@ -109,7 +109,7 @@ linux_lchown16(struct thread *td, struct linux_lchown16_args *args)
 		error = kern_fchownat(td, AT_FDCWD, args->path, UIO_USERSPACE,
 		    CAST_NOCHG(args->uid), CAST_NOCHG(args->gid), AT_SYMLINK_NOFOLLOW);
 	} else {
-		LCONVPATHEXIST(td, args->path, &path);
+		LCONVPATHEXIST(args->path, &path);
 
 		/*
 		 * The DTrace probes have to be after the LCONVPATHEXIST, as
diff --git a/sys/compat/linux/linux_util.c b/sys/compat/linux/linux_util.c
index eddfd4f28868..800a55be33df 100644
--- a/sys/compat/linux/linux_util.c
+++ b/sys/compat/linux/linux_util.c
@@ -90,12 +90,12 @@ SYSCTL_STRING(_compat_linux, OID_AUTO, emul_path, CTLFLAG_RWTUN,
  * named file, i.e. we check if the directory it should be in exists.
  */
 int
-linux_emul_convpath(struct thread *td, const char *path, enum uio_seg pathseg,
+linux_emul_convpath(const char *path, enum uio_seg pathseg,
     char **pbuf, int cflag, int dfd)
 {
 	int retval;
 
-	retval = kern_alternate_path(td, linux_emul_path, path, pathseg, pbuf,
+	retval = kern_alternate_path(curthread, linux_emul_path, path, pathseg, pbuf,
 	    cflag, dfd);
 
 	return (retval);
diff --git a/sys/compat/linux/linux_util.h b/sys/compat/linux/linux_util.h
index 994efa88100f..621b99afbff3 100644
--- a/sys/compat/linux/linux_util.h
+++ b/sys/compat/linux/linux_util.h
@@ -51,27 +51,27 @@ MALLOC_DECLARE(M_EPOLL);
 extern char linux_emul_path[];
 extern int linux_use_emul_path;
 
-int linux_emul_convpath(struct thread *, const char *, enum uio_seg, char **, int, int);
+int linux_emul_convpath(const char *, enum uio_seg, char **, int, int);
 
 #define LUSECONVPATH(td) atomic_load_int(&linux_use_emul_path)
 
-#define LCONVPATH_AT(td, upath, pathp, i, dfd)				\
+#define LCONVPATH_AT(upath, pathp, i, dfd)				\
 	do {								\
 		int _error;						\
 									\
-		_error = linux_emul_convpath(td, upath, UIO_USERSPACE,	\
+		_error = linux_emul_convpath(upath, UIO_USERSPACE,	\
 		    pathp, i, dfd);					\
 		if (*(pathp) == NULL)					\
 			return (_error);				\
 	} while (0)
 
-#define LCONVPATH(td, upath, pathp, i)	\
-   LCONVPATH_AT(td, upath, pathp, i, AT_FDCWD)
+#define LCONVPATH(upath, pathp, i)	\
+   LCONVPATH_AT(upath, pathp, i, AT_FDCWD)
 
-#define LCONVPATHEXIST(td, upath, pathp) LCONVPATH(td, upath, pathp, 0)
-#define LCONVPATHEXIST_AT(td, upath, pathp, dfd) LCONVPATH_AT(td, upath, pathp, 0, dfd)
-#define LCONVPATHCREAT(td, upath, pathp) LCONVPATH(td, upath, pathp, 1)
-#define LCONVPATHCREAT_AT(td, upath, pathp, dfd) LCONVPATH_AT(td, upath, pathp, 1, dfd)
+#define LCONVPATHEXIST(upath, pathp) LCONVPATH(upath, pathp, 0)
+#define LCONVPATHEXIST_AT(upath, pathp, dfd) LCONVPATH_AT(upath, pathp, 0, dfd)
+#define LCONVPATHCREAT(upath, pathp) LCONVPATH(upath, pathp, 1)
+#define LCONVPATHCREAT_AT(upath, pathp, dfd) LCONVPATH_AT(upath, pathp, 1, dfd)
 #define LFREEPATH(path)	free(path, M_TEMP)
 
 #define DUMMY(s)							\
diff --git a/sys/i386/linux/linux_machdep.c b/sys/i386/linux/linux_machdep.c
index c81bf1b4e2e5..dde11f22d4fe 100644
--- a/sys/i386/linux/linux_machdep.c
+++ b/sys/i386/linux/linux_machdep.c
@@ -108,7 +108,7 @@ linux_execve(struct thread *td, struct linux_execve_args *args)
 		error = exec_copyin_args(&eargs, args->path, UIO_USERSPACE,
 		    args->argp, args->envp);
 	} else {
-		LCONVPATHEXIST(td, args->path, &newpath);
+		LCONVPATHEXIST(args->path, &newpath);
 		error = exec_copyin_args(&eargs, newpath, UIO_SYSSPACE,
 		    args->argp, args->envp);
 		LFREEPATH(newpath);