All of lore.kernel.org
 help / color / mirror / Atom feed
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] arm64: Add seccomp support
Date: Wed, 12 Feb 2014 12:17:45 +0100	[thread overview]
Message-ID: <201402121217.45763.arnd@arndb.de> (raw)
In-Reply-To: <201402121205.10802.arnd@arndb.de>

On Wednesday 12 February 2014, Arnd Bergmann wrote:
> 
> On Wednesday 12 February 2014, Takahiro Akashi wrote:
> > Thank you for your comment.
> > I'm afraid that I can't do so because how compat syscall numbers
> > are named varies from arch to arch. __NR_compat_read is used
> > only on arm64, while __NR_ia32_read on x86. On other archs,
> > __NR_read is common to 32-bit and 64-bit tasks.
> 
> It's fine, I'm the maintainer for asm-generic ;-)
> 
> All future architectures are required to do it the same way as
> arm64 and use the generic syscall ABI. It just means we won't be
> able to share this header with x86 or other architectures that
> use a nonstandard string. We should have it in the generic place
> even if arm64 is the only user for now.
> 

Ok, I was wrong. The generic header file should only be used for
architectures on which both ABIs use the generic syscall numbers,
and arm64 obviously doesn't do that for arm32 compatibility.

The proper generic header file should contain

#if defined(CONFIG_COMPAT) && !defined(__NR_seccomp_read_32)
#define __NR_seccomp_read_32           __NR_read
#define __NR_seccomp_write_32          __NR_write
#define __NR_seccomp_exit_32           __NR_exit
#define __NR_seccomp_sigreturn_32      __NR_rt_sigreturn
#endif /* CONFIG_COMPAT && ! already defined */

#define __NR_seccomp_read              __NR_read
#define __NR_seccomp_write             __NR_write
#define __NR_seccomp_exit              __NR_exit
#define __NR_seccomp_sigreturn         __NR_rt_sigreturn

and then have arm64 override the first four by defining its
own. I would still prefer having it done this way, but it actually
doesn't gain us that much since this default wouldn't work on
any 64-bit architecture currently implementing seccomp. I'll leave
it up to you whether you want to do it or not.

	Arnd

WARNING: multiple messages have this Message-ID (diff)
From: Arnd Bergmann <arnd@arndb.de>
To: Takahiro Akashi <takahiro.akashi@linaro.org>
Cc: "linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>, wad <wad@chromium.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	"linaro-kernel@lists.linaro.org" <linaro-kernel@lists.linaro.org>,
	Patch Tracking <patches@linaro.org>,
	"arndb@arndb.de" <arndb@arndb.de>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] arm64: Add seccomp support
Date: Wed, 12 Feb 2014 12:17:45 +0100	[thread overview]
Message-ID: <201402121217.45763.arnd@arndb.de> (raw)
In-Reply-To: <201402121205.10802.arnd@arndb.de>

On Wednesday 12 February 2014, Arnd Bergmann wrote:
> 
> On Wednesday 12 February 2014, Takahiro Akashi wrote:
> > Thank you for your comment.
> > I'm afraid that I can't do so because how compat syscall numbers
> > are named varies from arch to arch. __NR_compat_read is used
> > only on arm64, while __NR_ia32_read on x86. On other archs,
> > __NR_read is common to 32-bit and 64-bit tasks.
> 
> It's fine, I'm the maintainer for asm-generic ;-)
> 
> All future architectures are required to do it the same way as
> arm64 and use the generic syscall ABI. It just means we won't be
> able to share this header with x86 or other architectures that
> use a nonstandard string. We should have it in the generic place
> even if arm64 is the only user for now.
> 

Ok, I was wrong. The generic header file should only be used for
architectures on which both ABIs use the generic syscall numbers,
and arm64 obviously doesn't do that for arm32 compatibility.

The proper generic header file should contain

#if defined(CONFIG_COMPAT) && !defined(__NR_seccomp_read_32)
#define __NR_seccomp_read_32           __NR_read
#define __NR_seccomp_write_32          __NR_write
#define __NR_seccomp_exit_32           __NR_exit
#define __NR_seccomp_sigreturn_32      __NR_rt_sigreturn
#endif /* CONFIG_COMPAT && ! already defined */

#define __NR_seccomp_read              __NR_read
#define __NR_seccomp_write             __NR_write
#define __NR_seccomp_exit              __NR_exit
#define __NR_seccomp_sigreturn         __NR_rt_sigreturn

