linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [tip:x86/asm] x86/asm/entry: Rename compat syscall entry points
       [not found] <tip-2cd23553b488589f287457b7396470f5e3c40698@git.kernel.org>
@ 2015-06-08 13:46 ` Brian Gerst
  2015-06-08 19:25   ` [PATCH] x86/asm/entry: (Re-)rename __NR_entry_INT80_compat_max to __NR_syscall_compat_max Ingo Molnar
  0 siblings, 1 reply; 4+ messages in thread
From: Brian Gerst @ 2015-06-08 13:46 UTC (permalink / raw)
  To: H. Peter Anvin, Linux Kernel Mailing List, Denys Vlasenko,
	Peter Zijlstra, Borislav Petkov, Andy Lutomirski, Brian Gerst,
	Linus Torvalds, Ingo Molnar, Thomas Gleixner
  Cc: linux-tip-commits

> diff --git a/arch/x86/entry/syscall_32.c b/arch/x86/entry/syscall_32.c
> index 3777189..e398d03 100644
> --- a/arch/x86/entry/syscall_32.c
> +++ b/arch/x86/entry/syscall_32.c
> @@ -10,7 +10,7 @@
>  #else
>  #define SYM(sym, compat) sym
>  #define ia32_sys_call_table sys_call_table
> -#define __NR_ia32_syscall_max __NR_syscall_max
> +#define __NR_entry_INT80_compat_max __NR_syscall_max
>  #endif

This change doesn't look intended.  __NR_ia32_syscall_max is used by
all compat entry points, not just INT80,

--
Brian Gerst

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

* [PATCH] x86/asm/entry: (Re-)rename __NR_entry_INT80_compat_max to __NR_syscall_compat_max
  2015-06-08 13:46 ` [tip:x86/asm] x86/asm/entry: Rename compat syscall entry points Brian Gerst
@ 2015-06-08 19:25   ` Ingo Molnar
  2015-06-08 21:18     ` Brian Gerst
  0 siblings, 1 reply; 4+ messages in thread
From: Ingo Molnar @ 2015-06-08 19:25 UTC (permalink / raw)
  To: Brian Gerst
  Cc: H. Peter Anvin, Linux Kernel Mailing List, Denys Vlasenko,
	Peter Zijlstra, Borislav Petkov, Andy Lutomirski, Linus Torvalds,
	Thomas Gleixner, linux-tip-commits


* Brian Gerst <brgerst@gmail.com> wrote:

> > diff --git a/arch/x86/entry/syscall_32.c b/arch/x86/entry/syscall_32.c
> > index 3777189..e398d03 100644
> > --- a/arch/x86/entry/syscall_32.c
> > +++ b/arch/x86/entry/syscall_32.c
> > @@ -10,7 +10,7 @@
> >  #else
> >  #define SYM(sym, compat) sym
> >  #define ia32_sys_call_table sys_call_table
> > -#define __NR_ia32_syscall_max __NR_syscall_max
> > +#define __NR_entry_INT80_compat_max __NR_syscall_max
> >  #endif
> 
> This change doesn't look intended.  __NR_ia32_syscall_max is used by
> all compat entry points, not just INT80,

Indeed!

How about the patch below?

Thanks,

	Ingo

================>
>From 42b9d9a463bfb7252ede4eac24e50a4f013c6717 Mon Sep 17 00:00:00 2001
From: Ingo Molnar <mingo@kernel.org>
Date: Mon, 8 Jun 2015 21:20:26 +0200
Subject: [PATCH] x86/asm/entry: (Re-)rename __NR_entry_INT80_compat_max to __NR_syscall_compat_max

Brian Gerst noticed that I did a weird rename in the following commit:

   b2502b418e63 ("x86/asm/entry: Untangle 'system_call' into two entry points: entry_SYSCALL_64 and entry_INT80_32")

which renamed __NR_ia32_syscall_max to __NR_entry_INT80_compat_max.

Now the original name was a misnomer, but the new one is a misnomer as well,
as all compat syscall ABIs (such as x32) share the system call table, not just
INT80 based ones.

Rename it to __NR_syscall_compat_max.

Reported-by: Brian Gerst <brgerst@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/entry/syscall_32.c      | 6 +++---
 arch/x86/kernel/asm-offsets_64.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/entry/syscall_32.c b/arch/x86/entry/syscall_32.c
index e398d033673f..8ea34f94e973 100644
--- a/arch/x86/entry/syscall_32.c
+++ b/arch/x86/entry/syscall_32.c
@@ -10,7 +10,7 @@
 #else
 #define SYM(sym, compat) sym
 #define ia32_sys_call_table sys_call_table
-#define __NR_entry_INT80_compat_max __NR_syscall_max
+#define __NR_syscall_compat_max __NR_syscall_max
 #endif
 
 #define __SYSCALL_I386(nr, sym, compat) extern asmlinkage void SYM(sym, compat)(void) ;
@@ -23,11 +23,11 @@ typedef asmlinkage void (*sys_call_ptr_t)(void);
 
 extern asmlinkage void sys_ni_syscall(void);
 
-__visible const sys_call_ptr_t ia32_sys_call_table[__NR_entry_INT80_compat_max+1] = {
+__visible const sys_call_ptr_t ia32_sys_call_table[__NR_syscall_compat_max+1] = {
 	/*
 	 * Smells like a compiler bug -- it doesn't work
 	 * when the & below is removed.
 	 */
-	[0 ... __NR_entry_INT80_compat_max] = &sys_ni_syscall,
+	[0 ... __NR_syscall_compat_max] = &sys_ni_syscall,
 #include <asm/syscalls_32.h>
 };
diff --git a/arch/x86/kernel/asm-offsets_64.c b/arch/x86/kernel/asm-offsets_64.c
index 599afcf0005f..d8f42f902a0f 100644
--- a/arch/x86/kernel/asm-offsets_64.c
+++ b/arch/x86/kernel/asm-offsets_64.c
@@ -66,7 +66,7 @@ int main(void)
 	DEFINE(__NR_syscall_max, sizeof(syscalls_64) - 1);
 	DEFINE(NR_syscalls, sizeof(syscalls_64));
 
-	DEFINE(__NR_entry_INT80_compat_max, sizeof(syscalls_ia32) - 1);
+	DEFINE(__NR_syscall_compat_max, sizeof(syscalls_ia32) - 1);
 	DEFINE(IA32_NR_syscalls, sizeof(syscalls_ia32));
 
 	return 0;

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

* Re: [PATCH] x86/asm/entry: (Re-)rename __NR_entry_INT80_compat_max to __NR_syscall_compat_max
  2015-06-08 19:25   ` [PATCH] x86/asm/entry: (Re-)rename __NR_entry_INT80_compat_max to __NR_syscall_compat_max Ingo Molnar
