diff mbox

[v6,15/19] arm64: ilp32: force IPC_64 in msgctl, shmctl, semctl

Message ID 1447795019-30176-16-git-send-email-ynorov@caviumnetworks.com (mailing list archive)
State New, archived
Headers show

Commit Message

Yury Norov Nov. 17, 2015, 9:16 p.m. UTC
From: Jan Dakinevich <jan.dakinevich@gmail.com>

Reviewed-by: David Daney <ddaney@caviumnetworks.com>

Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
Signed-off-by: Jan Dakinevich <jan.dakinevich@gmail.com>
---
 arch/arm64/kernel/sys_ilp32.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

Comments

Arnd Bergmann Nov. 17, 2015, 10:07 p.m. UTC | #1
On Wednesday 18 November 2015 00:16:55 Yury Norov wrote:
> 
> +/* IPC_64 */
> +asmlinkage long ilp32_sys_msgctl(int first, int second, void __user *uptr)
> +{
> +       return compat_sys_msgctl(first, second | IPC_64, uptr);
> +}
> +#define compat_sys_msgctl              ilp32_sys_msgctl
> +
> +asmlinkage long ilp32_sys_shmctl(int first, int second, void __user *uptr)
> +{
> +       return compat_sys_shmctl(first, second | IPC_64, uptr);
> +}
> +#define compat_sys_shmctl              ilp32_sys_shmctl
> +
> +asmlinkage long ilp32_sys_semctl(int first, int second, int third, int arg)
> +{
> +       return compat_sys_semctl(first, second, third | IPC_64, arg);
> +}
> +#define compat_sys_semctl      ilp32_sys_semctl
> 

I wonder if this would be any simpler by changing compat_ipc_parse_version()

	Arnd
Andreas Schwab Nov. 18, 2015, 8:25 a.m. UTC | #2
Arnd Bergmann <arnd@arndb.de> writes:

> On Wednesday 18 November 2015 00:16:55 Yury Norov wrote:
>> 
>> +/* IPC_64 */
>> +asmlinkage long ilp32_sys_msgctl(int first, int second, void __user *uptr)
>> +{
>> +       return compat_sys_msgctl(first, second | IPC_64, uptr);
>> +}
>> +#define compat_sys_msgctl              ilp32_sys_msgctl
>> +
>> +asmlinkage long ilp32_sys_shmctl(int first, int second, void __user *uptr)
>> +{
>> +       return compat_sys_shmctl(first, second | IPC_64, uptr);
>> +}
>> +#define compat_sys_shmctl              ilp32_sys_shmctl
>> +
>> +asmlinkage long ilp32_sys_semctl(int first, int second, int third, int arg)
>> +{
>> +       return compat_sys_semctl(first, second, third | IPC_64, arg);
>> +}
>> +#define compat_sys_semctl      ilp32_sys_semctl
>> 
>
> I wonder if this would be any simpler by changing compat_ipc_parse_version()

This cries for a generic solution.  Other archs migrating to separate
ipc syscalls will want to avoid the whole IPC_64 business for them, even
if they need to retain [compat_]ipc_parse_version for sys_ipc
compatibility.

Andreas.
Arnd Bergmann Nov. 18, 2015, 9:23 a.m. UTC | #3
On Wednesday 18 November 2015 09:25:40 Andreas Schwab wrote:
> Arnd Bergmann <arnd@arndb.de> writes:
> 
> > On Wednesday 18 November 2015 00:16:55 Yury Norov wrote:
> >> 
> >> +/* IPC_64 */
> >> +asmlinkage long ilp32_sys_msgctl(int first, int second, void __user *uptr)
> >> +{
> >> +       return compat_sys_msgctl(first, second | IPC_64, uptr);
> >> +}
> >> +#define compat_sys_msgctl              ilp32_sys_msgctl
> >> +
> >> +asmlinkage long ilp32_sys_shmctl(int first, int second, void __user *uptr)
> >> +{
> >> +       return compat_sys_shmctl(first, second | IPC_64, uptr);
> >> +}
> >> +#define compat_sys_shmctl              ilp32_sys_shmctl
> >> +
> >> +asmlinkage long ilp32_sys_semctl(int first, int second, int third, int arg)
> >> +{
> >> +       return compat_sys_semctl(first, second, third | IPC_64, arg);
> >> +}
> >> +#define compat_sys_semctl      ilp32_sys_semctl
> >> 
> >
> > I wonder if this would be any simpler by changing compat_ipc_parse_version()
> 
> This cries for a generic solution.  Other archs migrating to separate
> ipc syscalls will want to avoid the whole IPC_64 business for them, even
> if they need to retain [compat_]ipc_parse_version for sys_ipc
> compatibility.