and then have arm64 override the first four by defining its
own. I would still prefer having it done this way, but it actually
doesn't gain us that much since this default wouldn't work on
any 64-bit architecture currently implementing seccomp. I'll leave
it up to you whether you want to do it or not.

	Arnd

  reply	other threads:[~2014-02-12 11:17 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-07 10:11 [PATCH 0/2] arm64: Add seccomp support AKASHI Takahiro
2014-02-07 10:11 ` AKASHI Takahiro
2014-02-07 10:11 ` [PATCH 1/2] " AKASHI Takahiro
2014-02-07 10:11   ` AKASHI Takahiro
2014-02-07 14:44   ` Arnd Bergmann
2014-02-07 14:44     ` Arnd Bergmann
     [not found]     ` <CAB5YjtB6XnXRd90AUw=rJCOBKyfcngTQd3Kxft33XLCK+K=Vuw@mail.gmail.com>
2014-02-12 11:05       ` Arnd Bergmann
2014-02-12 11:05         ` Arnd Bergmann
2014-02-12 11:17         ` Arnd Bergmann [this message]
2014-02-12 11:17           ` Arnd Bergmann
2014-02-18 15:38   ` Catalin Marinas
2014-02-18 15:38     ` Catalin Marinas
2014-02-19 11:39     ` AKASHI Takahiro
2014-02-19 11:39       ` AKASHI Takahiro
2014-02-19 16:41       ` Catalin Marinas
2014-02-19 16:41         ` Catalin Marinas
2014-02-20  0:34         ` AKASHI Takahiro
2014-02-20  0:34           ` AKASHI Takahiro
2014-02-07 10:11 ` [PATCH 2/2] arm64: is_compat_task is defined both in asm/compat.h and linux/compat.h AKASHI Takahiro
2014-02-07 10:11   ` AKASHI Takahiro
2014-02-17 19:32   ` Will Deacon
2014-02-17 19:32     ` Will Deacon
2014-02-19 11:16     ` AKASHI Takahiro
2014-02-19 11:16       ` AKASHI Takahiro
2014-02-25  9:20 ` [PATCH v2 0/3] arm64: Add seccomp support AKASHI Takahiro
2014-02-25  9:20   ` AKASHI Takahiro
2014-02-25  9:20   ` [PATCH v2 1/3] asm-generic: Add generic seccomp.h for secure computing mode 1 AKASHI Takahiro
2014-02-25  9:20     ` AKASHI Takahiro
2014-02-25  9:20   ` [PATCH v2 2/3] arm64: Add seccomp support AKASHI Takahiro
2014-02-25  9:20     ` AKASHI Takahiro
2014-02-28 17:20     ` Will Deacon
2014-02-28 17:20       ` Will Deacon
2014-03-06  2:34       ` AKASHI Takahiro
2014-03-06  2:34         ` AKASHI Takahiro
2014-03-06 15:24         ` Will Deacon
2014-03-06 15:24           ` Will Deacon
2014-02-25  9:20   ` [PATCH v2 3/3] arm64: is_compat_task is defined both in asm/compat.h and linux/compat.h AKASHI Takahiro
2014-02-25  9:20     ` AKASHI Takahiro
2014-02-28 16:58     ` Will Deacon
2014-02-28 16:58       ` Will Deacon
2014-03-13 10:17   ` [PATCH v3 0/3] arm64: Add seccomp support AKASHI Takahiro
2014-03-13 10:17     ` AKASHI Takahiro
2014-03-13 10:17     ` [PATCH v3 1/3] asm-generic: Add generic seccomp.h for secure computing mode 1 AKASHI Takahiro
2014-03-13 10:17       ` AKASHI Takahiro
2014-03-14 17:08       ` Catalin Marinas
2014-03-14 17:08         ` Catalin Marinas
2014-03-13 10:17     ` [PATCH v3 2/3] arm64: Add seccomp support AKASHI Takahiro
2014-03-13 10:17       ` AKASHI Takahiro
2014-03-13 10:17     ` [PATCH v3 3/3] arm64: is_compat_task is defined both in asm/compat.h and linux/compat.h AKASHI Takahiro
2014-03-13 10:17       ` AKASHI Takahiro
2014-03-15  5:50     ` [PATCH_v4 0/2] arm64: Add seccomp support AKASHI Takahiro
2014-03-15  5:50       ` AKASHI Takahiro
2014-03-15  5:50       ` [PATCH_v4 1/2] asm-generic: Add generic seccomp.h for secure computing mode 1 AKASHI Takahiro
2014-03-15  5:50         ` AKASHI Takahiro
2014-03-15  5:50       ` [PATCH_v4 2/2] arm64: Add seccomp support AKASHI Takahiro
2014-03-15  5:50         ` AKASHI Takahiro
2014-06-25 14:53       ` [PATCH_v4 0/2] " Mark Salter
2014-06-25 14:53         ` Mark Salter
2014-06-26  0:57         ` AKASHI Takahiro
2014-06-26  0:57           ` AKASHI Takahiro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201402121217.45763.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.