@ 2015-06-08 21:18     ` Brian Gerst
  2015-06-08 21:45       ` Ingo Molnar
  0 siblings, 1 reply; 4+ messages in thread
From: Brian Gerst @ 2015-06-08 21:18 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: H. Peter Anvin, Linux Kernel Mailing List, Denys Vlasenko,
	Peter Zijlstra, Borislav Petkov, Andy Lutomirski, Linus Torvalds,
	Thomas Gleixner, linux-tip-commits

On Mon, Jun 8, 2015 at 3:25 PM, Ingo Molnar <mingo@kernel.org> wrote:
>
> * Brian Gerst <brgerst@gmail.com> wrote:
>
>> > diff --git a/arch/x86/entry/syscall_32.c b/arch/x86/entry/syscall_32.c
>> > index 3777189..e398d03 100644
>> > --- a/arch/x86/entry/syscall_32.c
>> > +++ b/arch/x86/entry/syscall_32.c
>> > @@ -10,7 +10,7 @@
>> >  #else
>> >  #define SYM(sym, compat) sym
>> >  #define ia32_sys_call_table sys_call_table
>> > -#define __NR_ia32_syscall_max __NR_syscall_max
>> > +#define __NR_entry_INT80_compat_max __NR_syscall_max
>> >  #endif
>>
>> This change doesn't look intended.  __NR_ia32_syscall_max is used by
>> all compat entry points, not just INT80,
>
> Indeed!
>
> How about the patch below?
>
> Thanks,
>
>         Ingo
>
> ================>
> From 42b9d9a463bfb7252ede4eac24e50a4f013c6717 Mon Sep 17 00:00:00 2001
> From: Ingo Molnar <mingo@kernel.org>
> Date: Mon, 8 Jun 2015 21:20:26 +0200
> Subject: [PATCH] x86/asm/entry: (Re-)rename __NR_entry_INT80_compat_max to __NR_syscall_compat_max
>
> Brian Gerst noticed that I did a weird rename in the following commit:
>
>    b2502b418e63 ("x86/asm/entry: Untangle 'system_call' into two entry points: entry_SYSCALL_64 and entry_INT80_32")
>
> which renamed __NR_ia32_syscall_max to __NR_entry_INT80_compat_max.
>
> Now the original name was a misnomer, but the new one is a misnomer as well,
> as all compat syscall ABIs (such as x32) share the system call table, not just
> INT80 based ones.

