qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH for 6.2 16/49] bsd-user: elfload: simplify bswap a bit.


From: Richard Henderson
Subject: Re: [PATCH for 6.2 16/49] bsd-user: elfload: simplify bswap a bit.
Date: Tue, 10 Aug 2021 08:19:32 -1000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0

On 8/7/21 11:42 AM, Warner Losh wrote:
@@ -367,9 +383,7 @@ static abi_ulong load_elf_interp(struct elfhdr 
*interp_elf_ex,
      last_bss = 0;
      error = 0;
-#ifdef BSWAP_NEEDED
      bswap_ehdr(interp_elf_ex);
-#endif
      /* First of all, some simple consistency checks */
      if ((interp_elf_ex->e_type != ET_EXEC &&
           interp_elf_ex->e_type != ET_DYN) ||

Existing bug here: You should be checking, at minimum, EI_CLASS and EI_DATA before bswap. Otherwise you don't even know you're swapping the correct structure.

I noticed this much later in the series.

r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]