Rik van Riel
5d8ff1e598
random,stackprotect: introduce get_random_canary function
...
Patch series "stackprotector: ascii armor the stack canary", v2.
Zero out the first byte of the stack canary value on 64 bit systems, in
order to mitigate unterminated C string overflows.
The null byte both prevents C string functions from reading the canary,
and from writing it if the canary value were guessed or obtained through
some other means.
Reducing the entropy by 8 bits is acceptable on 64-bit systems, which
will still have 56 bits of entropy left, but not on 32 bit systems, so
the "ascii armor" canary is only implemented on 64-bit systems.
Inspired by the "ascii armor" code in execshield and Daniel Micay's
linux-hardened tree.
Also see https://github.com/thestinger/linux-hardened/
This patch (of 5):
Introduce get_random_canary(), which provides a random unsigned long
canary value with the first byte zeroed out on 64 bit architectures, in
order to mitigate non-terminated C string overflows.
The null byte both prevents C string functions from reading the canary,
and from writing it if the canary value were guessed or obtained through
some other means.
Reducing the entropy by 8 bits is acceptable on 64-bit systems, which
will still have 56 bits of entropy left, but not on 32 bit systems, so
the "ascii armor" canary is only implemented on 64-bit systems.
Inspired by the "ascii armor" code in the old execshield patches, and
Daniel Micay's linux-hardened tree.
Change-Id: Ie16a7ac0e46aa4b97866bfbdfbaa3ae96ca401f2
Link: http://lkml.kernel.org/r/20170524155751.424-2-riel@redhat.com
Signed-off-by: Rik van Riel <riel@redhat.com >
Acked-by: Kees Cook <keescook@chromium.org >
Cc: Daniel Micay <danielmicay@gmail.com >
Cc: "Theodore Ts'o" <tytso@mit.edu >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Ingo Molnar <mingo@kernel.org >
Cc: Catalin Marinas <catalin.marinas@arm.com >
Cc: Yoshinori Sato <ysato@users.sourceforge.jp >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
Git-commit: 022c204040f3fd22d6445bc35517786195b7ae80
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org >
2017-08-04 16:32:00 -07:00
..
2017-01-19 13:31:51 -08:00
2017-02-18 15:11:40 +01:00
2017-03-15 10:02:51 +08:00
2016-11-07 09:59:19 -08:00
2017-05-15 12:08:11 -07:00
2016-10-11 15:06:33 -07:00
2017-04-03 10:20:10 -07:00
2017-01-11 13:58:04 -08:00
2016-10-17 16:26:29 +01:00
2017-03-15 10:02:46 +08:00
2017-03-30 22:41:47 -07:00
2017-07-19 17:57:21 +05:30
2016-11-28 15:33:46 -05:00
2017-07-21 07:42:18 +02:00
2017-07-09 06:49:46 -07:00
2017-06-19 08:27:32 +05:30
2017-05-09 03:03:11 +00:00
2017-04-03 19:20:57 -07:00
2017-04-04 14:23:53 -07:00
2017-04-11 16:49:21 -07:00
2017-02-17 16:14:38 -08:00
2017-05-11 16:50:41 -07:00
2016-10-22 17:08:07 -04:00
2017-05-04 21:12:32 -07:00
2017-04-03 14:41:37 -07:00
2017-07-27 08:32:26 +05:30
2017-02-03 10:57:24 -07:00
2016-10-31 15:09:53 -07:00
2017-06-09 11:20:42 -07:00
2017-02-01 08:33:09 +01:00
2017-07-27 12:19:24 -07:00
2016-11-11 23:23:02 +01:00
2017-02-09 11:08:17 -08:00
2017-01-19 13:32:09 -08:00
2017-04-12 12:41:21 +02:00
2016-10-11 15:06:31 -07:00
2016-10-11 15:06:31 -07:00
2017-01-23 15:37:49 -08:00
2017-04-05 09:55:57 -06:00
2017-03-27 11:01:04 -07:00
2017-06-23 05:18:09 -07:00
2016-10-14 12:18:50 -07:00
2016-10-09 17:32:20 -07:00
2017-07-19 18:41:26 +05:30
2017-02-10 21:38:54 -08:00
2017-03-22 12:43:35 +01:00
2017-05-30 17:27:28 -07:00
2017-07-05 14:40:21 +02:00
2017-03-29 13:02:14 -07:00
2017-01-06 10:40:13 +01:00
2017-03-30 09:41:26 +02:00
2017-02-07 14:50:45 -08:00
2017-06-15 13:20:27 -07:00
2017-06-15 13:20:27 -07:00
2017-06-28 20:05:59 -07:00
2017-05-16 09:38:15 +05:30
2017-02-27 16:32:28 -08:00
2016-10-07 18:46:29 -07:00
2017-03-12 06:41:44 +01:00
2016-11-30 16:32:52 -08:00
2016-10-15 10:03:15 -07:00
2016-11-11 08:12:37 -08:00
2017-07-05 14:40:26 +02:00
2016-11-11 15:52:05 -08:00
2017-04-13 18:39:01 -07:00
2017-06-06 18:10:04 -07:00
2017-07-27 16:43:54 -07:00
2017-03-31 20:01:14 -06:00
2017-02-23 10:43:31 -07:00
2017-02-17 16:14:38 -08:00
2017-03-20 12:16:05 -07:00
2017-06-20 15:16:30 -07:00
2017-01-31 10:46:19 -08:00
2017-07-28 16:52:35 -07:00
2016-10-07 18:46:30 -07:00
2016-10-11 15:06:30 -07:00
2017-01-27 13:55:00 -08:00
2017-03-22 12:43:33 +01:00
2017-03-15 10:02:44 +08:00
2017-03-30 17:22:00 -06:00
2017-03-13 13:14:00 -07:00
2017-06-23 05:18:09 -07:00
2017-07-24 17:23:13 -07:00
2017-06-21 15:33:55 -07:00
2017-05-12 18:24:39 -07:00
2017-03-20 16:12:44 -07:00
2017-04-24 21:19:31 -07:00
2016-10-27 18:08:27 +03:00
2017-01-19 20:18:00 +01:00
2017-03-28 07:23:10 -07:00
2016-10-14 14:26:58 -07:00
2017-07-20 09:04:50 -07:00
2017-05-14 14:00:22 +02:00
2017-07-12 15:01:02 +02:00
2016-10-15 10:03:15 -07:00
2017-05-23 15:47:17 -07:00
2016-11-11 08:12:37 -08:00
2017-06-14 16:42:56 +02:00
2017-06-17 06:41:52 +02:00
2017-03-31 10:31:46 +02:00
2017-03-12 06:41:52 +01:00
2017-05-14 14:00:22 +02:00
2017-07-20 11:14:56 +05:30
2017-01-19 13:31:41 -08:00
2017-05-24 02:48:20 -07:00
2017-05-25 15:44:41 +02:00
2017-07-20 11:14:56 +05:30
2017-05-11 13:26:42 -07:00
2016-11-17 09:46:56 -08:00
2016-10-07 18:46:29 -07:00
2017-03-22 12:43:37 +01:00
2017-07-31 03:20:22 -07:00
2017-01-19 13:32:06 -08:00
2017-01-19 13:32:06 -08:00
2017-01-19 13:32:07 -08:00
2016-10-07 23:50:39 -04:00
2017-06-07 12:07:45 +02:00
2016-10-15 10:03:15 -07:00
2017-01-27 13:52:19 -08:00
2017-03-12 06:41:43 +01:00
2017-06-07 05:53:14 +05:30
2016-10-12 22:19:19 -07:00
2016-10-26 15:45:38 +10:00
2016-10-20 15:51:28 +11:00
2017-07-25 12:40:57 +05:30
2016-11-03 12:43:03 -07:00
2016-10-27 18:08:27 +03:00
2017-08-01 10:14:35 -07:00
2017-07-24 11:45:45 -07:00
2016-12-09 15:07:58 -08:00
2017-07-12 06:34:53 -07:00
2017-06-29 21:35:09 +05:30
2017-06-29 21:35:09 +05:30
2017-03-27 04:03:56 +00:00
2017-02-09 08:08:31 +01:00
2017-01-19 20:17:59 +01:00
2016-10-16 11:02:31 +02:00
2017-01-19 13:32:05 -08:00
2016-10-27 18:43:43 -07:00
2016-10-09 12:23:38 -07:00
2016-10-07 18:46:30 -07:00
2016-10-11 15:06:33 -07:00
2017-01-19 13:31:44 -08:00
2017-01-19 13:31:45 -08:00
2017-01-19 13:31:46 -08:00
2016-10-11 15:06:33 -07:00
2017-01-27 18:30:50 -08:00
2017-05-25 15:44:47 +02:00
2016-10-11 15:06:33 -07:00
2017-04-08 09:30:34 +02:00
2017-02-09 11:49:33 -08:00
2017-05-30 11:45:32 -07:00
2017-02-09 11:49:33 -08:00
2017-02-09 11:08:19 -08:00
2017-07-28 13:52:28 -07:00
2017-03-15 10:02:47 +08:00
2017-07-21 07:42:21 +02:00
2017-06-17 06:41:51 +02:00
2017-07-14 13:52:17 -06:00
2017-07-14 13:52:17 -06:00
2017-07-04 18:25:31 +05:30
2017-04-08 09:30:35 +02:00
2017-02-09 08:08:28 +01:00
2017-01-31 10:45:55 -08:00
2017-06-17 06:41:54 +02:00
2017-01-19 20:17:59 +01:00
2017-01-31 13:55:27 -08:00
2017-07-21 12:25:22 -07:00
2017-07-20 14:15:08 +05:30
2017-02-03 10:57:24 -07:00
2017-03-15 02:22:24 +00:00
2017-04-12 15:28:42 -07:00
2017-01-27 11:27:29 -08:00
2016-10-26 10:40:46 -07:00
2017-03-16 11:31:12 -07:00
2017-05-17 00:08:58 -07:00
2017-06-26 09:55:11 +03:00
2016-11-03 12:43:03 -07:00
2017-01-18 11:01:17 -07:00
2017-05-04 16:56:58 -07:00
2017-04-17 17:46:09 -07:00
2017-06-19 08:29:21 +05:30
2017-01-31 10:47:22 -08:00
2017-07-05 13:17:33 -07:00
2017-05-26 15:05:08 +05:30
2017-02-01 08:33:08 +01:00
2017-07-05 13:17:33 -07:00
2016-10-19 11:36:22 -06:00
2017-02-09 11:08:14 -08:00
2017-03-27 11:01:04 -07:00
2017-01-27 13:52:16 -08:00
2016-11-29 23:17:02 -05:00
2017-02-03 10:57:24 -07:00
2017-07-20 11:14:57 +05:30
2016-11-30 16:32:52 -08:00
2017-04-12 12:41:21 +02:00
2017-06-17 06:41:48 +02:00
2017-02-09 08:08:28 +01:00
2017-04-03 19:20:57 -07:00
2017-07-05 14:40:19 +02:00
2017-02-15 17:40:08 -08:00
2016-10-14 11:36:59 -07:00
2017-07-20 11:14:45 +05:30
2017-01-06 10:40:15 +01:00
2017-04-10 19:51:45 -07:00
2016-10-08 11:06:08 -04:00
2017-07-05 14:00:57 -07:00
2016-10-09 12:23:38 -07:00
2017-01-27 13:52:20 -08:00
2017-02-26 11:10:51 +01:00
2017-06-14 15:05:54 +02:00
2017-06-28 15:45:50 +05:30
2017-07-19 11:32:22 +05:30
2017-06-23 05:18:43 -07:00
2016-11-11 17:31:37 -08:00
2016-10-11 15:06:30 -07:00
2017-08-04 16:32:00 -07:00
2017-01-26 08:24:37 +01:00
2017-01-17 18:25:21 -08:00
2016-10-11 15:06:32 -07:00
2017-05-23 15:47:18 -07:00
2017-07-11 18:04:05 -07:00
2017-07-19 18:41:22 +05:30
2016-10-27 18:08:27 +03:00
2017-01-31 10:46:49 -08:00
2017-07-31 14:14:29 -07:00
2017-01-17 15:07:57 -08:00
2017-07-12 14:35:08 -07:00
2017-07-12 10:12:23 -07:00
2016-10-11 15:06:33 -07:00
2016-10-07 18:46:30 -07:00
2017-01-27 13:52:22 -08:00
2016-11-03 12:43:04 -07:00
2016-10-26 17:31:23 -04:00
2017-05-22 15:40:25 -07:00
2017-01-27 13:52:34 -08:00
2017-01-13 14:38:18 -08:00
2017-01-27 13:51:52 -08:00
2017-07-20 11:14:45 +05:30
2017-07-20 11:14:45 +05:30
2017-01-26 08:24:44 +01:00
2016-10-17 09:50:56 -07:00
2017-06-21 17:15:50 -07:00
2017-03-14 13:16:06 -07:00
2017-03-14 13:16:06 -07:00
2017-02-04 09:47:09 +01:00
2017-06-15 16:44:00 -06:00
2017-07-11 18:04:23 -07:00
2017-02-23 18:13:22 -08:00
2017-06-29 13:00:30 +02:00
2017-01-27 13:55:47 -08:00
2017-07-17 19:23:35 -07:00
2017-02-07 14:50:54 -08:00
2017-04-21 09:31:21 +02:00
2017-02-28 13:57:52 -08:00
2017-07-25 10:48:16 -07:00
2017-03-18 19:14:29 +08:00
2017-07-27 15:08:03 -07:00
2017-02-04 09:47:09 +01:00
2017-07-20 11:14:56 +05:30
2017-07-27 11:18:17 +05:30
2017-07-19 10:59:12 +05:30
2016-10-24 23:41:21 +08:00
2017-01-27 13:52:35 -08:00
2016-10-08 10:27:10 +02:00
2017-01-19 13:32:42 -08:00
2016-10-07 21:48:36 -04:00