forked from mirrors/linux
		
	fs/binfmt_elf: fix PT_LOAD p_align values for loaders
Rui Salvaterra reported that Aisleroit solitaire crashes with "Wrong __data_start/_end pair" assertion from libgc after update to v5.17-rc1. Bisection pointed to commit9630f0d60f("fs/binfmt_elf: use PT_LOAD p_align values for static PIE") that fixed handling of static PIEs, but made the condition that guards load_bias calculation to exclude loader binaries. Restoring the check for presence of interpreter fixes the problem. Link: https://lkml.kernel.org/r/20220202121433.3697146-1-rppt@kernel.org Fixes:9630f0d60f("fs/binfmt_elf: use PT_LOAD p_align values for static PIE") Signed-off-by: Mike Rapoport <rppt@linux.ibm.com> Reported-by: Rui Salvaterra <rsalvaterra@gmail.com> Tested-by: Rui Salvaterra <rsalvaterra@gmail.com> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: Eric Biederman <ebiederm@xmission.com> Cc: "H.J. Lu" <hjl.tools@gmail.com> Cc: Kees Cook <keescook@chromium.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
		
							parent
							
								
									f1baf68e13
								
							
						
					
					
						commit
						925346c129
					
				
					 1 changed files with 1 additions and 1 deletions
				
			
		| 
						 | 
					@ -1117,7 +1117,7 @@ static int load_elf_binary(struct linux_binprm *bprm)
 | 
				
			||||||
			 * without MAP_FIXED nor MAP_FIXED_NOREPLACE).
 | 
								 * without MAP_FIXED nor MAP_FIXED_NOREPLACE).
 | 
				
			||||||
			 */
 | 
								 */
 | 
				
			||||||
			alignment = maximum_alignment(elf_phdata, elf_ex->e_phnum);
 | 
								alignment = maximum_alignment(elf_phdata, elf_ex->e_phnum);
 | 
				
			||||||
			if (alignment > ELF_MIN_ALIGN) {
 | 
								if (interpreter || alignment > ELF_MIN_ALIGN) {
 | 
				
			||||||
				load_bias = ELF_ET_DYN_BASE;
 | 
									load_bias = ELF_ET_DYN_BASE;
 | 
				
			||||||
				if (current->flags & PF_RANDOMIZE)
 | 
									if (current->flags & PF_RANDOMIZE)
 | 
				
			||||||
					load_bias += arch_mmap_rnd();
 | 
										load_bias += arch_mmap_rnd();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue