On 25/02/2026 18:04, Pierrick Bouvier wrote:
> On 2/25/26 6:58 AM, Florian Hofhammer wrote:
>> On 24/02/2026 21:24, Pierrick Bouvier wrote:
>>> On 2/24/26 7:52 AM, Florian Hofhammer wrote:
>>>> The test executes a non-existent syscall, which the syscall plugin
>>>> intercepts and redirects to a clean exit.
>>>> Due to architecture-specific quirks, the architecture-specific Makefiles
>>>> require setting specific compiler and linker flags in some cases.
>>>>
>>>> Signed-off-by: Florian Hofhammer <[email protected]>
>>>> ---
>>>>    tests/tcg/arm/Makefile.target                 |  6 +++++
>>>>    tests/tcg/hexagon/Makefile.target             |  7 +++++
>>>>    tests/tcg/mips/Makefile.target                |  6 ++++-
>>>>    tests/tcg/mips64/Makefile.target              | 15 +++++++++++
>>>>    tests/tcg/mips64el/Makefile.target            | 15 +++++++++++
>>>>    tests/tcg/mipsel/Makefile.target              | 15 +++++++++++
>>>>    tests/tcg/multiarch/Makefile.target           | 22 ++++++++++++++--
>>>>    .../{ => plugin}/check-plugin-output.sh       |  0
>>>>    .../{ => plugin}/test-plugin-mem-access.c     |  0
>>>>    .../plugin/test-plugin-skip-syscalls.c        | 26 +++++++++++++++++++
>>>>    tests/tcg/plugins/syscall.c                   |  6 +++++
>>>>    tests/tcg/sparc64/Makefile.target             | 16 ++++++++++++
>>>>    12 files changed, 131 insertions(+), 3 deletions(-)
>>>>    create mode 100644 tests/tcg/mips64/Makefile.target
>>>>    create mode 100644 tests/tcg/mips64el/Makefile.target
>>>>    create mode 100644 tests/tcg/mipsel/Makefile.target
>>>>    rename tests/tcg/multiarch/{ => plugin}/check-plugin-output.sh (100%)
>>>>    rename tests/tcg/multiarch/{ => plugin}/test-plugin-mem-access.c (100%)
>>>>    create mode 100644 
>>>> tests/tcg/multiarch/plugin/test-plugin-skip-syscalls.c
>>>>    create mode 100644 tests/tcg/sparc64/Makefile.target
>>>>
>>>> diff --git a/tests/tcg/mips/Makefile.target 
>>>> b/tests/tcg/mips/Makefile.target
>>>> index 5d17c1706e..d08138f17b 100644
>>>> --- a/tests/tcg/mips/Makefile.target
>>>> +++ b/tests/tcg/mips/Makefile.target
>>>> @@ -9,11 +9,15 @@ MIPS_SRC=$(SRC_PATH)/tests/tcg/mips
>>>>    VPATH         += $(MIPS_SRC)
>>>>      # hello-mips is 32 bit only
>>>> -ifeq ($(findstring 64,$(TARGET_NAME)),)
>>>>    MIPS_TESTS=hello-mips
>>>>      TESTS += $(MIPS_TESTS)
>>>>      hello-mips: CFLAGS+=-mno-abicalls -fno-PIC -fno-stack-protector 
>>>> -mabi=32
>>>>    hello-mips: LDFLAGS+=-nostdlib
>>>> +
>>>> +ifeq ($(CONFIG_PLUGIN),y)
>>>> +# qemu-mips(el) returns ENOSYS without triggering syscall plugin callbacks
>>>> +run-plugin-test-plugin-skip-syscalls-with-libsyscall.so:
>>>> +    $(call skip-test, $<, "qemu-mips does not execute invalid syscalls")
>>>
>>> I ran into this while pulling syscall filter API recently, and found 4096 
>>> as syscall number, which seems to make all architectures happy.
>>>
>>> See 948ffdd79b78702239aace2d32d4f581913299b3 for more details.
>>
>> Please correct me if I'm wrong, but is this really sane? The comment in
>> the referenced commit says that 4096 isn't used in any ISA, but on the
>> MIPS O32 ABI, syscall numbers start at 4000. 4096 therefore corresponds
>> to getpriority, which would be shadowed by using this syscall number.
> 
> I would definitely not recommend using this value in a general purpose plugin 
> to implement "hypercalls", it would not be sane.
> 
> That said, for the current limited test context where we now this syscall is 
> not called, I would say it's ok. And if it should get broken in the future, 
> we would catch it and could find another magic number.

Fair, I suppose I was overcomplicating this unnecessarily. :)

> Of course, if you have a better idea of syscall number, I would be very happy 
> to follow another rationale, as mine was mostly try and error. :)
> 
> Regards,
> Pierrick

Best regards,
Florian

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to