tech-kern archive

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

Re: Testing Emulation Syscalls



On 2023-08-01 12:15, Emmanuel Dreyfus wrote:
> On Tue, Aug 01, 2023 at 05:52:57PM +0200, Martin Husemann wrote:
>> Yes we are. But the question is if we can create (tiny) test binaries
>> just for this purpose, without Linux dev tools and libs around,
>> from within a standard build.sh run.
> 
> You could craft a NetBSD binary that abuses the ELFNAME2(linux,probe)
> test in src/sys/compat/linux/common/linux_exec_elf32.c so that the kernel
> think it is a Linux binary. Of course if you use a syscall that does
> not have the same number in NetBSD and Linux, you crash, hence I am 
> not sure it could be useful.

My understanding of the "without Linux dev tools and libs around" part
is that each test case would be a separate (static Linux) binary that is
just a main() that only directly calls syscalls.

And then I guess integration with the rest of ATF could be done through
something like atf-sh-api(3), with status reporting done via exit codes
(maybe stdout/strerr too? but that would require more tooling).

Theo(dore)



Home | Main Index | Thread Index | Old Index