mirror of
				https://github.com/torvalds/linux.git
				synced 2025-10-31 16:48:26 +02:00 
			
		
		
		
	jump_label: Warn on failed jump_label patching attempt
Currently when the jump label code encounters an address which isn't recognized by kernel_text_address(), it just silently fails. This can be dangerous because jump labels are used in a variety of places, and are generally expected to work. Convert the silent failure to a warning. This won't warn about attempted writes to tracepoints in __init code after initmem has been freed, as those are already guarded by the entry->code check. Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> Acked-by: Peter Zijlstra <peterz@infradead.org> Cc: Borislav Petkov <bp@suse.de> Cc: Jason Baron <jbaron@akamai.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/de3a271c93807adb7ed48f4e946b4f9156617680.1519051220.git.jpoimboe@redhat.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
		
							parent
							
								
									3335224470
								
							
						
					
					
						commit
						dc1dd184c2
					
				
					 1 changed files with 8 additions and 5 deletions
				
			
		|  | @ -367,12 +367,15 @@ static void __jump_label_update(struct static_key *key, | ||||||
| { | { | ||||||
| 	for (; (entry < stop) && (jump_entry_key(entry) == key); entry++) { | 	for (; (entry < stop) && (jump_entry_key(entry) == key); entry++) { | ||||||
| 		/*
 | 		/*
 | ||||||
| 		 * entry->code set to 0 invalidates module init text sections | 		 * An entry->code of 0 indicates an entry which has been | ||||||
| 		 * kernel_text_address() verifies we are not in core kernel | 		 * disabled because it was in an init text area. | ||||||
| 		 * init code, see jump_label_invalidate_module_init(). |  | ||||||
| 		 */ | 		 */ | ||||||
| 		if (entry->code && kernel_text_address(entry->code)) | 		if (entry->code) { | ||||||
| 			arch_jump_label_transform(entry, jump_label_type(entry)); | 			if (kernel_text_address(entry->code)) | ||||||
|  | 				arch_jump_label_transform(entry, jump_label_type(entry)); | ||||||
|  | 			else | ||||||
|  | 				WARN_ONCE(1, "can't patch jump_label at %pS", (void *)entry->code); | ||||||
|  | 		} | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Josh Poimboeuf
						Josh Poimboeuf