mailing list of musl libc
 help / color / mirror / code / Atom feed
* [PATCH 1/7] fix preadv2 and pwritev2 syscall numbers on x32 for linux v4.8
@ 2016-10-09 16:58 Szabolcs Nagy
  2016-10-14 12:09 ` Khem Raj
  0 siblings, 1 reply; 5+ messages in thread
From: Szabolcs Nagy @ 2016-10-09 16:58 UTC (permalink / raw)
  To: musl

the numbers were wrong in musl, but they were also wrong in the kernel
and got fixed in v4.8 commit 3ebfd81f7fb3e81a754e37283b7f38c62244641a
---
 arch/x32/bits/syscall.h.in | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x32/bits/syscall.h.in b/arch/x32/bits/syscall.h.in
index cf2b4f1..e94dcb2 100644
--- a/arch/x32/bits/syscall.h.in
+++ b/arch/x32/bits/syscall.h.in
@@ -280,8 +280,6 @@
 #define __NR_membarrier (0x40000000 + 324)
 #define __NR_mlock2 (0x40000000 + 325)
 #define __NR_copy_file_range (0x40000000 + 326)
-#define __NR_preadv2 (0x40000000 + 327)
-#define __NR_pwritev2 (0x40000000 + 328)
 
 #define __NR_rt_sigaction (0x40000000 + 512)
 #define __NR_rt_sigreturn (0x40000000 + 513)
@@ -317,4 +315,6 @@
 #define __NR_io_setup (0x40000000 + 543)
 #define __NR_io_submit (0x40000000 + 544)
 #define __NR_execveat (0x40000000 + 545)
+#define __NR_preadv2 (0x40000000 + 546)
+#define __NR_pwritev2 (0x40000000 + 547)
 
-- 
2.10.0



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

* Re: [PATCH 1/7] fix preadv2 and pwritev2 syscall numbers on x32 for linux v4.8
  2016-10-09 16:58 [PATCH 1/7] fix preadv2 and pwritev2 syscall numbers on x32 for linux v4.8 Szabolcs Nagy
@ 2016-10-14 12:09 ` Khem Raj
  2016-10-14 15:04   ` Rich Felker
  2016-10-14 15:13   ` Szabolcs Nagy
  0 siblings, 2 replies; 5+ messages in thread
From: Khem Raj @ 2016-10-14 12:09 UTC (permalink / raw)
  To: musl

On Sun, Oct 9, 2016 at 6:58 PM, Szabolcs Nagy <nsz@port70.net> wrote:
> the numbers were wrong in musl, but they were also wrong in the kernel
> and got fixed in v4.8 commit 3ebfd81f7fb3e81a754e37283b7f38c62244641a

what happens if we now build musl trunk with linux kernel 3.7 ?

> ---
>  arch/x32/bits/syscall.h.in | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x32/bits/syscall.h.in b/arch/x32/bits/syscall.h.in
> index cf2b4f1..e94dcb2 100644
> --- a/arch/x32/bits/syscall.h.in
> +++ b/arch/x32/bits/syscall.h.in
> @@ -280,8 +280,6 @@
>  #define __NR_membarrier (0x40000000 + 324)
>  #define __NR_mlock2 (0x40000000 + 325)
>  #define __NR_copy_file_range (0x40000000 + 326)
> -#define __NR_preadv2 (0x40000000 + 327)
> -#define __NR_pwritev2 (0x40000000 + 328)
>
>  #define __NR_rt_sigaction (0x40000000 + 512)
>  #define __NR_rt_sigreturn (0x40000000 + 513)
> @@ -317,4 +315,6 @@
>  #define __NR_io_setup (0x40000000 + 543)
>  #define __NR_io_submit (0x40000000 + 544)
>  #define __NR_execveat (0x40000000 + 545)
> +#define __NR_preadv2 (0x40000000 + 546)
> +#define __NR_pwritev2 (0x40000000 + 547)
>
> --
> 2.10.0
>


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

