- make sure required exports from gcc plugins are visible to gcc
- switch latent_entropy to unsigned long to avoid stack frame bloat -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Kees Cook <kees@outflux.net> iQIcBAABCgAGBQJYGNL6AAoJEIly9N/cbcAm9kkP/3kx3vKAv9lidmylMppvsT/u IyLe+SgT7NmouYKaYcXfLF3rJsGar5+RBpMmBhm+8rsrBdDKru9L30jacXkHPuMd /6stf84thUu5VJHrHHOehaI5s5PDaEohdV2CQJfYR0U3x+uIP4RTPBLJOVog/l1g sDh9tx3Pp5VTtEV7N9utuqrbH8fDDcHdjhidlbf7AoVXvQf1tBxCPmgiayIufan7 NAoH4m6KhtRAPsNG9JQwfstB2OKFvnMwcHEOOv4w8R+whXEWXUkC3s+0ILivtmQA p677ZCLydA9N75fRT5iuaxWTorT7iHwwjh4hZvwLTNvizG4QKtU28eAl6Nip4zH9 +zL0/RONvBH0kjOrh9m/hFFvoPWyvAVKbztiF7CMWaG8poqgQfGQCUecfGLUCBu+ zj0FluBJInWBRAlMsc0F40ztVmjZGDga4l2a0Ip8SdqH796aC+0UTgGSF+HmabCR K3vKhEUJsYpy97+EwX51bWXB1nMBlxp1jVp1hmZUFm4kP7CMr4kiQL3Rn03duKEG emg0KXhza0Iu8PxAdO413TX/zUJNuBFlUKeIxHSXuoQsUJIUlw18TznxmrA2qSyD 88tnTQlGy37SMWwDK96GKYARKW2u1VGnEKGH0glud1sLNWj7p2hDY5Mg/gZmDD3g uyrM66DG3IWdOFTcFcHE =EQJ9 -----END PGP SIGNATURE----- Merge tag 'gcc-plugins-v4.9-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux Pull gcc plugin fixes from Kees Cook: - make sure required exports from gcc plugins are visible to gcc - switch latent_entropy to unsigned long to avoid stack frame bloat * tag 'gcc-plugins-v4.9-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: latent_entropy: Fix wrong gcc code generation with 64 bit variables gcc-plugins: Export symbols needed by gcc
This commit is contained in:
commit
577f12c07e
5 changed files with 18 additions and 18 deletions
|
@ -92,7 +92,7 @@ int _node_numa_mem_[MAX_NUMNODES];
|
|||
#endif
|
||||
|
||||
#ifdef CONFIG_GCC_PLUGIN_LATENT_ENTROPY
|
||||
volatile u64 latent_entropy __latent_entropy;
|
||||
volatile unsigned long latent_entropy __latent_entropy;
|
||||
EXPORT_SYMBOL(latent_entropy);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#include "gcc-common.h"
|
||||
|
||||
int plugin_is_GPL_compatible;
|
||||
__visible int plugin_is_GPL_compatible;
|
||||
|
||||
static struct plugin_info cyc_complexity_plugin_info = {
|
||||
.version = "20160225",
|
||||
|
@ -49,7 +49,7 @@ static unsigned int cyc_complexity_execute(void)
|
|||
|
||||
#include "gcc-generate-gimple-pass.h"
|
||||
|
||||
int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
|
||||
__visible int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
|
||||
{
|
||||
const char * const plugin_name = plugin_info->base_name;
|
||||
struct register_pass_info cyc_complexity_pass_info;
|
||||
|
|
|
@ -130,6 +130,7 @@ extern void dump_gimple_stmt(pretty_printer *, gimple, int, int);
|
|||
#endif
|
||||
|
||||
#define __unused __attribute__((__unused__))
|
||||
#define __visible __attribute__((visibility("default")))
|
||||
|
||||
#define DECL_NAME_POINTER(node) IDENTIFIER_POINTER(DECL_NAME(node))
|
||||
#define DECL_NAME_LENGTH(node) IDENTIFIER_LENGTH(DECL_NAME(node))
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
|
||||
#include "gcc-common.h"
|
||||
|
||||
int plugin_is_GPL_compatible;
|
||||
__visible int plugin_is_GPL_compatible;
|
||||
|
||||
static GTY(()) tree latent_entropy_decl;
|
||||
|
||||
|
@ -340,7 +340,7 @@ static enum tree_code get_op(tree *rhs)
|
|||
break;
|
||||
}
|
||||
if (rhs)
|
||||
*rhs = build_int_cstu(unsigned_intDI_type_node, random_const);
|
||||
*rhs = build_int_cstu(long_unsigned_type_node, random_const);
|
||||
return op;
|
||||
}
|
||||
|
||||
|
@ -372,7 +372,7 @@ static void __perturb_latent_entropy(gimple_stmt_iterator *gsi,
|
|||
enum tree_code op;
|
||||
|
||||
/* 1. create temporary copy of latent_entropy */
|
||||
temp = create_var(unsigned_intDI_type_node, "tmp_latent_entropy");
|
||||
temp = create_var(long_unsigned_type_node, "temp_latent_entropy");
|
||||
|
||||
/* 2. read... */
|
||||
add_referenced_var(latent_entropy_decl);
|
||||
|
@ -459,13 +459,13 @@ static void init_local_entropy(basic_block bb, tree local_entropy)
|
|||
gsi_insert_before(&gsi, call, GSI_NEW_STMT);
|
||||
update_stmt(call);
|
||||
|
||||
udi_frame_addr = fold_convert(unsigned_intDI_type_node, frame_addr);
|
||||
udi_frame_addr = fold_convert(long_unsigned_type_node, frame_addr);
|
||||
assign = gimple_build_assign(local_entropy, udi_frame_addr);
|
||||
gsi_insert_after(&gsi, assign, GSI_NEW_STMT);
|
||||
update_stmt(assign);
|
||||
|
||||
/* 3. create temporary copy of latent_entropy */
|
||||
tmp = create_var(unsigned_intDI_type_node, "tmp_latent_entropy");
|
||||
tmp = create_var(long_unsigned_type_node, "temp_latent_entropy");
|
||||
|
||||
/* 4. read the global entropy variable into local entropy */
|
||||
add_referenced_var(latent_entropy_decl);
|
||||
|
@ -480,7 +480,7 @@ static void init_local_entropy(basic_block bb, tree local_entropy)
|
|||
update_stmt(assign);
|
||||
|
||||
rand_cst = get_random_const();
|
||||
rand_const = build_int_cstu(unsigned_intDI_type_node, rand_cst);
|
||||
rand_const = build_int_cstu(long_unsigned_type_node, rand_cst);
|
||||
op = get_op(NULL);
|
||||
assign = create_assign(op, local_entropy, local_entropy, rand_const);
|
||||
gsi_insert_after(&gsi, assign, GSI_NEW_STMT);
|
||||
|
@ -529,7 +529,7 @@ static unsigned int latent_entropy_execute(void)
|
|||
}
|
||||
|
||||
/* 1. create the local entropy variable */
|
||||
local_entropy = create_var(unsigned_intDI_type_node, "local_entropy");
|
||||
local_entropy = create_var(long_unsigned_type_node, "local_entropy");
|
||||
|
||||
/* 2. initialize the local entropy variable */
|
||||
init_local_entropy(bb, local_entropy);
|
||||
|
@ -561,10 +561,9 @@ static void latent_entropy_start_unit(void *gcc_data __unused,
|
|||
if (in_lto_p)
|
||||
return;
|
||||
|
||||
/* extern volatile u64 latent_entropy */
|
||||
gcc_assert(TYPE_PRECISION(long_long_unsigned_type_node) == 64);
|
||||
quals = TYPE_QUALS(long_long_unsigned_type_node) | TYPE_QUAL_VOLATILE;
|
||||
type = build_qualified_type(long_long_unsigned_type_node, quals);
|
||||
/* extern volatile unsigned long latent_entropy */
|
||||
quals = TYPE_QUALS(long_unsigned_type_node) | TYPE_QUAL_VOLATILE;
|
||||
type = build_qualified_type(long_unsigned_type_node, quals);
|
||||
id = get_identifier("latent_entropy");
|
||||
latent_entropy_decl = build_decl(UNKNOWN_LOCATION, VAR_DECL, id, type);
|
||||
|
||||
|
@ -584,8 +583,8 @@ static void latent_entropy_start_unit(void *gcc_data __unused,
|
|||
| TODO_update_ssa
|
||||
#include "gcc-generate-gimple-pass.h"
|
||||
|
||||
int plugin_init(struct plugin_name_args *plugin_info,
|
||||
struct plugin_gcc_version *version)
|
||||
__visible int plugin_init(struct plugin_name_args *plugin_info,
|
||||
struct plugin_gcc_version *version)
|
||||
{
|
||||
bool enabled = true;
|
||||
const char * const plugin_name = plugin_info->base_name;
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "gcc-common.h"
|
||||
|
||||
int plugin_is_GPL_compatible;
|
||||
__visible int plugin_is_GPL_compatible;
|
||||
|
||||
tree sancov_fndecl;
|
||||
|
||||
|
@ -86,7 +86,7 @@ static void sancov_start_unit(void __unused *gcc_data, void __unused *user_data)
|
|||
#endif
|
||||
}
|
||||
|
||||
int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
|
||||
__visible int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
|
||||
{
|
||||
int i;
|
||||
struct register_pass_info sancov_plugin_pass_info;
|
||||
|
|
Loading…
Reference in a new issue