All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] syscalls/aarch64: Remove 32 bit only syscalls
@ 2021-09-02  9:36 Joerg Vehlow
  2021-09-02  9:42 ` Viresh Kumar
  0 siblings, 1 reply; 7+ messages in thread
From: Joerg Vehlow @ 2021-09-02  9:36 UTC (permalink / raw)
  To: ltp

From: Joerg Vehlow <joerg.vehlow@aox-tech.de>

These syscalls are not available in 64 bit builds of linux.
See: <linux>/include/uapi/asm-generic/unistd.h

With the syscall defined, the test clock_gettim04 fails with
../../../../include/tst_timer.h:216: TCONF: syscall(403) __NR_clock_gettime64 not supported

Fixes: 59d278d61ed90117607f389326e0816a14dbf53c ("lapi/syscalls: Update syscall numbers")
Signed-off-by: Joerg Vehlow <joerg.vehlow@aox-tech.de>
---

I am not 100% sure, how the syscall table for aarch64 is generated.
There are also compat version for some of the 32 bit only 64 bit syscalls,
but I think they are only available, when running an 32 bit arm application.

 include/lapi/syscalls/aarch64.in | 20 --------------------
 1 file changed, 20 deletions(-)

diff --git a/include/lapi/syscalls/aarch64.in b/include/lapi/syscalls/aarch64.in
index 5a2816099..a47185954 100644
--- a/include/lapi/syscalls/aarch64.in
+++ b/include/lapi/syscalls/aarch64.in
@@ -278,26 +278,6 @@ statx 291
 io_pgetevents 292
 rseq 293
 kexec_file_load 294
-clock_gettime64 403
-clock_settime64 404
-clock_adjtime64 405
-clock_getres_time64 406
-clock_nanosleep_time64 407
-timer_gettime64 408
-timer_settime64 409
-timerfd_gettime64 410
-timerfd_settime64 411
-utimensat_time64 412
-pselect6_time64 413
-ppoll_time64 414
-io_pgetevents_time64 416
-recvmmsg_time64 417
-mq_timedsend_time64 418
-mq_timedreceive_time64 419
-semtimedop_time64 420
-rt_sigtimedwait_time64 421
-futex_time64 422
-sched_rr_get_interval_time64 423
 pidfd_send_signal 424
 io_uring_setup 425
 io_uring_enter 426
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [LTP] [PATCH] syscalls/aarch64: Remove 32 bit only syscalls
  2021-09-02  9:36 [LTP] [PATCH] syscalls/aarch64: Remove 32 bit only syscalls Joerg Vehlow
@ 2021-09-02  9:42 ` Viresh Kumar
  2021-09-02 18:32   ` Arnd Bergmann
  0 siblings, 1 reply; 7+ messages in thread
From: Viresh Kumar @ 2021-09-02  9:42 UTC (permalink / raw)
  To: ltp

+Arnd

On 02-09-21, 11:36, Joerg Vehlow wrote:
> From: Joerg Vehlow <joerg.vehlow@aox-tech.de>
> 
> These syscalls are not available in 64 bit builds of linux.
> See: <linux>/include/uapi/asm-generic/unistd.h
> 
> With the syscall defined, the test clock_gettim04 fails with
> ../../../../include/tst_timer.h:216: TCONF: syscall(403) __NR_clock_gettime64 not supported
> 
> Fixes: 59d278d61ed90117607f389326e0816a14dbf53c ("lapi/syscalls: Update syscall numbers")
> Signed-off-by: Joerg Vehlow <joerg.vehlow@aox-tech.de>
> ---
> 
> I am not 100% sure, how the syscall table for aarch64 is generated.
> There are also compat version for some of the 32 bit only 64 bit syscalls,
> but I think they are only available, when running an 32 bit arm application.
> 
>  include/lapi/syscalls/aarch64.in | 20 --------------------
>  1 file changed, 20 deletions(-)
> 
> diff --git a/include/lapi/syscalls/aarch64.in b/include/lapi/syscalls/aarch64.in
> index 5a2816099..a47185954 100644
> --- a/include/lapi/syscalls/aarch64.in
> +++ b/include/lapi/syscalls/aarch64.in
> @@ -278,26 +278,6 @@ statx 291
>  io_pgetevents 292
>  rseq 293
>  kexec_file_load 294
> -clock_gettime64 403
> -clock_settime64 404
> -clock_adjtime64 405
> -clock_getres_time64 406
> -clock_nanosleep_time64 407
> -timer_gettime64 408
> -timer_settime64 409
> -timerfd_gettime64 410
> -timerfd_settime64 411
> -utimensat_time64 412
> -pselect6_time64 413
> -ppoll_time64 414
> -io_pgetevents_time64 416
> -recvmmsg_time64 417
> -mq_timedsend_time64 418
> -mq_timedreceive_time64 419
> -semtimedop_time64 420
> -rt_sigtimedwait_time64 421
> -futex_time64 422
> -sched_rr_get_interval_time64 423
>  pidfd_send_signal 424
>  io_uring_setup 425
>  io_uring_enter 426
> -- 
> 2.25.1

-- 
viresh

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [LTP] [PATCH] syscalls/aarch64: Remove 32 bit only syscalls
  2021-09-02  9:42 ` Viresh Kumar