Agreed. I think all architectures are moving that way now, so we should
really try to get all cases right now.

I've done a complete list of what the architectures (see
https://docs.google.com/spreadsheets/d/18GxXEHE2ywnSr-SPoGFd1ABz6wEM1ex-JMu5lEraaH8/ )

We have these categories:

1. uses IPC_PARSE_VERSION with sys_ipc, and has just introduced
   separate syscalls:

    arm, avr32, powerpc, x86-32

2. uses IPC_PARSE_VERSION with sys_ipc, and has not yet introduced
   separate syscalls (currently producing a compile warning):

   cris, frv, m32r, m68k, mips (o32), mn10300, s390, sh32, sparc

3. uses IPC_PARSE_VERSION with separate syscalls:

   alpha, blackfin, microblaze, mips (n32/64), xtensa

4a. only new-style IPC with separate syscalls:

    ia64, parisc, sh64

4b. only new-style IPC with separate syscalls, using generic syscall
    table:

    arc, arm64, c6x, h8300, hexagon, metag, nios2, openrisc, score,
    tile, unicore32

So we should probably fix 1. and 2. before it's too late, but make
sure we don't break 3. in the process.

	Arnd
Geert Uytterhoeven Nov. 18, 2015, 10:07 a.m. UTC | #4
On Wed, Nov 18, 2015 at 10:23 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Wednesday 18 November 2015 09:25:40 Andreas Schwab wrote:
>> Arnd Bergmann <arnd@arndb.de> writes:
>>
>> > On Wednesday 18 November 2015 00:16:55 Yury Norov wrote:
>> >>
>> >> +/* IPC_64 */
>> >> +asmlinkage long ilp32_sys_msgctl(int first, int second, void __user *uptr)
>> >> +{
>> >> +       return compat_sys_msgctl(first, second | IPC_64, uptr);
>> >> +}
>> >> +#define compat_sys_msgctl              ilp32_sys_msgctl
>> >> +
>> >> +asmlinkage long ilp32_sys_shmctl(int first, int second, void __user *uptr)
>> >> +{
>> >> +       return compat_sys_shmctl(first, second | IPC_64, uptr);
>> >> +}
>> >> +#define compat_sys_shmctl              ilp32_sys_shmctl
>> >> +
>> >> +asmlinkage long ilp32_sys_semctl(int first, int second, int third, int arg)
>> >> +{
>> >> +       return compat_sys_semctl(first, second, third | IPC_64, arg);
>> >> +}
>> >> +#define compat_sys_semctl      ilp32_sys_semctl
>> >>
>> >
>> > I wonder if this would be any simpler by changing compat_ipc_parse_version()
>>
>> This cries for a generic solution.  Other archs migrating to separate
>> ipc syscalls will want to avoid the whole IPC_64 business for them, even
>> if they need to retain [compat_]ipc_parse_version for sys_ipc
>> compatibility.
>
> Agreed. I think all architectures are moving that way now, so we should
> really try to get all cases right now.
>
> I've done a complete list of what the architectures (see
> https://docs.google.com/spreadsheets/d/18GxXEHE2ywnSr-SPoGFd1ABz6wEM1ex-JMu5lEraaH8/ )
>
> We have these categories:
>
> 1. uses IPC_PARSE_VERSION with sys_ipc, and has just introduced
>    separate syscalls:
>
>     arm, avr32, powerpc, x86-32

x86-32, where?

