linux: Handle personality filtering for 32 bits
Checks
Context |
Check |
Description |
redhat-pt-bot/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
redhat-pt-bot/TryBot-32bit |
success
|
Build for i686
|
linaro-tcwg-bot/tcwg_glibc_build--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_glibc_check--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 |
success
|
Testing passed
|
Commit Message
Since commit e0043e17dfc52fe170274, 32 bit personality wrapper does
not set errno because kernel default implementation always successfully
changes the personality if requested (although some arch-specific
implementations might return an error, like aarch64).
However if syscall is being filtered (by a seccomp filter for instance)
there is no way to distinguish a syscall error
(INTERNAL_SYSCALL_ERROR_P) from a possible kernel value.
So in this case just set the test as unsupported.
---
sysdeps/unix/sysv/linux/tst-personality.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
Comments
Ping.
On 06/06/23 13:48, Adhemerval Zanella wrote:
> Since commit e0043e17dfc52fe170274, 32 bit personality wrapper does
> not set errno because kernel default implementation always successfully
> changes the personality if requested (although some arch-specific
> implementations might return an error, like aarch64).
>
> However if syscall is being filtered (by a seccomp filter for instance)
> there is no way to distinguish a syscall error
> (INTERNAL_SYSCALL_ERROR_P) from a possible kernel value.
>
> So in this case just set the test as unsupported.
> ---
> sysdeps/unix/sysv/linux/tst-personality.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/sysdeps/unix/sysv/linux/tst-personality.c b/sysdeps/unix/sysv/linux/tst-personality.c
> index 5e59627826..79d9c607e1 100644
> --- a/sysdeps/unix/sysv/linux/tst-personality.c
> +++ b/sysdeps/unix/sysv/linux/tst-personality.c
> @@ -34,10 +34,17 @@ do_test (void)
> if (r == -1)
> {
> /* The syscall argument might be filtered by kernel, so the
> - test can not check for the bug issue. */
> + test can not check for the bug issue. For 32 bit architectures
> + the syscall wrapper also never sets the errno (check commit
> + e0043e17dfc52fe170274 for a full explanation), so in this case
> + there is no way to detected if the syscall is filtered. */
> +#if __WORDSIZE == 32
> + FAIL_UNSUPPORTED ("personality syscall argument are filtered");
> +#else
> if (errno == EPERM)
> FAIL_UNSUPPORTED ("personality syscall argument are filtered");
> FAIL_EXIT1 ("personality (%#x) failed: %m", test_persona);
> +#endif
> }
>
> TEST_COMPARE (r, saved_persona);
@@ -34,10 +34,17 @@ do_test (void)
if (r == -1)
{
/* The syscall argument might be filtered by kernel, so the
- test can not check for the bug issue. */
+ test can not check for the bug issue. For 32 bit architectures
+ the syscall wrapper also never sets the errno (check commit
+ e0043e17dfc52fe170274 for a full explanation), so in this case
+ there is no way to detected if the syscall is filtered. */
+#if __WORDSIZE == 32
+ FAIL_UNSUPPORTED ("personality syscall argument are filtered");
+#else
if (errno == EPERM)
FAIL_UNSUPPORTED ("personality syscall argument are filtered");
FAIL_EXIT1 ("personality (%#x) failed: %m", test_persona);
+#endif
}
TEST_COMPARE (r, saved_persona);