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
..
2017-01-15 17:54:01 +00:00
2016-09-08 14:04:04 +00:00
2016-05-18 04:35:58 +00:00
2016-01-09 20:18:53 +00:00
2016-04-29 22:15:33 +00:00
2017-02-07 20:34:03 +00:00
2016-10-04 17:57:30 +00:00
2017-02-07 17:03:22 +00:00
2017-02-10 19:45:02 +00:00
2017-01-15 09:25:33 +00:00
2016-03-11 23:18:06 +00:00
2016-11-22 01:02:59 +00:00
2017-01-20 17:40:31 +00:00
2016-09-06 17:16:59 +00:00
2016-12-12 19:11:04 +00:00
2016-09-15 13:16:20 +00:00
2016-05-14 18:22:52 +00:00
2017-02-05 13:24:54 +00:00
2016-11-08 23:59:41 +00:00
2017-02-05 01:40:27 +00:00
2016-12-10 16:20:39 +00:00
2016-04-15 03:09:55 +00:00
2016-12-14 12:56:58 +00:00
2017-01-16 08:25:33 +00:00
2017-01-06 16:56:24 +00:00
2016-12-12 11:11:50 +00:00
2016-06-09 13:17:08 +00:00
2016-04-19 23:48:27 +00:00
2016-12-12 15:37:11 +00:00
2016-06-21 13:48:49 +00:00
2016-08-09 02:16:21 +00:00
2016-08-10 13:47:12 +00:00
2016-01-31 17:32:20 +00:00
2017-01-20 14:59:56 +00:00
2016-10-13 02:06:23 +00:00
2017-02-12 09:49:44 +00:00
2017-01-30 15:20:13 +00:00
2017-01-27 15:03:51 +00:00
2015-11-15 12:10:51 +00:00
2016-09-15 13:16:20 +00:00
2016-05-18 04:35:58 +00:00
2016-10-19 19:42:01 +00:00
2015-10-10 09:21:55 +00:00
2016-04-29 22:15:33 +00:00
2017-02-09 08:19:30 +00:00
2017-01-25 20:22:32 +00:00
2016-04-26 19:57:35 +00:00
2016-04-07 04:23:25 +00:00
2017-01-27 22:14:42 +00:00
2016-12-07 15:04:22 +00:00
2016-12-14 22:49:20 +00:00
2017-01-24 21:48:57 +00:00
2017-01-22 15:35:51 +00:00
2016-04-29 22:15:33 +00:00
2016-09-15 13:16:20 +00:00
2017-02-04 06:24:49 +00:00
2017-02-09 13:32:19 +00:00
2017-01-04 22:27:19 +00:00
2015-11-23 07:09:35 +00:00
2017-01-28 16:31:23 +00:00
2016-09-15 13:16:20 +00:00
2017-01-22 19:41:42 +00:00
2017-02-09 08:19:30 +00:00
2017-01-16 20:34:42 +00:00
2016-12-15 15:45:11 +00:00
2016-12-14 12:56:58 +00:00
2016-12-03 01:14:21 +00:00
2017-02-07 17:03:22 +00:00
2017-01-24 18:05:29 +00:00
2016-11-25 18:02:43 +00:00
2016-11-15 01:34:38 +00:00
2016-09-15 13:16:20 +00:00
2015-08-30 18:02:57 +00:00
2016-04-29 22:15:33 +00:00
2016-04-15 16:10:11 +00:00
2016-04-29 22:15:33 +00:00
2015-10-27 22:59:24 +00:00
2016-07-28 21:29:04 +00:00
2017-02-10 19:25:52 +00:00
2016-05-26 19:29:29 +00:00
2016-05-26 19:29:29 +00:00
2016-05-16 09:11:40 +00:00
2016-08-19 10:52:39 +00:00
2016-04-27 00:10:32 +00:00
2017-01-19 18:46:41 +00:00
2017-01-19 18:46:41 +00:00
2015-09-04 00:14:20 +00:00
2016-09-15 13:16:20 +00:00
2016-09-15 13:16:20 +00:00
2016-01-11 20:38:39 +00:00
2017-01-15 17:54:01 +00:00
2015-10-20 03:25:17 +00:00
2015-12-01 02:48:42 +00:00
2017-01-24 18:05:29 +00:00
2016-12-13 20:11:45 +00:00
2016-05-25 19:44:26 +00:00
2016-05-19 14:08:36 +00:00
2016-11-08 23:59:41 +00:00
2017-01-26 13:48:45 +00:00
2016-09-15 13:16:20 +00:00
2017-02-06 13:08:48 +00:00
2017-02-07 16:01:07 +00:00
2016-09-15 13:16:20 +00:00
2016-04-29 22:15:33 +00:00
2016-09-15 13:16:20 +00:00
2016-04-29 22:15:33 +00:00
2016-11-22 01:02:59 +00:00
2016-09-15 13:16:20 +00:00
2016-04-26 15:38:17 +00:00
2016-10-24 18:03:04 +00:00
2016-09-15 13:16:20 +00:00
2016-05-20 17:57:47 +00:00
2016-09-21 10:15:08 +00:00
2015-10-02 09:23:14 +00:00
2016-09-15 13:16:20 +00:00
2017-02-07 17:31:24 +00:00
2016-05-20 23:28:43 +00:00
2016-12-23 05:02:17 +00:00
2016-10-24 16:40:27 +00:00
2015-11-19 05:56:59 +00:00
2016-09-21 08:23:33 +00:00
2016-09-29 10:38:20 +00:00
2016-07-18 10:53:47 +00:00
2016-10-22 18:02:20 +00:00
2017-02-12 20:54:31 +00:00
2017-01-14 04:16:13 +00:00
2016-05-11 23:16:11 +00:00
2017-02-05 02:27:04 +00:00
2016-10-21 16:12:23 +00:00
2017-01-31 15:35:18 +00:00
2016-06-22 21:18:19 +00:00
2016-07-27 11:08:59 +00:00
2016-08-19 17:57:14 +00:00
2017-01-06 23:41:45 +00:00
2017-02-10 19:45:02 +00:00
2016-12-27 20:21:11 +00:00
2016-12-27 20:22:17 +00:00
2016-06-09 15:34:33 +00:00
2016-04-29 22:15:33 +00:00
2016-07-26 17:23:49 +00:00
2016-09-15 13:16:20 +00:00
2016-09-15 13:16:20 +00:00
2017-01-13 16:37:38 +00:00
2017-01-13 16:37:38 +00:00
2016-04-29 22:15:33 +00:00
2016-01-26 14:46:39 +00:00
2017-01-13 17:03:23 +00:00
2016-10-12 00:56:49 +00:00
2016-03-01 18:12:14 +00:00
2016-09-15 13:16:20 +00:00
2017-01-12 06:38:03 +00:00
2017-01-15 03:53:20 +00:00
2016-11-14 13:20:10 +00:00
2016-04-14 17:07:26 +00:00
2017-02-12 21:05:44 +00:00
2016-09-15 13:16:20 +00:00
2017-02-01 13:12:07 +00:00
2017-01-30 12:57:22 +00:00
2017-01-25 22:26:45 +00:00
2016-08-17 10:14:22 +00:00
2017-01-10 21:41:28 +00:00
2017-01-30 03:20:05 +00:00
2017-01-04 22:27:19 +00:00
2017-02-12 09:49:44 +00:00
2016-11-17 16:13:30 +00:00
2016-05-11 06:32:22 +00:00
2016-09-15 13:16:20 +00:00
2017-01-22 19:36:02 +00:00
2017-01-05 17:19:26 +00:00
2017-02-06 20:44:34 +00:00
2017-02-05 03:23:16 +00:00
2017-01-31 15:19:44 +00:00
2017-02-12 21:05:44 +00:00
2016-09-15 13:16:20 +00:00