mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	objtool: Don't use ignore flag for fake jumps
The ignore flag is set on fake jumps in order to keep add_jump_destinations() from setting their jump_dest, since it already got set when the fake jump was created. But using the ignore flag is a bit of a hack. It's normally used to skip validation of an instruction, which doesn't really make sense for fake jumps. Also, after the next patch, using the ignore flag for fake jumps can trigger a false "why am I validating an ignored function?" warning. Instead just add an explicit check in add_jump_destinations() to skip fake jumps. Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/71abc072ff48b2feccc197723a9c52859476c068.1557766718.git.jpoimboe@redhat.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
		
							parent
							
								
									82045dd855
								
							
						
					
					
						commit
						e6da956795
					
				
					 1 changed files with 5 additions and 3 deletions
				
			
		| 
						 | 
					@ -28,6 +28,8 @@
 | 
				
			||||||
#include <linux/hashtable.h>
 | 
					#include <linux/hashtable.h>
 | 
				
			||||||
#include <linux/kernel.h>
 | 
					#include <linux/kernel.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define FAKE_JUMP_OFFSET -1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct alternative {
 | 
					struct alternative {
 | 
				
			||||||
	struct list_head list;
 | 
						struct list_head list;
 | 
				
			||||||
	struct instruction *insn;
 | 
						struct instruction *insn;
 | 
				
			||||||
| 
						 | 
					@ -568,7 +570,7 @@ static int add_jump_destinations(struct objtool_file *file)
 | 
				
			||||||
		    insn->type != INSN_JUMP_UNCONDITIONAL)
 | 
							    insn->type != INSN_JUMP_UNCONDITIONAL)
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (insn->ignore)
 | 
							if (insn->ignore || insn->offset == FAKE_JUMP_OFFSET)
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		rela = find_rela_by_dest_range(insn->sec, insn->offset,
 | 
							rela = find_rela_by_dest_range(insn->sec, insn->offset,
 | 
				
			||||||
| 
						 | 
					@ -745,10 +747,10 @@ static int handle_group_alt(struct objtool_file *file,
 | 
				
			||||||
		clear_insn_state(&fake_jump->state);
 | 
							clear_insn_state(&fake_jump->state);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		fake_jump->sec = special_alt->new_sec;
 | 
							fake_jump->sec = special_alt->new_sec;
 | 
				
			||||||
		fake_jump->offset = -1;
 | 
							fake_jump->offset = FAKE_JUMP_OFFSET;
 | 
				
			||||||
		fake_jump->type = INSN_JUMP_UNCONDITIONAL;
 | 
							fake_jump->type = INSN_JUMP_UNCONDITIONAL;
 | 
				
			||||||
		fake_jump->jump_dest = list_next_entry(last_orig_insn, list);
 | 
							fake_jump->jump_dest = list_next_entry(last_orig_insn, list);
 | 
				
			||||||
		fake_jump->ignore = true;
 | 
							fake_jump->func = orig_insn->func;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!special_alt->new_len) {
 | 
						if (!special_alt->new_len) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue