Re: [PATCH] Some tweaks for ELF

2013-08-27 Thread Martin Husemann
On Tue, Aug 27, 2013 at 08:28:04AM +0900, tsugutomo.en...@jp.sony.com wrote: Maxime Villard m...@m00nbsd.net writes: - How often is_dyn is true? Good point - I can't find any use for it. The code seems to agree: /* * XXX allow for executing shared objects. It seems silly

Re: [PATCH] Some tweaks for ELF

2013-08-27 Thread Christos Zoulas
In article 20130827072155.ga2...@mail.duskware.de, Martin Husemann mar...@duskware.de wrote: On Tue, Aug 27, 2013 at 08:28:04AM +0900, tsugutomo.en...@jp.sony.com wrote: Maxime Villard m...@m00nbsd.net writes: - How often is_dyn is true? Good point - I can't find any use for it. The code seems

Re: [PATCH] Some tweaks for ELF

2013-08-27 Thread tsugutomo . enami
Martin Husemann mar...@duskware.de writes: Are there any ET_DYN that are not shared libs? Maybe we should remove the is_dyn exec support completely. It looks like some linux binary is ET_DYN rather than ET_EXEC and exec_elfNN_makecmds is used by comapt code also. $ readelf -h /usr/bin/man ELF

Re: [PATCH] Some tweaks for ELF

2013-08-27 Thread Maxime Villard
On 08/27/13 10:44, Martin Husemann wrote: On Tue, Aug 27, 2013 at 04:37:30AM -0400, Christos Zoulas wrote: Useful or not, it currently works :-) Yes, and if we need it for compat: fine. Out of curiosity: why does linux produce some binaries with ET_DYN and other with ET_EXEC? We only seem

Re: [PATCH] Some tweaks for ELF

2013-08-27 Thread Martin Husemann
On Tue, Aug 27, 2013 at 10:56:04AM +0200, Maxime Villard wrote: ET_DYN can be either a shared library or a position-independent executable (PIE). There's no way to distinguish between them, except that a PIE must have a PT_INTERP segment. Ok, I'm on an arch w/o sane PLT format for ASLR, so no

Re: [PATCH] Some tweaks for ELF

2013-08-26 Thread Eric Haszlakiewicz
On Sun, Aug 25, 2013 at 03:31:42PM +0200, Maxime Villard wrote: Hi, here is a patch for some tweaks in kern/exec_elf.c. * Typo in a comment * elf_check_header() already ensures eh.e_phnum MAXPHNUM How about also moving the check for eh.e_phnum == 0 into elf_check_header? Eric

Re: [PATCH] Some tweaks for ELF

2013-08-26 Thread Maxime Villard
On 08/26/13 16:58, Eric Haszlakiewicz wrote: On Sun, Aug 25, 2013 at 03:31:42PM +0200, Maxime Villard wrote: Hi, here is a patch for some tweaks in kern/exec_elf.c. * Typo in a comment * elf_check_header() already ensures eh.e_phnum MAXPHNUM How about also moving the check for

Re: [PATCH] Some tweaks for ELF

2013-08-26 Thread tsugutomo . enami
Maxime Villard m...@m00nbsd.net writes: * Put is_dyn before. It's just a small optimization: elf_check_header(eh, ET_EXEC) is always called before checking is_dyn, so if we invert the two things we avoid calling elf_check_header() twice if is_dyn is ok. - How often is_dyn is true?

[PATCH] Some tweaks for ELF

2013-08-25 Thread Maxime Villard
Hi, here is a patch for some tweaks in kern/exec_elf.c. * Typo in a comment * elf_check_header() already ensures eh.e_phnum MAXPHNUM * Put is_dyn before. It's just a small optimization: elf_check_header(eh, ET_EXEC) is always called before checking is_dyn, so if we invert the two things

Re: [PATCH] Some tweaks for ELF

2013-08-25 Thread Martin Husemann
On Sun, Aug 25, 2013 at 03:31:42PM +0200, Maxime Villard wrote: Ok/Comments? Looks fine. Martin