diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-09-21 09:36:28 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-09-21 09:36:28 -0700 |
commit | 56c631f5aec35117b0b5862a09a447a72dfbd678 (patch) | |
tree | dd8cd4fd783d1ce5a9f95a66c242e986d29c882a | |
parent | 56c1e8343494f0a315c99964ea1a952478394a8d (diff) | |
parent | 60f2c82ed20bde57c362e66f796cf9e0e38a6dbb (diff) |
Merge tag 'gcc-plugins-v5.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull gcc-plugins fix from Kees Cook:
"Fix a potential problem in randomize_layout structure auto-selection
(that was not triggered by any existing kernel structures)"
* tag 'gcc-plugins-v5.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
randstruct: Check member structs in is_pure_ops_struct()
-rw-r--r-- | scripts/gcc-plugins/randomize_layout_plugin.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/scripts/gcc-plugins/randomize_layout_plugin.c b/scripts/gcc-plugins/randomize_layout_plugin.c index 6d5bbd31db7f..bd29e4e7a524 100644 --- a/scripts/gcc-plugins/randomize_layout_plugin.c +++ b/scripts/gcc-plugins/randomize_layout_plugin.c @@ -443,13 +443,13 @@ static int is_pure_ops_struct(const_tree node) if (node == fieldtype) continue; - if (!is_fptr(fieldtype)) - return 0; - - if (code != RECORD_TYPE && code != UNION_TYPE) + if (code == RECORD_TYPE || code == UNION_TYPE) { + if (!is_pure_ops_struct(fieldtype)) + return 0; continue; + } - if (!is_pure_ops_struct(fieldtype)) + if (!is_fptr(fieldtype)) return 0; } |