* Re: [PATCH 1/7] fix preadv2 and pwritev2 syscall numbers on x32 for linux v4.8
  2016-10-14 12:09 ` Khem Raj
@ 2016-10-14 15:04   ` Rich Felker
  2016-10-14 15:13   ` Szabolcs Nagy
  1 sibling, 0 replies; 5+ messages in thread
From: Rich Felker @ 2016-10-14 15:04 UTC (permalink / raw)
  To: musl

On Fri, Oct 14, 2016 at 02:09:10PM +0200, Khem Raj wrote:
> On Sun, Oct 9, 2016 at 6:58 PM, Szabolcs Nagy <nsz@port70.net> wrote:
> > the numbers were wrong in musl, but they were also wrong in the kernel
> > and got fixed in v4.8 commit 3ebfd81f7fb3e81a754e37283b7f38c62244641a
> 
> what happens if we now build musl trunk with linux kernel 3.7 ?

There's no such thing as "building musl with linux 3.7". musl need not
be built on a Linux system at all; there's no build-time dependency on
Linux, only run-time.

As for what happens at run-time, the wrong values of the syscall
numbers presumably don't work at all, or worse yet do the wrong thing.
I'm not sure if the fixed values work if called when running on the
old kernel, but for practical purposes that kernel should just be
considered buggy/not-usable or "not supporting these new syscalls
yet" for x32. In any case they're new nonstandard ones and essentially
unused at this time.

Rich


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

* Re: [PATCH 1/7] fix preadv2 and pwritev2 syscall numbers on x32 for linux v4.8
  2016-10-14 12:09 ` Khem Raj
  2016-10-14 15:04   ` Rich Felker
@ 2016-10-14 15:13   ` Szabolcs Nagy
  2016-10-14 15:16     ` Rich Felker
  1 sibling, 1 reply; 5+ messages in thread
From: Szabolcs Nagy @ 2016-10-14 15:13 UTC (permalink / raw)
  To: musl

* Khem Raj <raj.khem@gmail.com> [2016-10-14 14:09:10 +0200]:

> On Sun, Oct 9, 2016 at 6:58 PM, Szabolcs Nagy <nsz@port70.net> wrote:
> > the numbers were wrong in musl, but they were also wrong in the kernel
> > and got fixed in v4.8 commit 3ebfd81f7fb3e81a754e37283b7f38c62244641a
> 
> what happens if we now build musl trunk with linux kernel 3.7 ?
> 

on v3.7 a raw syscall(__NR_preadv2,..) should return -ENOSYS.

these syscalls appeared in v4.6 (with wrong numbers: they overlap
with existing x32 numbers), but by accident i added them using
the x86_64 numbers to musl (most x32 syscalls are mapped to
x86_64 numbers), which means there is no overlap in musl.

with >=v4.6 kernel musl would try to use the x86_64 syscalls from
x32 which is wrong and i don't know how that plays out in practice.

this affects musl >=v1.1.15

linux v4.8 fixed the numbers, so we should fix them too.

> > ---
> >  arch/x32/bits/syscall.h.in | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/x32/bits/syscall.h.in b/arch/x32/bits/syscall.h.in
> > index cf2b4f1..e94dcb2 100644
> > --- a/arch/x32/bits/syscall.h.in
> > +++ b/arch/x32/bits/syscall.h.in
> > @@ -280,8 +280,6 @@
> >  #define __NR_membarrier (0x40000000 + 324)
> >  #define __NR_mlock2 (0x40000000 + 325)
> >  #define __NR_copy_file_range (0x40000000 + 326)
> > -#define __NR_preadv2 (0x40000000 + 327)
> > -#define __NR_pwritev2 (0x40000000 + 328)
> >
> >  #define __NR_rt_sigaction (0x40000000 + 512)
> >  #define __NR_rt_sigreturn (0x40000000 + 513)
> > @@ -317,4 +315,6 @@
> >  #define __NR_io_setup (0x40000000 + 543)
> >  #define __NR_io_submit (0x40000000 + 544)
> >  #define __NR_execveat (0x40000000 + 545)
> > +#define __NR_preadv2 (0x40000000 + 546)
> > +#define __NR_pwritev2 (0x40000000 + 547)
> >
> > --
> > 2.10.0
> >


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

* Re: [PATCH 1/7] fix preadv2 and pwritev2 syscall numbers on x32 for linux v4.8
  2016-10-14 15:13   ` Szabolcs Nagy
@ 2016-10-14 15:16     ` Rich Felker
  0 siblings, 0 replies; 5+ messages in thread
From: Rich Felker @ 2016-10-14 15:16 UTC (permalink / raw)
  To: musl

On Fri, Oct 14, 2016 at 05:13:59PM +0200, Szabolcs Nagy wrote:
> * Khem Raj <raj.khem@gmail.com> [2016-10-14 14:09:10 +0200]:
> 
> > On Sun, Oct 9, 2016 at 6:58 PM, Szabolcs Nagy <nsz@port70.net> wrote:
> > > the numbers were wrong in musl, but they were also wrong in the kernel
> > > and got fixed in v4.8 commit 3ebfd81f7fb3e81a754e37283b7f38c62244641a
> > 
> > what happens if we now build musl trunk with linux kernel 3.7 ?
> > 
> 
> on v3.7 a raw syscall(__NR_preadv2,..) should return -ENOSYS.
> 
> these syscalls appeared in v4.6 (with wrong numbers: they overlap
> with existing x32 numbers), but by accident i added them using
> the x86_64 numbers to musl (most x32 syscalls are mapped to
> x86_64 numbers), which means there is no overlap in musl.
> 
> with >=v4.6 kernel musl would try to use the x86_64 syscalls from
> x32 which is wrong and i don't know how that plays out in practice.
> 
> this affects musl >=v1.1.15
> 
> linux v4.8 fixed the numbers, so we should fix them too.

More accurately, it affects programs making raw syscalls using headers
from musl libc >=v1.1.15. musl itself does not use these syscalls at
all.

Rich


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

end of thread, other threads:[~2016-10-14 15:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-09 16:58 [PATCH 1/7] fix preadv2 and pwritev2 syscall numbers on x32 for linux v4.8 Szabolcs Nagy
2016-10-14 12:09 ` Khem Raj
2016-10-14 15:04   ` Rich Felker
2016-10-14 15:13   ` Szabolcs Nagy
2016-10-14 15:16     ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).