Commit Graph
1075 Commits
Author SHA1 Message Date
Dmitry Chagin 9937a40828 MFC r321366:
Style(9) whitespace fix.
2017-07-29 10:31:57 +00:00
Konstantin Belousov c7eae662bd MFC r319873:
Move struct syscall_args syscall arguments parameters container into
struct thread.
2017-07-21 18:06:57 +00:00
Ed Maste ce02046419 MFC r320069: Add ZFS to Linux statfs ftype
PR:		220086
Sponsored by:	The FreeBSD Foundation
2017-07-09 00:24:52 +00:00
Andriy Gapon eb3a53979f MFC r320353: linux_getdents, linux_readdir: fix mismatch between malloc and free tags
Approved by:	re (gjb)
2017-06-29 12:49:03 +00:00
Dmitry Chagin 513cd95341 MFC r319571:
On success, getrandom() Linux system call returns the number of bytes that
were copied to the buffer supplied by the user.

PR:		219464
Submitted by:	Maciej Pasternacki
Reported by:	Maciej Pasternacki
Approved by:	re (kib)
2017-06-11 09:33:09 +00:00
Dmitry Chagin e44f400fac MFC r317601:
Fix symlinkat() which use the newdfd argument to look up the old path,
while it should use it for the new path instead.

Approved by:	re (kib)
2017-06-04 19:56:21 +00:00
Tai-hwa Liang 260d1ffa79 MFC 316658:
Adding SIOCGIFNAME support in Linuxulator.  This should silence the console warning associated
with linux-opera:
	linux: pid 23492 (opera): ioctl fd=5, cmd=0x8910 ('\M^I',16) is not implemented
	linux: pid 23492 (opera): ioctl fd=28, cmd=0x8910 ('\M^I',16) is not implemented
	...

Reviewed by:	kib, marcel, dchagin
Tested with:	linux-opera-12.16_3
2017-05-15 22:51:22 +00:00
Dmitry Chagin 3e8fe1c011 MFC r317645:
Fix NULL pointer dereference in futex_wake_op() in case when the same
address specified for arguments uaddr and uaddr2.

PR:		218987
2017-05-08 10:51:30 +00:00
Dmitry Chagin 9d9b6c64d0 MFC r316426:
Use the kern_clock_nanosleep() to implement Linux clock_nanosleep() with
the proper handling of the TIMER_ABSTIME flag.
2017-05-01 06:42:39 +00:00
Dmitry Chagin e396231cb1 MFC r317324:
Map Linux CLOCK_BOOTTIME to native CLOCK_UPTIME.
2017-04-30 06:15:56 +00:00
Dmitry Chagin 7e1bbf44dd MFC r317323:
Add Evdev ioctl handler to the Linuxulator.

PR:		218627
2017-04-30 06:14:57 +00:00
Dmitry Chagin 2742834a9d MFC r316776 (by cem@):
linux_ioctl: Refactor some v4l2 struct converters

According to the C standard, it is invalid to copy beyond the end of an
object, even if that object is obviously a member of a larger object (a
struct, in this case).

