Re: [PATCH] x86: always use SYSCALL_DEFINE*

2018-03-14 Thread Tautschnig, Michael
Hi Dominik,

> On 14 Mar 2018, at 05:48, Dominik Brodowski  
> wrote:
> [...]
> ... the ioperm change is already in mainline (did an equivalent change a
> couple of days ago), but the sigreturn/rt_sigreturn changes still seem
> useful. Could you send a fresh patch with just these two changes; and -- if
> the x86 maintainers agree -- I will push it with my syscall-related changes?

Thanks for all this cleanup work. I have posted the {rt_,}sigreturn changes as
"[PATCH] x86/sigreturn: use SYSCALL_DEFINE0".

Best,
Michael






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.





Re: [PATCH] x86: always use SYSCALL_DEFINE*

2018-03-14 Thread Tautschnig, Michael
Hi Dominik,

> On 14 Mar 2018, at 05:48, Dominik Brodowski  
> wrote:
> [...]
> ... the ioperm change is already in mainline (did an equivalent change a
> couple of days ago), but the sigreturn/rt_sigreturn changes still seem
> useful. Could you send a fresh patch with just these two changes; and -- if
> the x86 maintainers agree -- I will push it with my syscall-related changes?

Thanks for all this cleanup work. I have posted the {rt_,}sigreturn changes as
"[PATCH] x86/sigreturn: use SYSCALL_DEFINE0".

Best,
Michael






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.





Re: [PATCH] x86: always use SYSCALL_DEFINE*

2018-03-13 Thread Dominik Brodowski
Michael,

On Tue, Mar 13, 2018 at 11:18:08PM +, Andy Lutomirski wrote:
> On Tue, Mar 13, 2018 at 9:16 PM, Jann Horn  wrote:
> > On Sat, Mar 10, 2018 at 12:55 PM, Tautschnig, Michael
> >  wrote:
> >> All syscall arguments are passed in as types of the same byte size as
> >> unsigned long (width of full registers). Using a smaller type without a
> >> cast may result in losing bits of information. SYSCALL_DEFINE* introduce
> >> adequate type casts. All definitions of syscalls in x86 except for those
> >> patched here have already been using the appropriate SYSCALL_DEFINE*.
> > [...]
> >> diff --git a/arch/x86/kernel/ioport.c b/arch/x86/kernel/ioport.c
> >> index 2f72330..d98b2a3 100644
> >> --- a/arch/x86/kernel/ioport.c
> >> +++ b/arch/x86/kernel/ioport.c
> >> @@ -23,7 +23,8 @@
> >>  /*
> >>   * this changes the io permissions bitmap in the current task.
> >>   */
> >> -asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int 
> >> turn_on)
> >> +SYSCALL_DEFINE3(sys_ioperm, unsigned long, from, unsigned long, num, int,
> >> +   turn_on)
> >
> > Shouldn't this be "SYSCALL_DEFINE3(ioperm, [...]", without the "sys_"?
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-api" in
> > the body of a message to majord...@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> I think this patch will be obsoleted by a series of patches from Dominik.

... the ioperm change is already in mainline (did an equivalent change a
couple of days ago), but the sigreturn/rt_sigreturn changes still seem
useful. Could you send a fresh patch with just these two changes; and -- if
the x86 maintainers agree -- I will push it with my syscall-related changes?

Thanks,
Dominik


Re: [PATCH] x86: always use SYSCALL_DEFINE*

2018-03-13 Thread Dominik Brodowski
Michael,

On Tue, Mar 13, 2018 at 11:18:08PM +, Andy Lutomirski wrote:
> On Tue, Mar 13, 2018 at 9:16 PM, Jann Horn  wrote:
> > On Sat, Mar 10, 2018 at 12:55 PM, Tautschnig, Michael
> >  wrote:
> >> All syscall arguments are passed in as types of the same byte size as
> >> unsigned long (width of full registers). Using a smaller type without a
> >> cast may result in losing bits of information. SYSCALL_DEFINE* introduce
> >> adequate type casts. All definitions of syscalls in x86 except for those
> >> patched here have already been using the appropriate SYSCALL_DEFINE*.
> > [...]
> >> diff --git a/arch/x86/kernel/ioport.c b/arch/x86/kernel/ioport.c
> >> index 2f72330..d98b2a3 100644
> >> --- a/arch/x86/kernel/ioport.c
> >> +++ b/arch/x86/kernel/ioport.c
> >> @@ -23,7 +23,8 @@
> >>  /*
> >>   * this changes the io permissions bitmap in the current task.
> >>   */
> >> -asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int 
> >> turn_on)
> >> +SYSCALL_DEFINE3(sys_ioperm, unsigned long, from, unsigned long, num, int,
> >> +   turn_on)
> >
> > Shouldn't this be "SYSCALL_DEFINE3(ioperm, [...]", without the "sys_"?
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-api" in
> > the body of a message to majord...@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> I think this patch will be obsoleted by a series of patches from Dominik.

