Re: [osv-dev] [PATCH] Reject executables with non-matching machine type

2020-12-02 Thread Samuel Laberge
I'll absolutely make the error message more descriptive and include path of the ELF being loaded. I also think the arch-elf.hh file could be a good place for the constant, my reasoning for putting it in arch.hh is the comment: "architecture independent interface for architecture dependent

Re: [osv-dev] [PATCH] Reject executables with non-matching machine type

2020-12-01 Thread Pekka Enberg
Hi Samuel, On Mon, Nov 30, 2020 at 9:16 PM Samuel Laberge wrote: > I totally agree that would be simpler, I was just trying to match the > other conditionals around that one. But if it's better as != then I'd be > happy to change it! Up to you, really, but yeah "!=" is my preference. - Pekka

Re: [osv-dev] [PATCH] Reject executables with non-matching machine type

2020-11-30 Thread Waldek Kozaczuk
Hi, On Mon, Nov 30, 2020 at 2:16 PM Samuel Laberge wrote: > I totally agree that would be simpler, I was just trying to match the > other conditionals around that one. But if it's better as != then I'd be > happy to change it! > On Monday, November 30, 2020 at 3:14:39 AM UTC-7 Pekka Enberg

Re: [osv-dev] [PATCH] Reject executables with non-matching machine type

2020-11-30 Thread Samuel Laberge
I totally agree that would be simpler, I was just trying to match the other conditionals around that one. But if it's better as != then I'd be happy to change it! On Monday, November 30, 2020 at 3:14:39 AM UTC-7 Pekka Enberg wrote: > On Sun, Nov 29, 2020 at 11:22 AM Samuel Laberge > wrote: >

Re: [osv-dev] [PATCH] Reject executables with non-matching machine type

2020-11-30 Thread Pekka Enberg
On Sun, Nov 29, 2020 at 11:22 AM Samuel Laberge wrote: > Whenever an ELF file is loaded, its machine identifier is now > compared to the kernel's. If they differ, the executable is > rejected. > > Fixes #1104 > > Signed-off-by: Samuel Laberge > Reviewed-by: Pekka Enberg > --- >

[osv-dev] [PATCH] Reject executables with non-matching machine type

2020-11-29 Thread Samuel Laberge
Whenever an ELF file is loaded, its machine identifier is now compared to the kernel's. If they differ, the executable is rejected. Fixes #1104 Signed-off-by: Samuel Laberge --- arch/aarch64/arch.hh | 2 ++ arch/x64/arch.hh | 2 ++ core/elf.cc | 3 +++ 3 files changed, 7