aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Chagin <dchagin@FreeBSD.org>2022-05-23 10:17:39 +0000
committerDmitry Chagin <dchagin@FreeBSD.org>2022-06-17 19:35:28 +0000
commit464d2fec8854b452cf4800c2dd0f1e4b94540a0e (patch)
tree105ebc5ee58208a943102296bd16931c08f6c6d7
parent06f6414a648add4a0fbd90f3001be193d80fe4f5 (diff)
downloadsrc-464d2fec8854b452cf4800c2dd0f1e4b94540a0e.tar.gz
src-464d2fec8854b452cf4800c2dd0f1e4b94540a0e.zip
linux(4): Fix execve() on amd64/linux32 after a125ed50
MFC after: 2 weeks (cherry picked from commit 53726a1f1ed75a6788f5235833597e78781fffba)
-rw-r--r--sys/amd64/linux32/linux32_machdep.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/amd64/linux32/linux32_machdep.c b/sys/amd64/linux32/linux32_machdep.c
index e1d7742d0a21..9746c4bd7cdf 100644
--- a/sys/amd64/linux32/linux32_machdep.c
+++ b/sys/amd64/linux32/linux32_machdep.c
@@ -134,11 +134,15 @@ linux_execve(struct thread *td, struct linux_execve_args *args)
char *path;
int error;
- LCONVPATHEXIST(args->path, &path);
-
- error = freebsd32_exec_copyin_args(&eargs, path, UIO_SYSSPACE,
- args->argp, args->envp);
- free(path, M_TEMP);
+ if (!LUSECONVPATH(td)) {
+ error = freebsd32_exec_copyin_args(&eargs, args->path, UIO_USERSPACE,
+ args->argp, args->envp);
+ } else {
+ LCONVPATHEXIST(args->path, &path);
+ error = freebsd32_exec_copyin_args(&eargs, path, UIO_SYSSPACE,
+ args->argp, args->envp);
+ LFREEPATH(path);
+ }
if (error == 0)
error = linux_common_execve(td, &eargs);
AUDIT_SYSCALL_EXIT(error == EJUSTRETURN ? 0 : error, td);