2018-03-14 09:43:04

by Tautschnig, Michael

[permalink] [raw]
Subject: [PATCH] x86/sigreturn: use SYSCALL_DEFINE0

All definitions of syscalls in x86 except for those patched here have
already been using the appropriate SYSCALL_DEFINE*.

Signed-off-by: Michael Tautschnig <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Jaswinder Singh <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Dominik Brodowski <[email protected]>
---
arch/x86/kernel/signal.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
index b9e00e8..40ba242 100644
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -25,6 +25,7 @@
#include <linux/user-return-notifier.h>
#include <linux/uprobes.h>
#include <linux/context_tracking.h>
+#include <linux/syscalls.h>

#include <asm/processor.h>
#include <asm/ucontext.h>
@@ -601,7 +602,7 @@ static int x32_setup_rt_frame(struct ksignal *ksig,
* Do a signal return; undo the signal stack.
*/
#ifdef CONFIG_X86_32
-asmlinkage unsigned long sys_sigreturn(void)
+SYSCALL_DEFINE0(sigreturn)
{
struct pt_regs *regs = current_pt_regs();
struct sigframe __user *frame;
@@ -633,7 +634,7 @@ asmlinkage unsigned long sys_sigreturn(void)
}
#endif /* CONFIG_X86_32 */

-asmlinkage long sys_rt_sigreturn(void)
+SYSCALL_DEFINE0(rt_sigreturn)
{
struct pt_regs *regs = current_pt_regs();
struct rt_sigframe __user *frame;
--
2.7.3.AMZN



Amazon Web Services UK Limited. Registered in England and Wales with registration number 08650665 with its registered office at 1 Principal Place, Worship Street, London, EC2A 2FA, United Kingdom.





2018-03-14 20:05:38

by Thomas Gleixner

[permalink] [raw]
Subject: Re: [PATCH] x86/sigreturn: use SYSCALL_DEFINE0

On Wed, 14 Mar 2018, Tautschnig, Michael wrote:

> All definitions of syscalls in x86 except for those patched here have
> already been using the appropriate SYSCALL_DEFINE*.

Dominik, do you have more urgent stuff queued in that area?

If yes, please add: Reviewed-by: Thomas Gleixner <[email protected]>

If not, I simply route it through x86/urgent for 4.16.

Thanks,

tglx

2018-03-14 20:42:58

by Dominik Brodowski

[permalink] [raw]
Subject: Re: [PATCH] x86/sigreturn: use SYSCALL_DEFINE0

On Wed, Mar 14, 2018 at 09:04:13PM +0100, Thomas Gleixner wrote:
> On Wed, 14 Mar 2018, Tautschnig, Michael wrote:
>
> > All definitions of syscalls in x86 except for those patched here have
> > already been using the appropriate SYSCALL_DEFINE*.
>
> Dominik, do you have more urgent stuff queued in that area?
>
> If yes, please add: Reviewed-by: Thomas Gleixner <[email protected]>
>
> If not, I simply route it through x86/urgent for 4.16.

Thanks for asking! Nothing urgent from my side, only stuff for 4.17, so it
would be great if you could route it through x86/urgent.

Thanks,
Dominik

Subject: [tip:x86/urgent] x86/sigreturn: Use SYSCALL_DEFINE0

Commit-ID: 1227b344de283f96c41de02cde4b26d5290f5302
Gitweb: https://git.kernel.org/tip/1227b344de283f96c41de02cde4b26d5290f5302
Author: Tautschnig, Michael <[email protected]>
AuthorDate: Wed, 14 Mar 2018 09:41:42 +0000
Committer: Thomas Gleixner <[email protected]>
CommitDate: Wed, 14 Mar 2018 21:43:09 +0100

x86/sigreturn: Use SYSCALL_DEFINE0

All definitions of syscalls in x86 except for those patched here have
already been using the appropriate SYSCALL_DEFINE*.

Signed-off-by: Michael Tautschnig <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: [email protected]
Cc: Dominik Brodowski <[email protected]>
Cc: Jaswinder Singh <[email protected]>
Cc: "[email protected]"
Cc: "[email protected]"
Link: https://lkml.kernel.org/r/[email protected]

---
arch/x86/kernel/signal.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
index 4cdc0b27ec82..da270b95fe4d 100644
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -25,6 +25,7 @@
#include <linux/user-return-notifier.h>
#include <linux/uprobes.h>
#include <linux/context_tracking.h>
+#include <linux/syscalls.h>

#include <asm/processor.h>
#include <asm/ucontext.h>
@@ -601,7 +602,7 @@ static int x32_setup_rt_frame(struct ksignal *ksig,
* Do a signal return; undo the signal stack.
*/
#ifdef CONFIG_X86_32
-asmlinkage unsigned long sys_sigreturn(void)
+SYSCALL_DEFINE0(sigreturn)
{
struct pt_regs *regs = current_pt_regs();
struct sigframe __user *frame;
@@ -633,7 +634,7 @@ badframe:
}
#endif /* CONFIG_X86_32 */

-asmlinkage long sys_rt_sigreturn(void)
+SYSCALL_DEFINE0(rt_sigreturn)
{
struct pt_regs *regs = current_pt_regs();
struct rt_sigframe __user *frame;

2018-03-19 22:31:12

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] x86/sigreturn: use SYSCALL_DEFINE0

Hi Michael,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on v4.16-rc4]
[also build test ERROR on next-20180319]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Tautschnig-Michael/x86-sigreturn-use-SYSCALL_DEFINE0/20180316-110516
config: i386-allyesconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

All errors (new ones prefixed by >>):

>> arch/x86//kernel/signal.c:605:1691: error: conflicting types for 'sys_sigreturn'
SYSCALL_DEFINE0(sigreturn)
^
In file included from arch/x86//kernel/signal.c:45:0:
arch/x86/include/asm/syscalls.h:37:44: note: previous declaration of 'sys_sigreturn' was here
asmlinkage unsigned long sys_sigreturn(void);
^~

vim +/sys_sigreturn +605 arch/x86//kernel/signal.c

600
601 /*
602 * Do a signal return; undo the signal stack.
603 */
604 #ifdef CONFIG_X86_32
> 605 SYSCALL_DEFINE0(sigreturn)
606 {
607 struct pt_regs *regs = current_pt_regs();
608 struct sigframe __user *frame;
609 sigset_t set;
610
611 frame = (struct sigframe __user *)(regs->sp - 8);
612
613 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
614 goto badframe;
615 if (__get_user(set.sig[0], &frame->sc.oldmask) || (_NSIG_WORDS > 1
616 && __copy_from_user(&set.sig[1], &frame->extramask,
617 sizeof(frame->extramask))))
618 goto badframe;
619
620 set_current_blocked(&set);
621
622 /*
623 * x86_32 has no uc_flags bits relevant to restore_sigcontext.
624 * Save a few cycles by skipping the __get_user.
625 */
626 if (restore_sigcontext(regs, &frame->sc, 0))
627 goto badframe;
628 return regs->ax;
629
630 badframe:
631 signal_fault(regs, frame, "sigreturn");
632
633 return 0;
634 }
635 #endif /* CONFIG_X86_32 */
636

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation


Attachments:
(No filename) (3.93 kB)
.config.gz (60.92 kB)
Download all attachments

2018-03-20 01:50:20

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] x86/sigreturn: use SYSCALL_DEFINE0

Hi Michael,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on v4.16-rc4]
[also build test ERROR on next-20180319]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Tautschnig-Michael/x86-sigreturn-use-SYSCALL_DEFINE0/20180316-110516
config: i386-randconfig-c0-03200324 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