Appease the standard and Coverity by refactoring the copy in a
straightforward way.  No functional change.
2017-04-29 09:26:30 +00:00
Dmitry Chagin 5420a1bac4 MFC r316289:
Use kern_mincore() helper instead of abusing syscall entry.
2017-04-29 09:21:00 +00:00
Dmitry Chagin 9e509e15ab MFC r315957:
Implement Linux mincore() system call.
This is necessary for the upcoming drm-next.
2017-04-29 09:18:55 +00:00
Dmitry Chagin 9cfc6ccfb2 MFC r315505:
Implement getrandom() syscall.
Note. GRND_RANDOM option is not supported for now.
2017-04-23 06:43:52 +00:00
Dmitry Chagin f428ede9f3 MFC r315501:
To reduce code duplication move socket defines to the MI path.
2017-04-15 15:38:15 +00:00
Dmitry Chagin 7cc63dab54 MFC r316395:
Remove excess tv_nsec test as this is done by linux_to_native_timespec().
2017-04-15 15:32:22 +00:00
Dmitry Chagin 1f8a8ca339 MFC r316394:
The value in the tv_nsec field should be in the range 0 to 999999999.
2017-04-15 15:31:28 +00:00
Dmitry Chagin 2d09930855 MFC r316393:
As noted by bde@ negative tv_sec values are not checked for overflow,
so overflow can still occur. Fix that. Also remove the extra check for
tv_sec size as under COMPAT_LINUX32 it is always true.
2017-04-15 15:30:28 +00:00
Dmitry Chagin 7833894202 MFC r315498:
Check for negative nanoseconds.
Linux do that in timespec_valid().
2017-04-15 15:29:16 +00:00
Dmitry Chagin 285ebf1c4f MFC r316599:
Prevent ushort values overflow when convert new Linux 64-bit ipc
struct to the old Linux ipc struct.
2017-04-15 15:15:42 +00:00
Dmitry Chagin 8051cdf041 MFC r314868:
Linux semop system call return EINVAL in case when the invalid nsops
or semid values specified.
2017-04-15 15:13:54 +00:00
Dmitry Chagin 81076ba179 MFC r314867:
Linux kernel does not export to the user space ipc_perm.mode values
other than S_IRWXUGO (0777).
2017-04-15 15:12:25 +00:00
Dmitry Chagin bde7e6f88b MFC r314866:
Reduce code duplication between MD Linux code by moving SYSV IPC 64-bit
related struct definitions out into the MI path.

Invert the native ipc structs to the Linux ipc structs convesion logic.
Since 64-bit variant of ipc structs has more precision convert native ipc
structs to the 64-bit Linux ipc structs and then truncate 64-bit values
into the non 64-bit if needed. Unlike Linux, return EOVERFLOW if the
values do not fit.

Fix SYSV IPC for 64-bit Linuxulator which never sets IPC_64 bit.
2017-04-15 15:11:23 +00:00
Dmitry Chagin b589ed098b MFC r314648:
Style(9).
2017-04-15 15:09:23 +00:00
Dmitry Chagin fc7c4917e5 MFC r314647:
Remove attribute __packed from some IPC struct definition since
Linuxulator is x86 only.
The only notable differences in algnment for an LP64 64-bit system
when compared to a 32-bit system is an eight or large byte types
alignment.
2017-04-15 15:08:23 +00:00
Mahdi Mokhtari 3352c3c8c2 MFC r314782:
Add UNIMPLEMENTED() placeholder macro for
the syscalls that are not implemented in Linux kernel itself.
Cleanup DUMMY() macros.

Approved by:	trasz
2017-04-11 12:49:25 +00:00
Edward Tomasz Napierala f86ce637b9 MFC r314046:
Get rid of foo_sys() in linuxulator code.  It was commented out, and it
would be useless anyway - there is no point in pretending to have block
devices; our "block" devices are in fact character ones, and can only
be accessed as such.

Sponsored by:	DARPA, AFRL
2017-04-01 17:09:55 +00:00
Dmitry Chagin fbc45fb4a7 MFC r314404:
Linux epoll return EEXIST on case when op is EPOLL_CTL_ADD, and the supplied
file descriptor fd is already registered with this epoll instance.
2017-03-30 20:14:43 +00:00
Dmitry Chagin 1c068cf36d MFC r314403:
Linux epoll return ENOENT error in case when op is EPOLL_CTL_MOD or
EPOLL_CTL_DEL, and fd is not registered with this epoll instance.
2017-03-30 20:13:47 +00:00
Dmitry Chagin 9b77ee070e MFC r314402:
FreeBSD does not have analgue for epoll EPOLLPRI event type.
So, do not set EPOLLPRI event acidently.
Also, do not set EPOLLWRNORM and EPOLLRDNORM events as epoll
do not set this events.
2017-03-30 20:12:23 +00:00
Dmitry Chagin c12b8cf65a MFC r314344:
Return EINVAL when an invalid file descriptor specified.
2017-03-30 20:10:57 +00:00
Dmitry Chagin a2709bf25d MFC r314343:
Unify eventfd ioctl method and use it for other similar interfaces.
2017-03-30 20:09:49 +00:00
Dmitry Chagin 3d1b3fd0aa MFC r314312:
Change Linux epoll_pwait syscall definition to match Linux actual one.

MFC r314313:

