aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrooks Davis <brooks@FreeBSD.org>2018-05-25 20:40:23 +0000
committerBrooks Davis <brooks@FreeBSD.org>2018-05-25 20:40:23 +0000
commit7351a8bdb5f109de55006141f651ec2c1ee11e34 (patch)
tree422ac18e247fa194750ed600b72309882e3c0330
parent9379029a9258d92f28c9721a5fcda5309207872d (diff)
downloadsrc-7351a8bdb5f109de55006141f651ec2c1ee11e34.tar.gz
src-7351a8bdb5f109de55006141f651ec2c1ee11e34.zip
Make vadvise compat freebsd11.
The vadvise syscall (aka ovadvise) is undocumented and has always been implmented as returning EINVAL. Put the syscall under COMPAT11 and provide a userspace implementation. Reviewed by: kib Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D15557
Notes
Notes: svn path=/head/; revision=334223
-rw-r--r--lib/libc/sys/Makefile.inc1
-rw-r--r--lib/libc/sys/Symbol.map2
-rw-r--r--lib/libc/sys/vadvise.c46
-rw-r--r--sys/compat/freebsd32/syscalls.master3
-rw-r--r--sys/kern/syscalls.master3
-rw-r--r--sys/vm/vm_unix.c17
6 files changed, 53 insertions, 19 deletions
diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc
index dde8dc8fe7c7..84a9be128082 100644
--- a/lib/libc/sys/Makefile.inc
+++ b/lib/libc/sys/Makefile.inc
@@ -46,6 +46,7 @@ NOASM+= getdirentries.o
PSEUDO+= _getdirentries.o
SRCS+= pipe.c
+SRCS+= vadvise.c
INTERPOSED = \
accept \
diff --git a/lib/libc/sys/Symbol.map b/lib/libc/sys/Symbol.map
index bfc0b7e7eb2c..cb000cd4d4af 100644
--- a/lib/libc/sys/Symbol.map
+++ b/lib/libc/sys/Symbol.map
@@ -1010,8 +1010,6 @@ FBSDprivate_1.0 {
__sys_utrace;
_uuidgen;
__sys_uuidgen;
- _vadvise;
- __sys_vadvise;
_wait4;
__sys_wait4;
_wait6;
diff --git a/lib/libc/sys/vadvise.c b/lib/libc/sys/vadvise.c
new file mode 100644
index 000000000000..e53e24cbd7c4
--- /dev/null
+++ b/lib/libc/sys/vadvise.c
@@ -0,0 +1,46 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2018 SRI International
+ * All rights reserved.
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory (Department of Computer Science and
+ * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the
+ * DARPA SSITH research programme.
+ *
+ * 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.
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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.
+ *
+ * $FreeBSD$
+ */
+
+#include <sys/cdefs.h>
+#include <sys/errno.h>
+
+int vadvise(int);
+
+int
+vadvise(int arg __unused)
+{
+
+ return (EINVAL);
+}
diff --git a/sys/compat/freebsd32/syscalls.master b/sys/compat/freebsd32/syscalls.master
index 6e9a3a63d61f..899c86fefbfa 100644
--- a/sys/compat/freebsd32/syscalls.master
+++ b/sys/compat/freebsd32/syscalls.master
@@ -173,8 +173,7 @@
70 AUE_SSTK NOPROTO { int sstk(int incr); }
71 AUE_MMAP COMPAT|NOPROTO { int mmap(void *addr, int len, \
int prot, int flags, int fd, int pos); }
-72 AUE_O_VADVISE NOPROTO { int ovadvise(int anom); } vadvise \
- ovadvise_args int
+72 AUE_O_VADVISE COMPAT11|NOPROTO { int vadvise(int anom); }
73 AUE_MUNMAP NOPROTO { int munmap(void *addr, size_t len); }
74 AUE_MPROTECT STD { int freebsd32_mprotect(void *addr, \
size_t len, int prot); }
diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master
index effcda49b5b4..64e0b9e977bc 100644
--- a/sys/kern/syscalls.master
+++ b/sys/kern/syscalls.master
@@ -229,8 +229,7 @@
70 AUE_SSTK STD { int sstk(int incr); }
71 AUE_MMAP COMPAT { int mmap(_In_ void *addr, int len, int prot, \
int flags, int fd, long pos); }
-72 AUE_O_VADVISE STD { int ovadvise(int anom); } vadvise \
- ovadvise_args int
+72 AUE_O_VADVISE COMPAT11 { int vadvise(int anom); }
73 AUE_MUNMAP STD { int munmap(_In_ void *addr, size_t len); }
74 AUE_MPROTECT STD { int mprotect(_In_ void *addr, \
size_t len, int prot); }
diff --git a/sys/vm/vm_unix.c b/sys/vm/vm_unix.c
index 80198668bcba..b53e6fb6614e 100644
--- a/sys/vm/vm_unix.c
+++ b/sys/vm/vm_unix.c
@@ -231,20 +231,11 @@ done:
#endif /* defined(__aarch64__) || defined(__riscv__) */
}
-#ifndef _SYS_SYSPROTO_H_
-struct ovadvise_args {
- int anom;
-};
-#endif
-
-/*
- * MPSAFE
- */
-/* ARGSUSED */
+#ifdef COMPAT_FREEBSD11
int
-sys_ovadvise(struct thread *td, struct ovadvise_args *uap)
+freebsd11_vadvise(struct thread *td, struct freebsd11_vadvise_args *uap)
{
- /* START_GIANT_OPTIONAL */
- /* END_GIANT_OPTIONAL */
+
return (EINVAL);
}
+#endif