diff options
Diffstat (limited to 'tools/objtool/special.c')
| -rw-r--r-- | tools/objtool/special.c | 48 | 
1 files changed, 6 insertions, 42 deletions
diff --git a/tools/objtool/special.c b/tools/objtool/special.c index e893f1e48e44..1a2420febd08 100644 --- a/tools/objtool/special.c +++ b/tools/objtool/special.c @@ -14,24 +14,7 @@  #include "builtin.h"  #include "special.h"  #include "warn.h" - -#define EX_ENTRY_SIZE		12 -#define EX_ORIG_OFFSET		0 -#define EX_NEW_OFFSET		4 - -#define JUMP_ENTRY_SIZE		16 -#define JUMP_ORIG_OFFSET	0 -#define JUMP_NEW_OFFSET		4 - -#define ALT_ENTRY_SIZE		13 -#define ALT_ORIG_OFFSET		0 -#define ALT_NEW_OFFSET		4 -#define ALT_FEATURE_OFFSET	8 -#define ALT_ORIG_LEN_OFFSET	10 -#define ALT_NEW_LEN_OFFSET	11 - -#define X86_FEATURE_POPCNT (4*32+23) -#define X86_FEATURE_SMAP   (9*32+20) +#include "arch_special.h"  struct special_entry {  	const char *sec; @@ -68,6 +51,10 @@ struct special_entry entries[] = {  	{},  }; +void __weak arch_handle_alternative(unsigned short feature, struct special_alt *alt) +{ +} +  static int get_alt_entry(struct elf *elf, struct special_entry *entry,  			 struct section *sec, int idx,  			 struct special_alt *alt) @@ -92,30 +79,7 @@ static int get_alt_entry(struct elf *elf, struct special_entry *entry,  		feature = *(unsigned short *)(sec->data->d_buf + offset +  					      entry->feature); - -		/* -		 * It has been requested that we don't validate the !POPCNT -		 * feature path which is a "very very small percentage of -		 * machines". -		 */ -		if (feature == X86_FEATURE_POPCNT) -			alt->skip_orig = true; - -		/* -		 * If UACCESS validation is enabled; force that alternative; -		 * otherwise force it the other way. -		 * -		 * What we want to avoid is having both the original and the -		 * alternative code flow at the same time, in that case we can -		 * find paths that see the STAC but take the NOP instead of -		 * CLAC and the other way around. -		 */ -		if (feature == X86_FEATURE_SMAP) { -			if (uaccess) -				alt->skip_orig = true; -			else -				alt->skip_alt = true; -		} +		arch_handle_alternative(feature, alt);  	}  	orig_reloc = find_reloc_by_dest(elf, sec, offset + entry->orig);  | 