... the ioperm change is already in mainline (did an equivalent change a
couple of days ago), but the sigreturn/rt_sigreturn changes still seem
useful. Could you send a fresh patch with just these two changes; and -- if
the x86 maintainers agree -- I will push it with my syscall-related changes?

Thanks,
Dominik


Re: [PATCH] x86: always use SYSCALL_DEFINE*

2018-03-13 Thread Andy Lutomirski
On Tue, Mar 13, 2018 at 9:16 PM, Jann Horn  wrote:
> On Sat, Mar 10, 2018 at 12:55 PM, Tautschnig, Michael
>  wrote:
>> All syscall arguments are passed in as types of the same byte size as
>> unsigned long (width of full registers). Using a smaller type without a
>> cast may result in losing bits of information. SYSCALL_DEFINE* introduce
>> adequate type casts. All definitions of syscalls in x86 except for those
>> patched here have already been using the appropriate SYSCALL_DEFINE*.
> [...]
>> diff --git a/arch/x86/kernel/ioport.c b/arch/x86/kernel/ioport.c
>> index 2f72330..d98b2a3 100644
>> --- a/arch/x86/kernel/ioport.c
>> +++ b/arch/x86/kernel/ioport.c
>> @@ -23,7 +23,8 @@
>>  /*
>>   * this changes the io permissions bitmap in the current task.
>>   */
>> -asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int 
>> turn_on)
>> +SYSCALL_DEFINE3(sys_ioperm, unsigned long, from, unsigned long, num, int,
>> +   turn_on)
>
> Shouldn't this be "SYSCALL_DEFINE3(ioperm, [...]", without the "sys_"?
> --
> To unsubscribe from this list: send the line "unsubscribe linux-api" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

I think this patch will be obsoleted by a series of patches from Dominik.


Re: [PATCH] x86: always use SYSCALL_DEFINE*

2018-03-13 Thread Andy Lutomirski
On Tue, Mar 13, 2018 at 9:16 PM, Jann Horn  wrote:
> On Sat, Mar 10, 2018 at 12:55 PM, Tautschnig, Michael
>  wrote:
>> All syscall arguments are passed in as types of the same byte size as
>> unsigned long (width of full registers). Using a smaller type without a
>> cast may result in losing bits of information. SYSCALL_DEFINE* introduce
>> adequate type casts. All definitions of syscalls in x86 except for those
>> patched here have already been using the appropriate SYSCALL_DEFINE*.
> [...]
>> diff --git a/arch/x86/kernel/ioport.c b/arch/x86/kernel/ioport.c
>> index 2f72330..d98b2a3 100644
>> --- a/arch/x86/kernel/ioport.c
>> +++ b/arch/x86/kernel/ioport.c
>> @@ -23,7 +23,8 @@
>>  /*
>>   * this changes the io permissions bitmap in the current task.
>>   */
>> -asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int 
>> turn_on)
>> +SYSCALL_DEFINE3(sys_ioperm, unsigned long, from, unsigned long, num, int,
>> +   turn_on)
>
> Shouldn't this be "SYSCALL_DEFINE3(ioperm, [...]", without the "sys_"?
> --
> To unsubscribe from this list: send the line "unsubscribe linux-api" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

I think this patch will be obsoleted by a series of patches from Dominik.


Re: [PATCH] x86: always use SYSCALL_DEFINE*

2018-03-13 Thread Jann Horn
On Sat, Mar 10, 2018 at 12:55 PM, Tautschnig, Michael
 wrote:
> All syscall arguments are passed in as types of the same byte size as
> unsigned long (width of full registers). Using a smaller type without a
> cast may result in losing bits of information. SYSCALL_DEFINE* introduce
> adequate type casts. All definitions of syscalls in x86 except for those
> patched here have already been using the appropriate SYSCALL_DEFINE*.
[...]
> diff --git a/arch/x86/kernel/ioport.c b/arch/x86/kernel/ioport.c
> index 2f72330..d98b2a3 100644
> --- a/arch/x86/kernel/ioport.c
> +++ b/arch/x86/kernel/ioport.c
> @@ -23,7 +23,8 @@
>  /*
>   * this changes the io permissions bitmap in the current task.
>   */
> -asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int 
> turn_on)
> +SYSCALL_DEFINE3(sys_ioperm, unsigned long, from, unsigned long, num, int,
> +   turn_on)

Shouldn't this be "SYSCALL_DEFINE3(ioperm, [...]", without the "sys_"?


Re: [PATCH] x86: always use SYSCALL_DEFINE*

2018-03-13 Thread Jann Horn
On Sat, Mar 10, 2018 at 12:55 PM, Tautschnig, Michael
 wrote:
