freebsd-dev/lib
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
..
atf Don't bake all of CC/CPP/CXX into CFLAGS 2016-09-01 02:42:11 +00:00
clang Reapply 310775, now it also builds correctly if lldb is disabled: 2016-12-30 18:00:31 +00:00
csu Use SRCTOP-relative paths and .CURDIR with :H instead of ".." specified paths 2017-01-20 03:52:16 +00:00
lib80211 [lib80211] add VHT bands and channel flags. 2017-01-07 01:56:10 +00:00
libalias Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 03:34:59 +00:00
libarchive MFV r313071: 2017-02-02 00:50:46 +00:00
libauditd Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 03:55:21 +00:00
libbegemot Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 03:55:43 +00:00
libblacklist DIRDEPS_BUILD: Connect new directories and update dependencies. 2016-06-03 19:25:30 +00:00
libblocksruntime Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 03:56:10 +00:00
libbluetooth Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 03:56:42 +00:00
libbsdstat Fix off by one error in index limit calculation 2016-05-16 15:42:59 +00:00
libbsm Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 03:57:24 +00:00
libbsnmp Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 03:57:52 +00:00
libbz2 Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 03:58:50 +00:00
libc Consistently handle negative or wrapping offsets in the mmap(2) syscalls. 2017-02-12 21:05:44 +00:00
libc_nonshared Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:04:25 +00:00
libc++ Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 03:59:10 +00:00
libcalendar First pass through library packaging. 2016-02-04 21:16:35 +00:00
libcam Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:03:55 +00:00
libcapsicum capsicum_helpers: Add LOOKUP flag 2016-12-16 01:37:44 +00:00
libcasper Set SHLIBDIR before .including src.opts.mk in libcapser services 2016-10-24 14:37:18 +00:00
libclang_rt Expose symbols in lib/libclang_rt/profile to fix --coverage 2017-01-31 07:13:01 +00:00
libcom_err Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:51:36 +00:00
libcompat Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:52:00 +00:00
libcompiler_rt Update compiler-rt to release_39 branch r288513. Since this contains a 2016-12-02 20:17:41 +00:00
libcrypt Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:52:29 +00:00
libcuse libcuse: make more use of the howmany() macro when available. 2016-04-26 01:20:16 +00:00
libcxxrt Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:53:00 +00:00
libdevctl Implement 'devctl clear driver' to undo a previous 'devctl set driver'. 2016-08-29 22:48:36 +00:00
libdevdctl Use .CURDIR:H instead of .CURDIR to simplify pathing in output, etc 2017-01-20 04:55:14 +00:00
libdevinfo MFH 2016-04-04 23:55:32 +00:00
libdevstat First pass through library packaging. 2016-02-04 21:16:35 +00:00
libdpv MFH 2016-03-02 16:14:46 +00:00
libdwarf Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:54:21 +00:00
libedit MFV 312999: 2017-01-30 23:00:51 +00:00
libefivar DIRDEPS_BUILD: Connect new dependencies. 2016-11-13 00:11:23 +00:00
libelf Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:54:09 +00:00
libelftc Install the lib/libelftc manpages 2016-12-17 03:34:51 +00:00
libevent Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:53:50 +00:00
libexecinfo Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:53:40 +00:00
libexpat Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:53:45 +00:00
libfetch Fix inverted loop condition which broke multi-line responses to CONNECT. 2016-12-30 14:54:54 +00:00
libfigpar MFH 2016-03-02 16:14:46 +00:00
libgcc_eh libcc_{s,eh}: build without SSP 2016-11-11 23:28:07 +00:00
libgcc_s libgcc_s: add libc DT_NEEDED to fix underlinking 2017-01-13 15:17:25 +00:00
libgeom First pass through library packaging. 2016-02-04 21:16:35 +00:00
libgpio Use GPIOTOGGLE to toggle the pin state instead of read, modify and write. 2016-04-19 15:18:31 +00:00
libgssapi Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:53:20 +00:00
libiconv_modules Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:53:26 +00:00
libifconfig Mark libifconfig as private until the API/ABI is stable 2016-09-11 17:44:35 +00:00
libipsec Merge projects/ipsec into head/. 2017-02-06 08:49:57 +00:00
libjail Fix libjail reached latest sysctl entry. 2016-10-02 11:56:17 +00:00
libkiconv Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:50:46 +00:00
libkvm libkvm - extend a bit the swap statistics field. 2017-01-02 15:12:11 +00:00
libldns Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:50:19 +00:00
liblzma Use SRCTOP-relative paths and .CURDIR with :H instead of ".." specified paths 2017-01-20 04:46:20 +00:00
libmagic Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:45:09 +00:00
libmd Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:43:21 +00:00
libmemstat Fix buildworld for powerpc. 2016-11-20 06:10:12 +00:00
libmilter Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:42:43 +00:00
libmp Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:42:11 +00:00
libmt Add the density code for LTO-7 to libmt and the mt(1) man page. 2016-05-20 19:30:52 +00:00
libnandfs First pass through library packaging. 2016-02-04 21:16:35 +00:00
libnetbsd MFhead@r313404 2017-02-07 19:47:30 +00:00
libnetgraph First pass through library packaging. 2016-02-04 21:16:35 +00:00
libngatm Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:41:53 +00:00
libnv Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:40:55 +00:00
libopenbsd First pass through library packaging. 2016-02-04 21:16:35 +00:00
libopie Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:40:10 +00:00
libpam Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 03:31:50 +00:00
libpathconv This little BSD licensed library has been kicking around for years. 2016-11-23 07:57:52 +00:00
libpcap Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:39:36 +00:00
libpe Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:37:03 +00:00
libpjdlog MFH 2016-03-02 16:14:46 +00:00
libpmc lib: minor spelling fixes in comments. 2016-05-01 19:37:33 +00:00
libproc Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:37:22 +00:00
libprocstat Use SRCTOP-relative paths and .CURDIR with :H instead of ".." specified paths 2017-01-20 04:38:54 +00:00
libradius The NAS-Identifier attribute is a string, not an integer. 2016-05-24 11:44:43 +00:00
librpcsec_gss Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:36:48 +00:00
librpcsvc Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:36:28 +00:00
librss [rss] manpage improvements. 2016-10-23 20:42:32 +00:00
librt Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:36:06 +00:00
librtld_db Fix style bugs and remove trailing whitespace in libproc and librtld_db. 2016-12-06 04:13:02 +00:00
libsbuf Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:35:49 +00:00
libsdp lib: minor spelling fixes in comments. 2016-05-01 19:37:33 +00:00
libsm Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:35:36 +00:00
libsmb Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:35:00 +00:00
libsmdb Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:35:18 +00:00
libsmutil Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:34:34 +00:00
libsqlite3 Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:34:01 +00:00
libstand ufs: Use UFS_MAXNAMLEN constant 2017-02-09 17:47:01 +00:00
libstdbuf First pass through library packaging. 2016-02-04 21:16:35 +00:00
libstdthreads Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:33:45 +00:00
libsysdecode Extend LD_UTRACE by also generating utrace(2) log events for runtime linker 2017-01-30 08:38:32 +00:00
libtacplus First pass through library packaging. 2016-02-04 21:16:35 +00:00
libtelnet Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:32:36 +00:00
libthr Make use of clang nullability attributes. 2017-01-28 20:54:43 +00:00
libthread_db Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:28:16 +00:00
libucl Use SRCTOP to find the sources of libucl 2016-10-15 13:17:27 +00:00
libufs Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:30:05 +00:00
libugidfw First pass through library packaging. 2016-02-04 21:16:35 +00:00
libulog Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:29:23 +00:00
libunbound Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:31:19 +00:00
libusb Fix libusb20_dev_get_desc(3) to use the "vendor product" order, not 2016-10-22 14:37:13 +00:00
libusbhid Sync ^/vendor/NetBSD/tests/dist with upstream 2017-01-12 07:26:39 +00:00
libutil Clean up trailing and leading whitespace for variables to make it 2017-02-08 09:24:25 +00:00
libvgl MFH 2016-04-13 16:19:50 +00:00
libvmmapi Fix possible integer overflow in guest memory bounds checking, which could 2016-12-06 18:50:44 +00:00
libwrap Use SRCTOP instead of .CURDIR-relative path in .PATH directive 2017-01-18 18:14:50 +00:00
libxo Submitted by: phil 2016-05-29 01:43:28 +00:00
liby First pass through library packaging. 2016-02-04 21:16:35 +00:00
libypclnt Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones 2017-01-20 04:28:41 +00:00
libz MFV r311279: zlib 1.2.10. 2017-01-04 16:09:08 +00:00
msun Turn COMPILER_VERSION/COMPILER_TYPE make check into a compile-time check 2017-01-15 09:05:26 +00:00
ncurses Use SRCTOP-relative paths and .CURDIR with :H instead of ".." specified paths 2017-01-20 04:27:40 +00:00
tests Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installed 2016-05-04 23:20:53 +00:00
Makefile Fix typo in lib/Makefile 2017-01-28 23:51:03 +00:00
Makefile.inc