@ 2021-09-02 18:32   ` Arnd Bergmann
  2021-09-03  4:33     ` Joerg Vehlow
  0 siblings, 1 reply; 7+ messages in thread
From: Arnd Bergmann @ 2021-09-02 18:32 UTC (permalink / raw)
  To: ltp

On Thu, Sep 2, 2021 at 9:42 AM Viresh Kumar <viresh.kumar@linaro.org> wrote:
>
> +Arnd
>
> On 02-09-21, 11:36, Joerg Vehlow wrote:
> > From: Joerg Vehlow <joerg.vehlow@aox-tech.de>
> >
> > These syscalls are not available in 64 bit builds of linux.
> > See: <linux>/include/uapi/asm-generic/unistd.h
> >
> > With the syscall defined, the test clock_gettim04 fails with
> > ../../../../include/tst_timer.h:216: TCONF: syscall(403) __NR_clock_gettime64 not supported
> >
> > Fixes: 59d278d61ed90117607f389326e0816a14dbf53c ("lapi/syscalls: Update syscall numbers")
> > Signed-off-by: Joerg Vehlow <joerg.vehlow@aox-tech.de>
> > ---
> >
> > I am not 100% sure, how the syscall table for aarch64 is generated.
> > There are also compat version for some of the 32 bit only 64 bit syscalls,
> > but I think they are only available, when running an 32 bit arm application.

The syscall table for aarch64 is generated from the kernel's
include/uapi/asm-generic/unistd.h, which has a number of #ifdefs in
it. A lot of these are disabled on aarch64 since they refer to older or
32-bit-only calls.

https://marcin.juszkiewicz.com.pl/download/tables/syscalls.html has a table
with the correct set of syscalls for each architecture, and scripts to generate
them from both the old asm-generic/unistd.h method (now only still used on
modern architectures) and the newer syscall.tbl format (used on older
architectures)

It would be good to finally convert asm-generic/unistd.h to the new format
in order to automatically generate tables like the one used by ltp. In the
meantime, please double-check all architectures against Marcin's tables.
The same problem likely also exists elsewhere, e.g. for rv64.

        Arnd

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [LTP] [PATCH] syscalls/aarch64: Remove 32 bit only syscalls
  2021-09-02 18:32   ` Arnd Bergmann
@ 2021-09-03  4:33     ` Joerg Vehlow
  2021-09-03  6:22       ` Petr Vorel
  0 siblings, 1 reply; 7+ messages in thread
From: Joerg Vehlow @ 2021-09-03  4:33 UTC (permalink / raw)
  To: ltp

Hi Arnd,

On 9/2/2021 8:32 PM, Arnd Bergmann wrote:
>
>>> I am not 100% sure, how the syscall table for aarch64 is generated.
>>> There are also compat version for some of the 32 bit only 64 bit syscalls,
>>> but I think they are only available, when running an 32 bit arm application.
> The syscall table for aarch64 is generated from the kernel's
> include/uapi/asm-generic/unistd.h, which has a number of #ifdefs in
> it. A lot of these are disabled on aarch64 since they refer to older or
> 32-bit-only calls.
>
> https://marcin.juszkiewicz.com.pl/download/tables/syscalls.html has a table
> with the correct set of syscalls for each architecture, and scripts to generate
> them from both the old asm-generic/unistd.h method (now only still used on
> modern architectures) and the newer syscall.tbl format (used on older
> architectures)
Thanks for this explanation, I already found this site, but wasn't sure 
if it is "correct".
>
> It would be good to finally convert asm-generic/unistd.h to the new format
> in order to automatically generate tables like the one used by ltp. In the
> meantime, please double-check all architectures against Marcin's tables.
> The same problem likely also exists elsewhere, e.g. for rv64.

@all
After Arnd's explanation, I guess this patch is correct and can be merged?
Other architectures and the remaining syscalls should be checked as well.
Maybe we can integrate Marcin's tool for extraction into ltp?
See: https://github.com/hrw/syscalls-table

Joerg

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [LTP] [PATCH] syscalls/aarch64: Remove 32 bit only syscalls
  2021-09-03  4:33     ` Joerg Vehlow