> All syscall arguments are passed in as types of the same byte size as
> unsigned long (width of full registers). Using a smaller type without a
> cast may result in losing bits of information. SYSCALL_DEFINE* introduce
> adequate type casts. All definitions of syscalls in x86 except for those
> patched here have already been using the appropriate SYSCALL_DEFINE*.
[...]
> diff --git a/arch/x86/kernel/ioport.c b/arch/x86/kernel/ioport.c
> index 2f72330..d98b2a3 100644
> --- a/arch/x86/kernel/ioport.c
> +++ b/arch/x86/kernel/ioport.c
> @@ -23,7 +23,8 @@
>  /*
>   * this changes the io permissions bitmap in the current task.
>   */
> -asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int 
> turn_on)
> +SYSCALL_DEFINE3(sys_ioperm, unsigned long, from, unsigned long, num, int,
> +   turn_on)

Shouldn't this be "SYSCALL_DEFINE3(ioperm, [...]", without the "sys_"?


Re: [PATCH] x86: always use SYSCALL_DEFINE*

2018-03-10 Thread Tautschnig, Michael
On 10 Mar 2018, at 20:55, Tautschnig, Michael  wrote:
> 
> All syscall arguments are passed in as types of the same byte size as
> unsigned long (width of full registers). Using a smaller type without a
> cast may result in losing bits of information. SYSCALL_DEFINE* introduce
> adequate type casts. All definitions of syscalls in x86 except for those
> patched here have already been using the appropriate SYSCALL_DEFINE*.
[...]

Additional context: I had previously made an attempt to ensure type
consistency of sys_ioperm as "Syscall arguments are unsigned long (full
registers)" (https://lkml.org/lkml/2016/7/4/336). I hope the new proposal
is more acceptable.

Best,
Michael



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.





Re: [PATCH] x86: always use SYSCALL_DEFINE*

2018-03-10 Thread Tautschnig, Michael
On 10 Mar 2018, at 20:55, Tautschnig, Michael  wrote:
> 
> All syscall arguments are passed in as types of the same byte size as
> unsigned long (width of full registers). Using a smaller type without a
> cast may result in losing bits of information. SYSCALL_DEFINE* introduce
> adequate type casts. All definitions of syscalls in x86 except for those
> patched here have already been using the appropriate SYSCALL_DEFINE*.
[...]

Additional context: I had previously made an attempt to ensure type
consistency of sys_ioperm as "Syscall arguments are unsigned long (full
registers)" (https://lkml.org/lkml/2016/7/4/336). I hope the new proposal
is more acceptable.

Best,
Michael



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.





[PATCH] x86: always use SYSCALL_DEFINE*

2018-03-10 Thread Tautschnig, Michael
All syscall arguments are passed in as types of the same byte size as
unsigned long (width of full registers). Using a smaller type without a
cast may result in losing bits of information. SYSCALL_DEFINE* introduce
adequate type casts. All definitions of syscalls in x86 except for those
patched here have already been using the appropriate SYSCALL_DEFINE*.

Signed-off-by: Michael Tautschnig 
Cc: Thomas Gleixner 
Cc: Ingo Molnar 
Cc: H. Peter Anvin 
Cc: Jaswinder Singh 
Cc: Andi Kleen 
---
 arch/x86/kernel/ioport.c | 3 ++-
 arch/x86/kernel/signal.c | 5 +++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/ioport.c b/arch/x86/kernel/ioport.c
index 2f72330..d98b2a3 100644
--- a/arch/x86/kernel/ioport.c
+++ b/arch/x86/kernel/ioport.c
@@ -23,7 +23,8 @@
 /*
  * this changes the io permissions bitmap in the current task.
  */
-asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on)
+SYSCALL_DEFINE3(sys_ioperm, unsigned long, from, unsigned long, num, int,
+   turn_on)
 {
struct thread_struct *t = >thread;
struct tss_struct *tss;
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 
 #include 
 #include 
+#include 

 #include 
 #include 
@@ -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.





[PATCH] x86: always use SYSCALL_DEFINE*

2018-03-10 Thread Tautschnig, Michael
All syscall arguments are passed in as types of the same byte size as
unsigned long (width of full registers). Using a smaller type without a
cast may result in losing bits of information. SYSCALL_DEFINE* introduce
adequate type casts. All definitions of syscalls in x86 except for those
patched here have already been using the appropriate SYSCALL_DEFINE*.

Signed-off-by: Michael Tautschnig 
Cc: Thomas Gleixner 
Cc: Ingo Molnar 
Cc: H. Peter Anvin 
Cc: Jaswinder Singh 
Cc: Andi Kleen 
---
 arch/x86/kernel/ioport.c | 3 ++-
 arch/x86/kernel/signal.c | 5 +++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/ioport.c b/arch/x86/kernel/ioport.c
index 2f72330..d98b2a3 100644
--- a/arch/x86/kernel/ioport.c
+++ b/arch/x86/kernel/ioport.c
@@ -23,7 +23,8 @@
 /*
  * this changes the io permissions bitmap in the current task.
  */
-asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on)
+SYSCALL_DEFINE3(sys_ioperm, unsigned long, from, unsigned long, num, int,
+   turn_on)
 {
struct thread_struct *t = >thread;
struct tss_struct *tss;
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 
 #include 
 #include 
+#include 

 #include 
 #include 
@@ -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.