All errors (new ones prefixed by >>):

In file included from arch/x86/kernel/signal.c:28:0:
>> include/linux/syscalls.h:194:18: error: conflicting types for 'sys_sigreturn'
asmlinkage long sys_##sname(void)
^
arch/x86/kernel/signal.c:605:1: note: in expansion of macro 'SYSCALL_DEFINE0'
SYSCALL_DEFINE0(sigreturn)
^~~~~~~~~~~~~~~
In file included from arch/x86/kernel/signal.c:45:0:
arch/x86/include/asm/syscalls.h:37:26: note: previous declaration of 'sys_sigreturn' was here
asmlinkage unsigned long sys_sigreturn(void);
^~~~~~~~~~~~~
--
In file included from arch/x86//kernel/signal.c:28:0:
>> include/linux/syscalls.h:194:18: error: conflicting types for 'sys_sigreturn'
asmlinkage long sys_##sname(void)
^
arch/x86//kernel/signal.c:605:1: note: in expansion of macro 'SYSCALL_DEFINE0'
SYSCALL_DEFINE0(sigreturn)
^~~~~~~~~~~~~~~
In file included from arch/x86//kernel/signal.c:45:0:
arch/x86/include/asm/syscalls.h:37:26: note: previous declaration of 'sys_sigreturn' was here
asmlinkage unsigned long sys_sigreturn(void);
^~~~~~~~~~~~~

vim +/sys_sigreturn +194 include/linux/syscalls.h

bed1ffca Frederic Weisbecker 2009-03-13 191
bed1ffca Frederic Weisbecker 2009-03-13 192 #define SYSCALL_DEFINE0(sname) \
99e621f7 Al Viro 2013-03-05 193 SYSCALL_METADATA(_##sname, 0); \
bed1ffca Frederic Weisbecker 2009-03-13 @194 asmlinkage long sys_##sname(void)
bed1ffca Frederic Weisbecker 2009-03-13 195

:::::: The code at line 194 was first introduced by commit
:::::: bed1ffca022cc876fb83161d26670e9b5d3cf36b tracing/syscalls: core infrastructure for syscalls tracing, enhancements

:::::: TO: Frederic Weisbecker <[email protected]>
:::::: CC: Ingo Molnar <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation


Attachments:
(No filename) (2.57 kB)
.config.gz (28.07 kB)
Download all attachments