[11/15] mips: fix n32 compat_ipc_parse_version
diff mbox series

Message ID 20190110162435.309262-12-arnd@arndb.de
State Not Applicable
Headers show
Series
  • arch: synchronize syscall tables in preparation for y2038
Related show

Checks

Context Check Description
snowpatch_ozlabs/checkpatch success total: 0 errors, 0 warnings, 0 checks, 7 lines checked
snowpatch_ozlabs/apply_patch success next/apply_patch Successfully applied

Commit Message

Arnd Bergmann Jan. 10, 2019, 4:24 p.m. UTC
While reading through the sysvipc implementation, I noticed that the n32
semctl/shmctl/msgctl system calls behave differently based on whether
o32 support is enabled or not: Without o32, the IPC_64 flag passed by
user space is rejected but calls without that flag get IPC_64 behavior.

As far as I can tell, this was inadvertently changed by a cleanup patch
but never noticed by anyone, possibly nobody has tried using sysvipc
on n32 after linux-3.19.

Change it back to the old behavior now.

Fixes: 78aaf956ba3a ("MIPS: Compat: Fix build error if CONFIG_MIPS32_COMPAT but no compat ABI.")
Cc: stable@vger.kernel.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
As stated above, this was only found by inspection, the patch is not
tested. Please review accordingly.
---
 arch/mips/Kconfig | 1 +
 1 file changed, 1 insertion(+)

Comments

Paul Burton Jan. 10, 2019, 7:39 p.m. UTC | #1
Hi Arnd,

On Thu, Jan 10, 2019 at 05:24:31PM +0100, Arnd Bergmann wrote:
> While reading through the sysvipc implementation, I noticed that the n32
> semctl/shmctl/msgctl system calls behave differently based on whether
> o32 support is enabled or not: Without o32, the IPC_64 flag passed by
> user space is rejected but calls without that flag get IPC_64 behavior.
> 
> As far as I can tell, this was inadvertently changed by a cleanup patch
> but never noticed by anyone, possibly nobody has tried using sysvipc
> on n32 after linux-3.19.
> 
> Change it back to the old behavior now.
> 
> Fixes: 78aaf956ba3a ("MIPS: Compat: Fix build error if CONFIG_MIPS32_COMPAT but no compat ABI.")
> Cc: stable@vger.kernel.org
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> As stated above, this was only found by inspection, the patch is not
> tested. Please review accordingly.

Nice catch! Would you prefer to merge this yourself, or that I take it
through the mips tree?

If the former then:

  Acked-by: Paul Burton <paul.burton@mips.com>

I suspect kernels configured with n32 support but no o32 support are
probably not very common - for internal testing we currently always
enable both.

Thanks,
    Paul

> ---
>  arch/mips/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index 787290781b8c..0d14f51d0002 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -3155,6 +3155,7 @@ config MIPS32_O32
>  config MIPS32_N32
>  	bool "Kernel support for n32 binaries"
>  	depends on 64BIT
> +	select ARCH_WANT_COMPAT_IPC_PARSE_VERSION
>  	select COMPAT
>  	select MIPS32_COMPAT
>  	select SYSVIPC_COMPAT if SYSVIPC
> -- 
> 2.20.0
>
Arnd Bergmann Jan. 10, 2019, 11:04 p.m. UTC | #2
On Thu, Jan 10, 2019 at 8:40 PM Paul Burton <paul.burton@mips.com> wrote:
> On Thu, Jan 10, 2019 at 05:24:31PM +0100, Arnd Bergmann wrote:
> > While reading through the sysvipc implementation, I noticed that the n32
> > semctl/shmctl/msgctl system calls behave differently based on whether
> > o32 support is enabled or not: Without o32, the IPC_64 flag passed by
> > user space is rejected but calls without that flag get IPC_64 behavior.
> >
> > As far as I can tell, this was inadvertently changed by a cleanup patch
> > but never noticed by anyone, possibly nobody has tried using sysvipc
> > on n32 after linux-3.19.
> >
> > Change it back to the old behavior now.
> >
> > Fixes: 78aaf956ba3a ("MIPS: Compat: Fix build error if CONFIG_MIPS32_COMPAT but no compat ABI.")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > ---
> > As stated above, this was only found by inspection, the patch is not
> > tested. Please review accordingly.
>
> Nice catch! Would you prefer to merge this yourself, or that I take it
> through the mips tree?

Up to you: if you want to merge it for 5.0, I'll just drop it from my tree.

> If the former then:
>
>   Acked-by: Paul Burton <paul.burton@mips.com>

Thanks!

> I suspect kernels configured with n32 support but no o32 support are
> probably not very common - for internal testing we currently always
> enable both.

Do you know of anyone actually still using n32 in production systems
with 4.x kernels? I wonder if it just fell out of popularity as the 64-bit
machines that used it either became large enough to want 64-bit
user space, or got replaced by arm64 or mips32 hardware.

      Arnd
Paul Burton Jan. 11, 2019, 7:25 p.m. UTC | #3
Hello,

Arnd Bergmann wrote:
> While reading through the sysvipc implementation, I noticed that the n32
> semctl/shmctl/msgctl system calls behave differently based on whether
> o32 support is enabled or not: Without o32, the IPC_64 flag passed by
> user space is rejected but calls without that flag get IPC_64 behavior.
> 
> As far as I can tell, this was inadvertently changed by a cleanup patch
> but never noticed by anyone, possibly nobody has tried using sysvipc
> on n32 after linux-3.19.
> 
> Change it back to the old behavior now.
> 
> Fixes: 78aaf956ba3a ("MIPS: Compat: Fix build error if CONFIG_MIPS32_COMPAT but no compat ABI.")
> Cc: stable@vger.kernel.org
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Applied to mips-fixes.

Thanks,
    Paul

[ This message was auto-generated; if you believe anything is incorrect
  then please email paul.burton@mips.com to report it. ]

Patch
diff mbox series

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 787290781b8c..0d14f51d0002 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -3155,6 +3155,7 @@  config MIPS32_O32
 config MIPS32_N32
 	bool "Kernel support for n32 binaries"
 	depends on 64BIT
+	select ARCH_WANT_COMPAT_IPC_PARSE_VERSION
 	select COMPAT
 	select MIPS32_COMPAT
 	select SYSVIPC_COMPAT if SYSVIPC