Page MenuHomeFreeBSD

D41901.1775188688.diff
No OneTemporary

Size
5 KB
Referenced Files
None
Subscribers
None

D41901.1775188688.diff

diff --git a/sys/amd64/linux/linux_sysvec.c b/sys/amd64/linux/linux_sysvec.c
--- a/sys/amd64/linux/linux_sysvec.c
+++ b/sys/amd64/linux/linux_sysvec.c
@@ -65,7 +65,6 @@
#include <compat/linux/linux_mib.h>
#include <compat/linux/linux_misc.h>
#include <compat/linux/linux_signal.h>
-#include <compat/linux/linux_sysproto.h>
#include <compat/linux/linux_util.h>
#include <compat/linux/linux_vdso.h>
@@ -157,17 +156,15 @@
sa->code = frame->tf_rax;
sa->original_code = sa->code;
- if (sa->code >= p->p_sysent->sv_size)
- /* nosys */
- sa->callp = &p->p_sysent->sv_table[p->p_sysent->sv_size - 1];
- else
- sa->callp = &p->p_sysent->sv_table[sa->code];
-
/* Restore r10 earlier to avoid doing this multiply times. */
frame->tf_r10 = frame->tf_rcx;
/* Restore %rcx for machine context. */
frame->tf_rcx = frame->tf_rip;
+ if (sa->code >= p->p_sysent->sv_size ||
+ p->p_sysent->sv_table[sa->code].sy_call == (sy_call_t *)nosys)
+ return (ENOSYS);
+ sa->callp = &p->p_sysent->sv_table[sa->code];
td->td_retval[0] = 0;
return (0);
}
diff --git a/sys/amd64/linux32/linux32_sysvec.c b/sys/amd64/linux32/linux32_sysvec.c
--- a/sys/amd64/linux32/linux32_sysvec.c
+++ b/sys/amd64/linux32/linux32_sysvec.c
@@ -529,15 +529,13 @@
sa->code = frame->tf_rax;
sa->original_code = sa->code;
- if (sa->code >= p->p_sysent->sv_size)
- /* nosys */
- sa->callp = &p->p_sysent->sv_table[p->p_sysent->sv_size - 1];
- else
- sa->callp = &p->p_sysent->sv_table[sa->code];
-
- td->td_retval[0] = 0;
td->td_retval[1] = frame->tf_rdx;
+ if (sa->code >= p->p_sysent->sv_size ||
+ p->p_sysent->sv_table[sa->code].sy_call == (sy_call_t *)nosys)
+ return (ENOSYS);
+ sa->callp = &p->p_sysent->sv_table[sa->code];
+ td->td_retval[0] = 0;
return (0);
}
diff --git a/sys/arm64/linux/linux_sysvec.c b/sys/arm64/linux/linux_sysvec.c
--- a/sys/arm64/linux/linux_sysvec.c
+++ b/sys/arm64/linux/linux_sysvec.c
@@ -121,11 +121,11 @@
sa->code = td->td_frame->tf_x[8];
sa->original_code = sa->code;
- /* LINUXTODO: generic syscall? */
- if (sa->code >= p->p_sysent->sv_size)
- sa->callp = &p->p_sysent->sv_table[0];
- else
- sa->callp = &p->p_sysent->sv_table[sa->code];
+
+ if (sa->code >= p->p_sysent->sv_size ||
+ p->p_sysent->sv_table[sa->code].sy_call == (sy_call_t *)nosys)
+ return (ENOSYS);
+ sa->callp = &p->p_sysent->sv_table[sa->code];
if (sa->callp->sy_narg > nitems(sa->args))
panic("ARM64TODO: Could we have more than %zu args?",
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -79,7 +79,6 @@
#include <compat/linux/linux_signal.h>
#include <compat/linux/linux_time.h>
#include <compat/linux/linux_util.h>
-#include <compat/linux/linux_sysproto.h>
#include <compat/linux/linux_emul.h>
#include <compat/linux/linux_misc.h>
@@ -1506,13 +1505,6 @@
return (kern_getsid(td, args->pid));
}
-int
-linux_nosys(struct thread *td, struct nosys_args *ignore)
-{
-
- return (ENOSYS);
-}
-
int
linux_getpriority(struct thread *td, struct linux_getpriority_args *args)
{
diff --git a/sys/compat/linux/linux_sysproto.h b/sys/compat/linux/linux_sysproto.h
deleted file mode 100644
--- a/sys/compat/linux/linux_sysproto.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-3-Clause
- *
- * Copyright (c) 2005 Travis Poppe
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer
- * in this position and unchanged.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef LINUX_SYSPROTO
-#define LINUX_SYSPROTO
-
-int linux_nosys(struct thread *, struct nosys_args *);
-
-#endif
diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c
--- a/sys/i386/linux/linux_sysvec.c
+++ b/sys/i386/linux/linux_sysvec.c
@@ -520,15 +520,13 @@
sa->args[4] = frame->tf_edi;
sa->args[5] = frame->tf_ebp; /* Unconfirmed */
- if (sa->code >= p->p_sysent->sv_size)
- /* nosys */
- sa->callp = &p->p_sysent->sv_table[p->p_sysent->sv_size - 1];
- else
- sa->callp = &p->p_sysent->sv_table[sa->code];
-
- td->td_retval[0] = 0;
td->td_retval[1] = frame->tf_edx;
+ if (sa->code >= p->p_sysent->sv_size ||
+ p->p_sysent->sv_table[sa->code].sy_call == (sy_call_t *)nosys)
+ return (ENOSYS);
+ sa->callp = &p->p_sysent->sv_table[sa->code];
+ td->td_retval[0] = 0;
return (0);
}

File Metadata

Mime Type
text/plain
Expires
Fri, Apr 3, 3:58 AM (10 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28250930
Default Alt Text
D41901.1775188688.diff (5 KB)

Event Timeline