@ 2021-09-03  6:22       ` Petr Vorel
  2021-09-03 11:03         ` Arnd Bergmann
  0 siblings, 1 reply; 7+ messages in thread
From: Petr Vorel @ 2021-09-03  6:22 UTC (permalink / raw)
  To: ltp

Hi all,

> Hi Arnd,

> On 9/2/2021 8:32 PM, Arnd Bergmann wrote:

> > > > I am not 100% sure, how the syscall table for aarch64 is generated.
> > > > There are also compat version for some of the 32 bit only 64 bit syscalls,
> > > > but I think they are only available, when running an 32 bit arm application.
> > The syscall table for aarch64 is generated from the kernel's
> > include/uapi/asm-generic/unistd.h, which has a number of #ifdefs in
> > it. A lot of these are disabled on aarch64 since they refer to older or
> > 32-bit-only calls.

> > https://marcin.juszkiewicz.com.pl/download/tables/syscalls.html has a table
> > with the correct set of syscalls for each architecture, and scripts to generate
> > them from both the old asm-generic/unistd.h method (now only still used on
> > modern architectures) and the newer syscall.tbl format (used on older
> > architectures)
@Arnd: thanks a lot for this table and explanations! I would not expect this
kind of error in kernel sources.

When I changed / reviewed syscall numbers for LTP, I usually compared with
kernel and musl sources. I never noticed change, but now I see for
clock_gettime64 it's in musl only for arm (arch/arm/bits/syscall.h.in), but in
kernel it's not only for arm, but also for arm64:
arm64/include/asm/unistd.h:30:#define __NR_compat_clock_gettime64       403

Similarly timerfd_settime64 is for musl only for arm, in kernel for both.

All syscalls are *time64, that explains why they are only for 32bit.

> Thanks for this explanation, I already found this site, but wasn't sure if
> it is "correct".

> > It would be good to finally convert asm-generic/unistd.h to the new format
> > in order to automatically generate tables like the one used by ltp. In the
> > meantime, please double-check all architectures against Marcin's tables.
> > The same problem likely also exists elsewhere, e.g. for rv64.

> @all
> After Arnd's explanation, I guess this patch is correct and can be merged?
> Other architectures and the remaining syscalls should be checked as well.
> Maybe we can integrate Marcin's tool for extraction into ltp?
> See: https://github.com/hrw/syscalls-table
Sure.

Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr

