We need the kernfs/driver core fixes in here as well.
Showing the changes to scripts (3 of 1035 files). Show all
Unified · Split
| @@ -231,7 +231,7 @@ objtool_args = \ · 230 unmodified lines | |||
| 231 | $(if $(part-of-module), --module) \ | 231 | $(if $(part-of-module), --module) \ |
| 232 | $(if $(CONFIG_X86_KERNEL_IBT), --lto --ibt) \ | 232 | $(if $(CONFIG_X86_KERNEL_IBT), --lto --ibt) \ |
| 233 | $(if $(CONFIG_FRAME_POINTER),, --no-fp) \ | 233 | $(if $(CONFIG_FRAME_POINTER),, --no-fp) \ |
| 234 | $(if $(CONFIG_GCOV_KERNEL)$(CONFIG_LTO_CLANG), --no-unreachable)\ | 234 | $(if $(CONFIG_GCOV_KERNEL), --no-unreachable) \ |
| 235 | $(if $(CONFIG_RETPOLINE), --retpoline) \ | 235 | $(if $(CONFIG_RETPOLINE), --retpoline) \ |
| 236 | $(if $(CONFIG_X86_SMAP), --uaccess) \ | 236 | $(if $(CONFIG_X86_SMAP), --uaccess) \ |
| 237 | $(if $(CONFIG_FTRACE_MCOUNT_USE_OBJTOOL), --mcount) \ | 237 | $(if $(CONFIG_FTRACE_MCOUNT_USE_OBJTOOL), --mcount) \ |
| @@ -86,25 +86,31 @@ static struct plugin_info latent_entropy_plugin_info = { · 85 unmodified lines | |||
| 86 | .help = "disable\tturn off latent entropy instrumentation\n", | 86 | .help = "disable\tturn off latent entropy instrumentation\n", |
| 87 | }; | 87 | }; |
| 88 | 88 | ||
| 89 | static unsigned HOST_WIDE_INT seed; | 89 | static unsigned HOST_WIDE_INT deterministic_seed; |
| 90 | /* | 90 | static unsigned HOST_WIDE_INT rnd_buf[32]; |
| 91 | * get_random_seed() (this is a GCC function) generates the seed. | 91 | static size_t rnd_idx = ARRAY_SIZE(rnd_buf); |
| 92 | * This is a simple random generator without any cryptographic security because | 92 | static int urandom_fd = -1; |
| 93 | * the entropy doesn't come from here. | 93 | |
| 94 | */ | ||
| 95 | static unsigned HOST_WIDE_INT get_random_const(void) | 94 | static unsigned HOST_WIDE_INT get_random_const(void) |
| 96 | { | 95 | { |
| 97 | unsigned int i; | 96 | if (deterministic_seed) { |
| 98 | unsigned HOST_WIDE_INT ret = 0; | 97 | unsigned HOST_WIDE_INT w = deterministic_seed; |
| 99 | 98 | w ^= w << 13; | |
| 100 | for (i = 0; i < 8 * sizeof(ret); i++) { | 99 | w ^= w >> 7; |
| 101 | ret = (ret << 1) | (seed & 1); | 100 | w ^= w << 17; |
| 102 | seed >>= 1; | 101 | deterministic_seed = w; |
| 103 | if (ret & 1) | 102 | return deterministic_seed; |
| 104 | seed ^= 0xD800000000000000ULL; | ||
| 105 | } | 103 | } |
| 106 | 104 | ||
| 107 | return ret; | 105 | if (urandom_fd < 0) { |
| 106 | urandom_fd = open("/dev/urandom", O_RDONLY); | ||
| 107 | gcc_assert(urandom_fd >= 0); | ||
| 108 | } | ||
| 109 | if (rnd_idx >= ARRAY_SIZE(rnd_buf)) { | ||
| 110 | gcc_assert(read(urandom_fd, rnd_buf, sizeof(rnd_buf)) == sizeof(rnd_buf)); | ||
| 111 | rnd_idx = 0; | ||
| 112 | } | ||
| 113 | return rnd_buf[rnd_idx++]; | ||
| 108 | } | 114 | } |
| 109 | 115 | ||
| 110 | static tree tree_get_random_const(tree type) | 116 | static tree tree_get_random_const(tree type) |
| @@ -537,8 +543,6 @@ static void latent_entropy_start_unit(void *gcc_data __unused, · 426 unmodified lines | |||
| 537 | tree type, id; | 543 | tree type, id; |
| 538 | int quals; | 544 | int quals; |
| 539 | 545 | ||
| 540 | seed = get_random_seed(false); | ||
| 541 | |||
| 542 | if (in_lto_p) | 546 | if (in_lto_p) |
| 543 | return; | 547 | return; |
| 544 | 548 | ||
| @@ -573,6 +577,12 @@ __visible int plugin_init(struct plugin_name_args *plugin_info, · 28 unmodified lines | |||
| 573 | const struct plugin_argument * const argv = plugin_info->argv; | 577 | const struct plugin_argument * const argv = plugin_info->argv; |
| 574 | int i; | 578 | int i; |
| 575 | 579 | ||
| 580 | /* | ||
| 581 | * Call get_random_seed() with noinit=true, so that this returns | ||
| 582 | * 0 in the case where no seed has been passed via -frandom-seed. | ||
| 583 | */ | ||
| 584 | deterministic_seed = get_random_seed(true); | ||
| 585 | |||
| 576 | static const struct ggc_root_tab gt_ggc_r_gt_latent_entropy[] = { | 586 | static const struct ggc_root_tab gt_ggc_r_gt_latent_entropy[] = { |
| 577 | { | 587 | { |
| 578 | .base = &latent_entropy_decl, | 588 | .base = &latent_entropy_decl, |
| @@ -140,7 +140,7 @@ objtool_link() · 139 unmodified lines | |||
| 140 | if ! is_enabled CONFIG_FRAME_POINTER; then | 140 | if ! is_enabled CONFIG_FRAME_POINTER; then |
| 141 | objtoolopt="${objtoolopt} --no-fp" | 141 | objtoolopt="${objtoolopt} --no-fp" |
| 142 | fi | 142 | fi |
| 143 | if is_enabled CONFIG_GCOV_KERNEL || is_enabled CONFIG_LTO_CLANG; then | 143 | if is_enabled CONFIG_GCOV_KERNEL; then |
| 144 | objtoolopt="${objtoolopt} --no-unreachable" | 144 | objtoolopt="${objtoolopt} --no-unreachable" |
| 145 | fi | 145 | fi |
| 146 | if is_enabled CONFIG_RETPOLINE; then | 146 | if is_enabled CONFIG_RETPOLINE; then |