2015-05-09 18:33:16

by Chen Gang

[permalink] [raw]
Subject: [PATCH] alpha: Wire up missing syscalls

The related warnings:

CALL scripts/checksyscalls.sh
<stdin>:1238:2: warning: #warning syscall seccomp not implemented [-Wcpp]
<stdin>:1241:2: warning: #warning syscall getrandom not implemented [-Wcpp]
<stdin>:1244:2: warning: #warning syscall memfd_create not implemented [-Wcpp]
<stdin>:1247:2: warning: #warning syscall bpf not implemented [-Wcpp]
<stdin>:1250:2: warning: #warning syscall execveat not implemented [-Wcpp]


Signed-off-by: Chen Gang <[email protected]>
---
arch/alpha/include/asm/unistd.h | 2 +-
arch/alpha/include/uapi/asm/unistd.h | 5 +++++
arch/alpha/kernel/systbls.S | 5 +++++
3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/arch/alpha/include/asm/unistd.h b/arch/alpha/include/asm/unistd.h
index c509d30..973280c 100644
--- a/arch/alpha/include/asm/unistd.h
+++ b/arch/alpha/include/asm/unistd.h
@@ -3,7 +3,7 @@

#include <uapi/asm/unistd.h>

-#define NR_SYSCALLS 511
+#define NR_SYSCALLS 516

#define __ARCH_WANT_OLD_READDIR
#define __ARCH_WANT_STAT64
diff --git a/arch/alpha/include/uapi/asm/unistd.h b/arch/alpha/include/uapi/asm/unistd.h
index d214a035..1db20e5 100644
--- a/arch/alpha/include/uapi/asm/unistd.h
+++ b/arch/alpha/include/uapi/asm/unistd.h
@@ -472,5 +472,10 @@
#define __NR_sched_setattr 508
#define __NR_sched_getattr 509
#define __NR_renameat2 510
+#define __NR_seccomp 511
+#define __NR_getrandom 512
+#define __NR_memfd_create 513
+#define __NR_bpf 514
+#define __NR_execveat 515

#endif /* _UAPI_ALPHA_UNISTD_H */
diff --git a/arch/alpha/kernel/systbls.S b/arch/alpha/kernel/systbls.S
index 2478971..5a545d3 100644
--- a/arch/alpha/kernel/systbls.S
+++ b/arch/alpha/kernel/systbls.S
@@ -529,6 +529,11 @@ sys_call_table:
.quad sys_sched_setattr
.quad sys_sched_getattr
.quad sys_renameat2 /* 510 */
+ .quad sys_seccomp
+ .quad sys_getrandom
+ .quad sys_memfd_create
+ .quad sys_bpf
+ .quad sys_execveat /* 515 */

.size sys_call_table, . - sys_call_table
.type sys_call_table, @object
--
1.9.3


2015-05-12 09:26:06

by Michael Cree

[permalink] [raw]
Subject: Re: [PATCH] alpha: Wire up missing syscalls

On Sun, May 10, 2015 at 02:33:36AM +0800, Chen Gang wrote:
> The related warnings:
>
> CALL scripts/checksyscalls.sh
> <stdin>:1238:2: warning: #warning syscall seccomp not implemented [-Wcpp]
> <stdin>:1241:2: warning: #warning syscall getrandom not implemented [-Wcpp]
> <stdin>:1244:2: warning: #warning syscall memfd_create not implemented [-Wcpp]
> <stdin>:1247:2: warning: #warning syscall bpf not implemented [-Wcpp]
> <stdin>:1250:2: warning: #warning syscall execveat not implemented [-Wcpp]

Chen: Have you tested the syscalls you have wired up?

I have a suspicion that more is required to wire up the seccomp
syscall. At least some of the other older architectures had to
implement some extra arch dependent support to implement the seccomp
syscall. I don't know whether this is necessary or not on Alpha so
was wondering if this has been considered?

Matt: are you still feeding Alpha patches to Linus? I suspect there
might be a few other patches other than this one submitted to
linux-alpha that should be applied.

Cheers
Michael.

2015-05-12 11:40:52

by Chen Gang

[permalink] [raw]
Subject: Re: [PATCH] alpha: Wire up missing syscalls

On 05/12/2015 04:59 PM, Michael Cree wrote:
> On Sun, May 10, 2015 at 02:33:36AM +0800, Chen Gang wrote:
>> The related warnings:
>>
>> CALL scripts/checksyscalls.sh
>> <stdin>:1238:2: warning: #warning syscall seccomp not implemented [-Wcpp]
>> <stdin>:1241:2: warning: #warning syscall getrandom not implemented [-Wcpp]
>> <stdin>:1244:2: warning: #warning syscall memfd_create not implemented [-Wcpp]
>> <stdin>:1247:2: warning: #warning syscall bpf not implemented [-Wcpp]
>> <stdin>:1250:2: warning: #warning syscall execveat not implemented [-Wcpp]
>
> Chen: Have you tested the syscalls you have wired up?
>