> 2. uses IPC_PARSE_VERSION with sys_ipc, and has not yet introduced
>    separate syscalls (currently producing a compile warning):
>
>    cris, frv, m32r, m68k, mips (o32), mn10300, s390, sh32, sparc
>
> 3. uses IPC_PARSE_VERSION with separate syscalls:
>
>    alpha, blackfin, microblaze, mips (n32/64), xtensa
>
> 4a. only new-style IPC with separate syscalls:
>
>     ia64, parisc, sh64

and x86-64?

> 4b. only new-style IPC with separate syscalls, using generic syscall
>     table:
>
>     arc, arm64, c6x, h8300, hexagon, metag, nios2, openrisc, score,
>     tile, unicore32
>
> So we should probably fix 1. and 2. before it's too late, but make
> sure we don't break 3. in the process.

(Fortunately?) x86-32 doesn't seem to be converted in next yet?

I was hoping for them to do the heavy lifting for the generic solution ;-)

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Arnd Bergmann Nov. 18, 2015, 12:04 p.m. UTC | #5
On Wednesday 18 November 2015 11:07:26 Geert Uytterhoeven wrote:
> >
> > I've done a complete list of what the architectures (see
> > https://docs.google.com/spreadsheets/d/18GxXEHE2ywnSr-SPoGFd1ABz6wEM1ex-JMu5lEraaH8/ )
> >
> > We have these categories:
> >
> > 1. uses IPC_PARSE_VERSION with sys_ipc, and has just introduced
> >    separate syscalls:
> >
> >     arm, avr32, powerpc, x86-32
> 
> x86-32, where?

My mistake. x86 uses a different way to do this, so I didn't see it
using grep and just assumed that Andy Lutomirski had patched it already
based on my memory of

https://sourceware.org/ml/libc-alpha/2015-09/msg00323.html

> > 2. uses IPC_PARSE_VERSION with sys_ipc, and has not yet introduced
> >    separate syscalls (currently producing a compile warning):
> >
> >    cris, frv, m32r, m68k, mips (o32), mn10300, s390, sh32, sparc
> >
> > 3. uses IPC_PARSE_VERSION with separate syscalls:
> >
> >    alpha, blackfin, microblaze, mips (n32/64), xtensa
> >
> > 4a. only new-style IPC with separate syscalls:
> >
> >     ia64, parisc, sh64
> 
> and x86-64?

right, that too. I got it in my spreadsheet by copied it wrong.

> > 4b. only new-style IPC with separate syscalls, using generic syscall
> >     table:
> >
> >     arc, arm64, c6x, h8300, hexagon, metag, nios2, openrisc, score,
> >     tile, unicore32
> >
> > So we should probably fix 1. and 2. before it's too late, but make
> > sure we don't break 3. in the process.
> 
> (Fortunately?) x86-32 doesn't seem to be converted in next yet?
> 
> I was hoping for them to do the heavy lifting for the generic solution 

yes, that would be nice ;-)

	Arnd
diff mbox

Patch

diff --git a/arch/arm64/kernel/sys_ilp32.c b/arch/arm64/kernel/sys_ilp32.c
index c366d92..a2596f4 100644
--- a/arch/arm64/kernel/sys_ilp32.c
+++ b/arch/arm64/kernel/sys_ilp32.c
@@ -98,6 +98,25 @@  asmlinkage long compat_sys_statfs64_wrapper(void);
 
 #define compat_sys_pwritev	       compat_sys_pwritev64
 
+/* IPC_64 */
+asmlinkage long ilp32_sys_msgctl(int first, int second, void __user *uptr)
+{
+	return compat_sys_msgctl(first, second | IPC_64, uptr);
+}
+#define compat_sys_msgctl		ilp32_sys_msgctl
+
+asmlinkage long ilp32_sys_shmctl(int first, int second, void __user *uptr)
+{
+	return compat_sys_shmctl(first, second | IPC_64, uptr);
+}
+#define compat_sys_shmctl		ilp32_sys_shmctl
+
+asmlinkage long ilp32_sys_semctl(int first, int second, int third, int arg)
+{
+	return compat_sys_semctl(first, second, third | IPC_64, arg);
+}
+#define compat_sys_semctl	ilp32_sys_semctl
+
 #include <asm/syscall.h>
 
 #undef __SYSCALL