opnsense-src/lib/libc
Konstantin Belousov 987ff18184 Consistently handle negative or wrapping offsets in the mmap(2) syscalls.
For regular files and posix shared memory, POSIX requires that
[offset, offset + size) range is legitimate.  At the maping time,
check that offset is not negative.  Allowing negative offsets might
expose the data that filesystem put into vm_object for internal use,
esp. due to OFF_TO_IDX() signess treatment.  Fault handler verifies
that the mapped range is valid, assuming that mmap(2) checked that
arithmetic gives no undefined results.

For device mappings, leave the semantic of negative offsets to the
driver.  Correct object page index calculation to not erronously
propagate sign.

In either case, disallow overflow of offset + size.

Update mmap(2) man page to explain the requirement of the range
validity, and behaviour when the range becomes invalid after mapping.

Reported and tested by:	royger (previous version)
Reviewed by:	alc
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2017-02-12 21:05:44 +00:00
..
aarch64 Fix the comment showing the meaning of the first argument to sigprocmask. 2017-02-03 11:51:06 +00:00
amd64 Reduce duplicate NOASM and PSEUDO definitions 2016-09-08 22:38:20 +00:00
arm Replace dot-dot relative pathing with SRCTOP-relative paths where possible 2017-01-20 03:23:24 +00:00
capability Replace dot-dot relative pathing with SRCTOP-relative paths where possible 2017-01-20 03:23:24 +00:00
compat-43 Use ANSI C prototypes. Eliminates -Wold-style-definition warnings. 2015-09-20 20:53:24 +00:00
db Sync ^/vendor/NetBSD/tests/dist with upstream 2017-01-12 07:26:39 +00:00
gdtoa Replace dot-dot relative pathing with SRCTOP-relative paths where possible 2017-01-20 03:23:24 +00:00
gen Fix grammar in getpeereid(3) 2017-02-04 00:37:25 +00:00
gmon Replace the last non-optional use of sbrk() in the tree with mmap(). 2016-01-21 18:17:19 +00:00
i386 Reduce duplicate NOASM and PSEUDO definitions 2016-09-08 22:38:20 +00:00
iconv Replace dot-dot relative pathing with SRCTOP-relative paths where possible 2017-01-20 03:23:24 +00:00
include Export __cxa_thread_atexit_impl as an alias for __cxa_thread_atexit. 2017-01-07 16:05:19 +00:00
inet Update ^/vendor/NetBSD/tests/dist to a more recent snapshot 2016-08-12 01:05:07 +00:00
isc libc: do not include <sys/types.h> where <sys/param.h> was already included 2016-04-18 21:05:15 +00:00
locale Move __hidden attribute towards the end of the declaration. 2016-12-31 15:30:00 +00:00
md Replace dot-dot relative pathing with SRCTOP-relative paths where possible 2017-01-20 03:23:24 +00:00
mips Add full softfloat and hardfloat support for MIPS. 2016-10-31 15:33:58 +00:00
nameser libc: spelling fixes. 2016-04-30 01:24:24 +00:00
net Sync ^/vendor/NetBSD/tests/dist with upstream 2017-01-12 07:26:39 +00:00
nls Use current locale (f.e. set by thread). It was global locale always 2016-08-24 16:44:27 +00:00
posix1e Replace dot-dot relative pathing with SRCTOP-relative paths where possible 2017-01-20 03:23:24 +00:00
powerpc Fix a typo which broke the build for powerpc. 2016-10-25 01:32:35 +00:00
powerpc64 Reduce duplicate NOASM and PSEUDO definitions 2016-09-08 22:38:20 +00:00
powerpcspe Fix a copy&paste-o causing a segfault with sigsetjmp. 2016-10-29 01:22:55 +00:00
quad Remove MK_ARM_EABI, the armeb issues have been fixed. The code to support 2014-10-01 08:26:51 +00:00
regex Replace dot-dot relative pathing with SRCTOP-relative paths where possible 2017-01-20 03:23:24 +00:00
resolv Replace dot-dot relative pathing with SRCTOP-relative paths where possible 2017-01-20 03:23:24 +00:00
riscv Add full softfloat and hardfloat support for RISC-V. 2016-11-16 15:21:32 +00:00
rpc Sync ^/vendor/NetBSD/tests/dist with upstream 2017-01-12 07:26:39 +00:00
secure libc: do not include <sys/types.h> where <sys/param.h> was already included 2016-04-18 21:05:15 +00:00
softfloat Add full softfloat and hardfloat support for RISC-V. 2016-11-16 15:21:32 +00:00
sparc64 Reduce duplicate NOASM and PSEUDO definitions 2016-09-08 22:38:20 +00:00
stdio Revert r310138 2016-12-22 22:30:42 +00:00
stdlib hcreate(3): fix the ERRORS section and bump .Dd 2017-02-07 02:32:49 +00:00
stdtime Replace dot-dot relative pathing with SRCTOP-relative paths where possible 2017-01-20 03:23:24 +00:00
string Replace dot-dot relative pathing with SRCTOP-relative paths where possible 2017-01-20 03:23:24 +00:00
sys Consistently handle negative or wrapping offsets in the mmap(2) syscalls. 2017-02-12 21:05:44 +00:00
tests Manipulate OBJDIR with :H when referencing dso directory 2017-02-11 20:14:50 +00:00
uuid libc: replace 0 with NULL for pointers. 2016-04-10 19:33:58 +00:00
x86/sys Only conditionally add in hyperv support if we're building amd64 2017-01-19 18:07:24 +00:00
xdr libc/xdr: unsign some loop indexes. 2016-05-06 16:03:40 +00:00
yp Use on crypto.x and rpc.x from the source tree. 2016-06-28 19:53:16 +00:00
libc.ldscript Attempt to move the POSIX iconv* symbols out of runtime linker space. 2013-11-17 22:52:17 +00:00
libc_nossp.ldscript Add different libc ldscript: the one without libssp -- 2016-10-12 13:19:21 +00:00
Makefile Replace dot-dot relative pathing with SRCTOP-relative paths where possible 2017-01-20 03:23:24 +00:00
Makefile.depend DIRDEPS_BUILD: Regenerate without local dependencies. 2016-02-24 17:20:11 +00:00
Versions.def Create namespace for the symbols added during 12-CURRENT cycle. 2016-08-06 13:28:58 +00:00