Sorry, no, I didn't.

> I have a suspicion that more is required to wire up the seccomp
> syscall. At least some of the other older architectures had to
> implement some extra arch dependent support to implement the seccomp
> syscall. I don't know whether this is necessary or not on Alpha so
> was wondering if this has been considered?
>

At present, I guess (I did not test), it will lead to sys_ni_call(), so
it is really only "wire up".

> Matt: are you still feeding Alpha patches to Linus? I suspect there
> might be a few other patches other than this one submitted to
> linux-alpha that should be applied.
>

I found another issue when building alpha, I guess, it is valuable to be
fixed (or there was already related patch but did not submitted?):

arch/alpha/kernel/osf_sys.c: In function ?SyS_osf_settimeofday?:
arch/alpha/kernel/osf_sys.c:1028:14: warning: ?kts.tv_nsec? may be
used uninitialized in this function [-Wmaybe-uninitialized]
kts.tv_nsec *= 1000;
^
arch/alpha/kernel/osf_sys.c:1016:18: note: ?kts? was declared here
struct timespec kts;
^

Thanks.
--
Chen Gang

Open, share, and attitude like air, water, and life which God blessed

2015-05-12 11:46:22

by Chen Gang

[permalink] [raw]
Subject: Re: [PATCH] alpha: Wire up missing syscalls

On 05/12/2015 07:40 PM, Chen Gang wrote:
> On 05/12/2015 04:59 PM, Michael Cree wrote:
>> On Sun, May 10, 2015 at 02:33:36AM +0800, Chen Gang wrote:
>>> The related warnings:
>>>
>>> CALL scripts/checksyscalls.sh
>>> <stdin>:1238:2: warning: #warning syscall seccomp not implemented [-Wcpp]
>>> <stdin>:1241:2: warning: #warning syscall getrandom not implemented [-Wcpp]
>>> <stdin>:1244:2: warning: #warning syscall memfd_create not implemented [-Wcpp]
>>> <stdin>:1247:2: warning: #warning syscall bpf not implemented [-Wcpp]
>>> <stdin>:1250:2: warning: #warning syscall execveat not implemented [-Wcpp]
>>
>> Chen: Have you tested the syscalls you have wired up?
>>
>
> Sorry, no, I didn't.
>
>> I have a suspicion that more is required to wire up the seccomp
>> syscall. At least some of the other older architectures had to
>> implement some extra arch dependent support to implement the seccomp
>> syscall. I don't know whether this is necessary or not on Alpha so
>> was wondering if this has been considered?
>>
>
> At present, I guess (I did not test), it will lead to sys_ni_call(), so
> it is really only "wire up".
>
>> Matt: are you still feeding Alpha patches to Linus? I suspect there
>> might be a few other patches other than this one submitted to
>> linux-alpha that should be applied.
>>
>
> I found another issue when building alpha, I guess, it is valuable to be
> fixed (or there was already related patch but did not submitted?):
>

It is only a building issue, not a bug (for me, it is valuable to be
fixed: only move "kts.tv_nsec *= 1000" to "if (tv) { ... }").

> arch/alpha/kernel/osf_sys.c: In function ?SyS_osf_settimeofday?:
> arch/alpha/kernel/osf_sys.c:1028:14: warning: ?kts.tv_nsec? may be
> used uninitialized in this function [-Wmaybe-uninitialized]
> kts.tv_nsec *= 1000;
> ^
> arch/alpha/kernel/osf_sys.c:1016:18: note: ?kts? was declared here
> struct timespec kts;
> ^


Thanks.
--
Chen Gang

Open, share, and attitude like air, water, and life which God blessed

2015-05-12 14:30:26

by Dave Jones

[permalink] [raw]
Subject: Re: [PATCH] alpha: Wire up missing syscalls

On Tue, May 12, 2015 at 08:59:52PM +1200, Michael Cree wrote:
> On Sun, May 10, 2015 at 02:33:36AM +0800, Chen Gang wrote:
> > The related warnings:
> >
> > CALL scripts/checksyscalls.sh
> > <stdin>:1238:2: warning: #warning syscall seccomp not implemented [-Wcpp]
> > <stdin>:1241:2: warning: #warning syscall getrandom not implemented [-Wcpp]
> > <stdin>:1244:2: warning: #warning syscall memfd_create not implemented [-Wcpp]
> > <stdin>:1247:2: warning: #warning syscall bpf not implemented [-Wcpp]
> > <stdin>:1250:2: warning: #warning syscall execveat not implemented [-Wcpp]
>
> Chen: Have you tested the syscalls you have wired up?
>
> I have a suspicion that more is required to wire up the seccomp
> syscall.

