3 arguments, but we had forgotten the second argument. Also make the
Linux statfs64 struct depend on the architecture because it has an
extra 4 bytes padding on amd64 compared to i386.
The three argument fix is from David Taylor, the struct statfs64
stuff is my fault. With this patch I can install i386 Linux matlab
on an amd64 machine.
Approved by: re (kensmith)
- Add kern_semctl() and use it for Linux, IBCS2, and SVR4 ABIs.
- Don't pass a bufsz pointer to kern_shmctl() for operations that don't
need it.
- Add module dependencies for SYSV IPC modules to IBCS2 and SVR4.
- Use kern_shmctl() in SVR4.
- Use kern_msgctl(), kern_semctl(), and kern_shmctl() in IBCS2.
- Mark linux_ipc(), svr4_sys_shmsys(), and svr4_sys_semsys() MPSAFE.
- sync linuxulator:
* de-COMPAT_43-ify:
+ socket related ioctl's
This differs from -current, as the kernel ABI is different
(kern_bind() and kern_connect() free the struct sockaddr on -stable
themself, so two calls to free() are not included in this MFC).
* bug-/compatibility-fixes
* ioctl TIOCGPTN
* 1 style(9)-fix
Tested by: "Arno J. Klaassen" <arno@heho.snv.jussieu.fr>
- linuxulator mmap handling
- memleak fixes
- extend linux errno mapping
- handle address space limits for linux processes
- sync linprocfs (/proc/sys/... part)
Compile tested by: scf (i386, as part of a mega-MFC-patch)
Tested by: Arno J. Klaassen <arno@heho.snv.jussieu.fr> (amd64)
- don't limit number of syscalls to 255
- handle more socket options
- bug-/compatibility-fixes to linux
* file related (includes fixes which prevent creation of strange files
which can only be removed with a fsck)
* make ping work
* ...
- add devfs to the file system type handling/translation
Compile tested by: scf (i386, as part of a mega-MFC-patch)
Tested by: Arno J. Klaassen <arno@heho.snv.jussieu.fr> (amd64)
- some linuxulator style(9) fixes
- add datatypes and definitions in preparation of further commits
- use one (l_sigval) of the new datatypes on amd64 and get rid of a now unused
include (this may or may not fix some signal handling issues on amd64) [1]
- convert some unconditional debug handling into the common linuxulator way
- use some more appropriate format string types in some debug printf's
- convert signal validation into a macro
Except for [1] on amd64 there is no visible change to a normal user.
Tested by: scf (i386), Arno J. Klaassen <arno@heho.snv.jussieu.fr> (amd64)
- easy linuxulator style(9) fixes (easy = hand removal of non-style code
change sections in a full diff)
Tested by: scf (i386), Arno J. Klaassen <arno@heho.snv.jussieu.fr> (amd64)
- don't reboot() when feed with wrong parameters (and enough permissions) [1]
- add support to power off the system [2]
- check the linux magic values [3]
Submitted by: Marcin Cieslak <saper@SYSTEM.PL> [1,2]
Modelled after: linux man page of the reboot() syscall [3]
Found by: LTP testcase "reboot02" [1]
Tested with: LTP testcase "reboot02" [1,3]
Approved by: re (hrs)
The Linux unlink syscall uses a different errno value when trying to unlink
a directory.
PR: 102897 [1] http://www.FreeBSD.org/cgi/query-pr.cgi?pr=102897
Noticed by: Knut Anders Hatlen <kahatlen@gmail.com> [1], testrun with LTP
Submitted by: Marcin Cieslak <saper@SYSTEM.PL>
Tested by: netchild (LTP test run)
Approved by: re
- linux_misc.c 1.179
Don't copyout/do unneccesary work if the buffer is a NULL pointer.
Noticed by: Dmitry Ganenko <dima@apk-inform.com>
Reviewed by: rdivacky (the original version as in emulation@)
- linprocfs.c 1.96:
Improve linprovfs to provide/fix the
- process state (idle, sleeping, running, ...) [1]
- the process group ID of the process which owns the connected tty
- some page fault stats
- time spend in kernel/userland
- priority/nice value
- starttime [1]
- memory/swap stats
- scheduling policy
Additionally add some new fields and correct some not filled out ones.
This brings us down to 15 dummy fields.
The fields marked with [1] are needed to get Oracle 10 running. The starttime
field is not completely right, since it displays the _same_ starttime for
_every_ process, but at least it is not 0 and Oracle accepts this.
Noticed by: Dmitry Ganenko <dima@apk-inform.com> [1]
Reviewed by: des, rdivacky
- pseudofs_vnops.c 1.60:
Correctly calculate a buffer length. It was off by one so a read() returned
one byte less than needed.
Noticed by: Dmitry Ganenko <dima@apk-inform.com>
Testcase by: Dmitry Ganenko <dima@apk-inform.com>
Reviewed by: des
Submitted by: rdivacky
Sponsored by: Google SoC 2006
All of those are needed for Oracle 10. Since previous Oracle versions work
just fine without those fixes, these patches can be seen as regression fixes
too. Because of this I think they are a RELENG_6_x candidate (MFC reminder
set).
MFC after: 1 month
management tools can work. This is not totally connected to the build
yet. The mfi(4) change have not been MFC'ed yet. This will be done
shortly. I'm trying to do this in chunks so I don't totally break
the build on a missed commit. This has passed make universe a while
ago:
Enhance the Linux emulation layer to make MegaRAID SAS managements tool happy.
Add back in a scheme to emulate old type major/minor numbers via hooks into
stat, linprocfs to return major/minors that Linux app's expect. Currently
only /dev/null is always registered. Drivers can register via the Linux
type shim similar to the ioctl shim but by using
linux_device_register_handler/linux_device_unregister_handler functions.
The structure is:
struct linux_device_handler {
char *bsd_driver_name;
char *linux_driver_name;
char *bsd_device_name;
char *linux_device_name;
int linux_major;
int linux_minor;
int linux_char_device;
};
Linprocfs uses this to display the major number of the driver. The
soon to be available linsysfs will use it to fill in the driver name.
Linux_stat uses it to translate the major/minor into Linux type values.
Note major numbers are dynamically assigned via passing in a -1 for
the major number so we don't need to keep track of them.
This is somewhat needed due to us switching to our devfs.
date: 2005/12/13 15:32:52; author: delphij; state: Exp; lines: +5 -5
In Linux, kernel parameters passed to ioctl are by value, while in FreeBSD
they are passed by reference. Handle the difference within the
linux_ioctl_termio on the LINUX_TCFLSH path.
Submitted by: Jaroslav Drzik <jaro_AT_coop-voz_dot_sk>
Reminded by: glebius
Rewrite linux_ifconf() to be more like ifconf() in net/if.c
so that we do not call uiomove() while IFNET_RLOCK() is held.
This eliminates the witness warning:
Calling uiomove() with the following non-sleepable locks held:
exclusive sleep mutex ifnet r = 0 (0xc096dd60) locked @
/usr/src/sys/modules/linux/../../compat/linux/linux_ioctl.c:2170
Approved by: re (scottl)
- Conditionally grab Giant around the EISCONN hack at the end based on
debug.mpsafenet.
- Protect access to so_emuldata via SOCK_LOCK.
Reviewed by: rwatson
Approved by: re (scottl)
and extend its functionality:
value policy
0 show all mount-points without any restrictions
1 show only mount-points below jail's chroot and show only part of the
mount-point's path (if jail's chroot directory is /jails/foo and
mount-point is /jails/foo/usr/home only /usr/home will be shown)
2 show only mount-point where jail's chroot directory is placed.
Default value is 2.
Discussed with: rwatson
so do not duplicate the code in cvtstatfs().
Note, that we now need to clear fsid in freebsd4_getfsstat().
This moves all security related checks from functions like cvtstatfs()
and will allow to add more security related stuff (like statfs(2), etc.
protection for jails) a bit easier.
the type of object represented by the handle argument.
- Allow vm_mmap() to map device memory via cdev objects in addition to
vnodes and anonymous memory. Note that mmaping a cdev directly does not
currently perform any MAC checks like mapping a vnode does.
- Unbreak the DRM getbufs ioctl by having it call vm_mmap() directly on the
cdev the ioctl is acting on rather than trying to find a suitable vnode
to map from.
Reviewed by: alc, arch@
Replace a KASSERT of LINUX_IFNAMSIZ == IFNAMSIZ with a preprocessor
check and #error message. This will prevent nasty suprises if users
change IFNAMSIZ without updating the linux code appropriatly.
with the IP_HDRINCL option set. Without this change, a Linux process
with access to a raw socket could cause a kernel panic. Raw sockets
must be created by root, and are generally not consigned to untrusted
applications; hence, the security implications of this bug are
minimal. I believe this only affects 6-CURRENT on or after 2005-01-30.
Found by: Coverity Prevent analysis tool
Security: Local DOS
SIGPIPE signal for the duration of the sento-family syscalls. Use it to
replace previously added hack in Linux layer based on temporarily setting
SO_NOSIGPIPE flag.
Suggested by: alfred
for the duration of the send() call. Such approach may be less than ideal
in threading environment, when several threads share the same socket and it
might happen that several of them are calling linux_send() at the same time
with and without SO_NOSIGPIPE set.
However, such race condition is very unlikely in practice, therefore this
change provides practical improvement compared to the previous behaviour.
PR: kern/76426
Submitted by: Steven Hartland <killing@multiplay.co.uk>
MFC after: 3 days