Not quite true.  X32 is really an extension of the 64-bit ABI to
support the ILP32 data model.  It uses the 64-bit SYSCALL entry point
and table, but with different syscall numbers for the syscalls that
need 32-bit pointer handling in data structures.

So, __NR_syscall_compat_max is only for the 32-bit ABI compat syscall
entries (int80, sysenter, and syscall from 32-bit mode), and not X32.

--
Brian Gerst

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

* Re: [PATCH] x86/asm/entry: (Re-)rename __NR_entry_INT80_compat_max to __NR_syscall_compat_max
  2015-06-08 21:18     ` Brian Gerst
@ 2015-06-08 21:45       ` Ingo Molnar
  0 siblings, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2015-06-08 21:45 UTC (permalink / raw)
  To: Brian Gerst
  Cc: H. Peter Anvin, Linux Kernel Mailing List, Denys Vlasenko,
	Peter Zijlstra, Borislav Petkov, Andy Lutomirski, Linus Torvalds,
	Thomas Gleixner, linux-tip-commits


* Brian Gerst <brgerst@gmail.com> wrote:

> On Mon, Jun 8, 2015 at 3:25 PM, Ingo Molnar <mingo@kernel.org> wrote:
> >
> > * Brian Gerst <brgerst@gmail.com> wrote:
> >
> >> > diff --git a/arch/x86/entry/syscall_32.c b/arch/x86/entry/syscall_32.c
> >> > index 3777189..e398d03 100644
> >> > --- a/arch/x86/entry/syscall_32.c
> >> > +++ b/arch/x86/entry/syscall_32.c
> >> > @@ -10,7 +10,7 @@
> >> >  #else
> >> >  #define SYM(sym, compat) sym
> >> >  #define ia32_sys_call_table sys_call_table
> >> > -#define __NR_ia32_syscall_max __NR_syscall_max
> >> > +#define __NR_entry_INT80_compat_max __NR_syscall_max
> >> >  #endif
> >>
> >> This change doesn't look intended.  __NR_ia32_syscall_max is used by
> >> all compat entry points, not just INT80,
> >
> > Indeed!
> >
> > How about the patch below?
> >
> > Thanks,
> >
> >         Ingo
> >
> > ================>
> > From 42b9d9a463bfb7252ede4eac24e50a4f013c6717 Mon Sep 17 00:00:00 2001
> > From: Ingo Molnar <mingo@kernel.org>
> > Date: Mon, 8 Jun 2015 21:20:26 +0200
> > Subject: [PATCH] x86/asm/entry: (Re-)rename __NR_entry_INT80_compat_max to __NR_syscall_compat_max
> >
> > Brian Gerst noticed that I did a weird rename in the following commit:
> >
> >    b2502b418e63 ("x86/asm/entry: Untangle 'system_call' into two entry points: entry_SYSCALL_64 and entry_INT80_32")
> >
> > which renamed __NR_ia32_syscall_max to __NR_entry_INT80_compat_max.
> >
> > Now the original name was a misnomer, but the new one is a misnomer as well,
> > as all compat syscall ABIs (such as x32) share the system call table, not just
> > INT80 based ones.
> 
> Not quite true.  X32 is really an extension of the 64-bit ABI to support the 
> ILP32 data model.  It uses the 64-bit SYSCALL entry point and table, but with 
> different syscall numbers for the syscalls that need 32-bit pointer handling in 
> data structures.
> 
> So, __NR_syscall_compat_max is only for the 32-bit ABI compat syscall entries 
> (int80, sysenter, and syscall from 32-bit mode), and not X32.

Indeed, and I knew this...

Fixed the brainfart in the changelog.

Thanks,

	Ingo

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

end of thread, other threads:[~2015-06-08 21:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <tip-2cd23553b488589f287457b7396470f5e3c40698@git.kernel.org>
2015-06-08 13:46 ` [tip:x86/asm] x86/asm/entry: Rename compat syscall entry points Brian Gerst
2015-06-08 19:25   ` [PATCH] x86/asm/entry: (Re-)rename __NR_entry_INT80_compat_max to __NR_syscall_compat_max Ingo Molnar
2015-06-08 21:18     ` Brian Gerst
2015-06-08 21:45       ` Ingo Molnar

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).