likewise sys_bpf judging by the absence of bpf_int_jit_compile and friends in arch/alpha
The weak symbols mean it probably compiles/links, but it doesn't actually do
anything, and now instead of -ENOSYS, anyone trying to actually use that syscall
on alpha will get weird results.

Shutting up warnings like this strikes me as the wrong thing to do.

Dave

2015-05-12 17:36:29

by Matt Turner

[permalink] [raw]
Subject: Re: [PATCH] alpha: Wire up missing syscalls

On Tue, May 12, 2015 at 1:59 AM, Michael Cree <[email protected]> wrote:
> On Sun, May 10, 2015 at 02:33:36AM +0800, Chen Gang wrote:
>> The related warnings:
>>
>> CALL scripts/checksyscalls.sh
>> <stdin>:1238:2: warning: #warning syscall seccomp not implemented [-Wcpp]
>> <stdin>:1241:2: warning: #warning syscall getrandom not implemented [-Wcpp]
>> <stdin>:1244:2: warning: #warning syscall memfd_create not implemented [-Wcpp]
>> <stdin>:1247:2: warning: #warning syscall bpf not implemented [-Wcpp]
>> <stdin>:1250:2: warning: #warning syscall execveat not implemented [-Wcpp]
>
> Chen: Have you tested the syscalls you have wired up?
>
> I have a suspicion that more is required to wire up the seccomp
> syscall. At least some of the other older architectures had to
> implement some extra arch dependent support to implement the seccomp
> syscall. I don't know whether this is necessary or not on Alpha so
> was wondering if this has been considered?
>
> Matt: are you still feeding Alpha patches to Linus? I suspect there
> might be a few other patches other than this one submitted to
> linux-alpha that should be applied.

I haven't been for a while, but I do want to get back to it. I have a
bunch of patches marked that I need to collect.

2015-05-13 00:56:08

by Chen Gang

[permalink] [raw]
Subject: Re: [PATCH] alpha: Wire up missing syscalls

On 05/12/2015 10:29 PM, Dave Jones wrote:
> On Tue, May 12, 2015 at 08:59:52PM +1200, Michael Cree wrote:
> > On Sun, May 10, 2015 at 02:33:36AM +0800, Chen Gang wrote:
> > > The related warnings:
> > >
> > > CALL scripts/checksyscalls.sh
> > > <stdin>:1238:2: warning: #warning syscall seccomp not implemented [-Wcpp]
> > > <stdin>:1241:2: warning: #warning syscall getrandom not implemented [-Wcpp]
> > > <stdin>:1244:2: warning: #warning syscall memfd_create not implemented [-Wcpp]
> > > <stdin>:1247:2: warning: #warning syscall bpf not implemented [-Wcpp]
> > > <stdin>:1250:2: warning: #warning syscall execveat not implemented [-Wcpp]
> >
> > Chen: Have you tested the syscalls you have wired up?
> >
> > I have a suspicion that more is required to wire up the seccomp
> > syscall.
>
> likewise sys_bpf judging by the absence of bpf_int_jit_compile and friends in arch/alpha
> The weak symbols mean it probably compiles/links, but it doesn't actually do
> anything, and now instead of -ENOSYS, anyone trying to actually use that syscall
> on alpha will get weird results.
>
> Shutting up warnings like this strikes me as the wrong thing to do.
>

It sounds reasonable. For me, we need to wire up implemented syscalls,
and still left the unimplemented syscalls as building warnings.

If no any additional reply, I shall try to send patch v2 for it within
this week (2015-05-17).


Thanks.
--
Chen Gang

Open, share, and attitude like air, water, and life which God blessed

2015-05-18 04:44:38

by Chen Gang

[permalink] [raw]
Subject: Re: [PATCH] alpha: Wire up missing syscalls

On 05/13/2015 08:55 AM, Chen Gang wrote:
> On 05/12/2015 10:29 PM, Dave Jones wrote:
>> likewise sys_bpf judging by the absence of bpf_int_jit_compile and friends in arch/alpha
>> The weak symbols mean it probably compiles/links, but it doesn't actually do
>> anything, and now instead of -ENOSYS, anyone trying to actually use that syscall
>> on alpha will get weird results.
>>
>> Shutting up warnings like this strikes me as the wrong thing to do.
>>
>
> It sounds reasonable. For me, we need to wire up implemented syscalls,
> and still left the unimplemented syscalls as building warnings.
>
> If no any additional reply, I shall try to send patch v2 for it within
> this week (2015-05-17).
>

Sorry for sending patch v2 late (I sent it today just now).

The reason is I could not login to hotmail and gmail server at home
during the last week end (although the network is OK for other website).


Thanks.
--
Chen Gang

Open, share, and attitude like air, water, and life which God blessed