> Joerg

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [LTP] [PATCH] syscalls/aarch64: Remove 32 bit only syscalls
  2021-09-03  6:22       ` Petr Vorel
@ 2021-09-03 11:03         ` Arnd Bergmann
  2021-09-03 12:20           ` Petr Vorel
  0 siblings, 1 reply; 7+ messages in thread
From: Arnd Bergmann @ 2021-09-03 11:03 UTC (permalink / raw)
  To: ltp

On Fri, Sep 3, 2021 at 6:22 AM Petr Vorel <pvorel@suse.cz> wrote:
>
> Hi all,
>
> > Hi Arnd,
>
> > On 9/2/2021 8:32 PM, Arnd Bergmann wrote:
>
> > > > > I am not 100% sure, how the syscall table for aarch64 is generated.
> > > > > There are also compat version for some of the 32 bit only 64 bit syscalls,
> > > > > but I think they are only available, when running an 32 bit arm application.
> > > The syscall table for aarch64 is generated from the kernel's
> > > include/uapi/asm-generic/unistd.h, which has a number of #ifdefs in
> > > it. A lot of these are disabled on aarch64 since they refer to older or
> > > 32-bit-only calls.
>
> > > https://marcin.juszkiewicz.com.pl/download/tables/syscalls.html has a table
> > > with the correct set of syscalls for each architecture, and scripts to generate
> > > them from both the old asm-generic/unistd.h method (now only still used on
> > > modern architectures) and the newer syscall.tbl format (used on older
> > > architectures)
> @Arnd: thanks a lot for this table and explanations! I would not expect this
> kind of error in kernel sources.

I don't see anything wrong in the kernel sources here, just a little misleading
when read by a human rather than a compiler.

> When I changed / reviewed syscall numbers for LTP, I usually compared with
> kernel and musl sources. I never noticed change, but now I see for
> clock_gettime64 it's in musl only for arm (arch/arm/bits/syscall.h.in), but in
> kernel it's not only for arm, but also for arm64:
> arm64/include/asm/unistd.h:30:#define __NR_compat_clock_gettime64       403

This is a kernel-internal definition that is used to build the 32-bit VDSO. The
file is not made available to user space applications.

The file you need to look at for arm64 is include/uapi/asm-generic/unistd.h.
As I said, that file has a lot of #ifdefs and other magic in it, but I suppose
we could come up with a script to process it with /usr/bin/unifdef to only
get the parts you are interested in. Ideally though we would just
convert it into the modern machine-readable syscall.tbl format.

        Arnd

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [LTP] [PATCH] syscalls/aarch64: Remove 32 bit only syscalls
  2021-09-03 11:03         ` Arnd Bergmann
@ 2021-09-03 12:20           ` Petr Vorel
  0 siblings, 0 replies; 7+ messages in thread
From: Petr Vorel @ 2021-09-03 12:20 UTC (permalink / raw)
  To: ltp

> On Fri, Sep 3, 2021 at 6:22 AM Petr Vorel <pvorel@suse.cz> wrote:

> > Hi all,

> > > Hi Arnd,

> > > On 9/2/2021 8:32 PM, Arnd Bergmann wrote:

> > > > > > I am not 100% sure, how the syscall table for aarch64 is generated.
> > > > > > There are also compat version for some of the 32 bit only 64 bit syscalls,
> > > > > > but I think they are only available, when running an 32 bit arm application.
> > > > The syscall table for aarch64 is generated from the kernel's
> > > > include/uapi/asm-generic/unistd.h, which has a number of #ifdefs in
> > > > it. A lot of these are disabled on aarch64 since they refer to older or
> > > > 32-bit-only calls.

> > > > https://marcin.juszkiewicz.com.pl/download/tables/syscalls.html has a table
> > > > with the correct set of syscalls for each architecture, and scripts to generate
> > > > them from both the old asm-generic/unistd.h method (now only still used on
> > > > modern architectures) and the newer syscall.tbl format (used on older
> > > > architectures)
> > @Arnd: thanks a lot for this table and explanations! I would not expect this
> > kind of error in kernel sources.

> I don't see anything wrong in the kernel sources here, just a little misleading
> when read by a human rather than a compiler.

> > When I changed / reviewed syscall numbers for LTP, I usually compared with
> > kernel and musl sources. I never noticed change, but now I see for
> > clock_gettime64 it's in musl only for arm (arch/arm/bits/syscall.h.in), but in
> > kernel it's not only for arm, but also for arm64:
> > arm64/include/asm/unistd.h:30:#define __NR_compat_clock_gettime64       403

> This is a kernel-internal definition that is used to build the 32-bit VDSO. The
> file is not made available to user space applications.

Thanks for info!

> The file you need to look at for arm64 is include/uapi/asm-generic/unistd.h.
> As I said, that file has a lot of #ifdefs and other magic in it, but I suppose
> we could come up with a script to process it with /usr/bin/unifdef to only
> get the parts you are interested in. Ideally though we would just
> convert it into the modern machine-readable syscall.tbl format.

+1

Kind regards,
Petr

>         Arnd

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-09-03 12:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-02  9:36 [LTP] [PATCH] syscalls/aarch64: Remove 32 bit only syscalls Joerg Vehlow
2021-09-02  9:42 ` Viresh Kumar
2021-09-02 18:32   ` Arnd Bergmann
2021-09-03  4:33     ` Joerg Vehlow
2021-09-03  6:22       ` Petr Vorel
2021-09-03 11:03         ` Arnd Bergmann
2021-09-03 12:20           ` Petr Vorel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.