Regen for r314312 (Linux epoll_pwait).

MFC r314314:

Return EINVAL in case when an invalid size of signal mask specified.
2017-03-30 20:08:25 +00:00
Dmitry Chagin 188ffb81fb MFC r314311:
Restore signal mask in epoll_pwait.
2017-03-30 20:05:16 +00:00
Dmitry Chagin 8ce3c24be3 MFC r314309:
Return EINVAL when an invalid file descriptor is specified.
2017-03-30 20:04:28 +00:00
Dmitry Chagin 2941d8dc8b MFC r314295:
Implement timerfd family syscalls.
2017-03-30 20:03:20 +00:00
Dmitry Chagin d47627eca4 MFC r314294:
Mostly style(9) changes, replace unused eventfd_truncate()
by default invfo_truncate() method.
2017-03-30 20:02:19 +00:00
Dmitry Chagin 97c5a026eb MFC r314293:
Return EOVERFLOW error in case then the size of tv_sec field of struct timespec
in COMPAT_LINUX32 Linuxulator's not equal to the size of native tv_sec.
2017-03-30 20:00:57 +00:00
Dmitry Chagin edc49ae507 MFC r315499:
Remove superflous break statment.
2017-03-25 14:28:20 +00:00
Dmitry Chagin c6b56240b8 MFC r315503:
As noted by Roel Bouwman Linux allows a large buffer size than the
struct ucred size. Fix this.

PR:           102956
2017-03-25 14:26:45 +00:00
Dmitry Chagin 7fead7a136 MFC r315278:
Fix usage of the same 'i' variable in the external and nested loops.
2017-03-25 14:25:20 +00:00
Eric van Gyzen be0b16b3f6 MFC r315510
nanosleep: plug a kernel memory disclosure

nanosleep() updates rmtp on EINVAL.  In that case, kern_nanosleep()
has not updated rmt, so sys_nanosleep() updates the user-space rmtp
by copying garbage from its stack frame.  This is not only a kernel
memory disclosure, it's also not POSIX-compliant.  Fix it to update
rmtp only on EINTR.

Security:	possibly
Sponsored by:	Dell EMC
2017-03-21 01:23:34 +00:00
Edward Tomasz Napierala 50a91c2fc5 MFC r313947:
There are some Linux binaries that expect the system to obey the "addr"
parameter to mmap(2), even if MAP_FIXED is not explicitly specified.
Android ART is one example.  Implement bug compatibility for this case
in linuxulator.

Sponsored by:	DARPA, AFRL
2017-03-19 15:32:12 +00:00
Edward Tomasz Napierala 52b02cf1c6 MFC r313281:
Add kern_cpuset_getaffinity() and kern_cpuset_getaffinity(),
and use it in compats instead of their sys_*() counterparts.

Sponsored by:	DARPA, AFRL
2017-03-19 15:15:34 +00:00
Edward Tomasz Napierala dcae0022d7 MFC r313018:
Add kern_pread() and kern_pwrite(), and use it in compats instead
of their sys_*() counterparts. The svr4 is left unchanged.

Sponsored by:	DARPA, AFRL
2017-03-19 14:46:40 +00:00
Edward Tomasz Napierala a23cbb368b MFC r312987:
Add kern_lseek() and use it instead of sys_lseek() in various compats.
I didn't touch svr4/, there's no point.

Sponsored by:	DARPA, AFRL
2017-03-19 14:36:19 +00:00
Edward Tomasz Napierala 4cec676bca MFC r312988:
Add kern_listen(), kern_shutdown(), and kern_socket(), and use them
instead of their sys_*() counterparts in various compats. The svr4
is left untouched, because there's no point.

Sponsored by:	DARPA, AFRL
2017-03-19 14:25:23 +00:00
Edward Tomasz Napierala 71722d7d89 MFC r312986:
Replace sys_ftruncate() with kern_ftruncate() in various compats.

Sponsored by:	DARPA, AFRL
2017-03-19 14:12:55 +00:00
Edward Tomasz Napierala 043bd25652 MFC r314282:
Fix linux_fstatfs() to return proper value for f_frsize. Without it,
linux df(1) binary from Xenial shows garbage.
2017-03-19 10:39:59 +00:00