mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Andreas Kraschitzer <andreas.kraschitzer@theobroma-systems.com>,
	Benedikt Huber <benedikt.huber@theobroma-systems.com>,
	linux-kernel@vger.kernel.org, Andrew Pinski <apinski@cavium.com>,
	Kumar Sankaran <ksankaran@apm.com>,
	"Dr. Philipp Tomsich" <philipp.tomsich@theobroma-systems.com>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	Christoph Muellner <christoph.muellner@theobroma-systems.com>
Subject: Re: [PATCH v4 00/24] ILP32 for ARM64
Date: Wed, 15 Apr 2015 12:22:24 +0100	[thread overview]
Message-ID: <20150415112224.GA26099@e104818-lin.cambridge.arm.com> (raw)
In-Reply-To: <2485404.lBlHmzQPKN@wuerfel>

On Tue, Apr 14, 2015 at 05:44:07PM +0200, Arnd Bergmann wrote:
> On Tuesday 14 April 2015 15:47:02 Catalin Marinas wrote:
> > On Tue, Apr 14, 2015 at 12:08:11PM +0200, Arnd Bergmann wrote:
> > > d) don't use the asm-generic/unistd.h table for aarch64-ilp32 at all, but instead
> > >    reuse the table from arch/arm64/include/asm/unistd32.h
> > 
> > IMO, (d) only makes sense if we treat ILP32 as a temporary solution
> > (a.k.a. hack) hoping that such applications will be eventually built for
> > LP64. If we treat native ILP32 as a real long term alternative to LP64,
> > I would rather use the asm-generic/unistd.h for syscalls. For example,
> > use 'openat' instead of 'open' on the native ILP32 (based on the
> > assumption that ILP32 is a long term alternative).
> > 
> > Unless we are aware of performance impact with (a), that's my preferred
> > option with some form of (b) next.
> 
> Ok, let's call that option
> 
> e) Use the existing aarch32 data structures with the asm-generic/unistd.h
> system call numbers.
> 
> This would solve the main problem of the data structures just like option
> d), and the main user-visible change would be that the syscall numbers
> are shifted compared to aarch32, which is a very minor aspect. We could
> also deal with the ucontext better this way than what I suggested.

I think that's the easiest from a kernel perspective. But see the other
sub-thread on the long term view of ILP32 (beyond 2038).

> > The above is mainly about syscall numbers and tables but the ABI goes
> > beyond this. And the key point is whether we go for an AArch32-like ABI
> > (32-bit time_t) or we try to define one close to LP64. If we go for an
> > AArch32-like ABI, we'll have to use the compat layer for some of
> > syscalls and assess how many of the asm/compat.h structures are
> > different from the generic ones (I wouldn't expect many).
> 
> It would be wildly different from the generic data structures, since we
> can only use the compat code if the implementation is the same as on
> aarch32. Essentially we have to define the headers so that all native
> data structures match what is in arch/arm64/include/asm/compat.h,
> which in turn is largely the same as arch/arm/include/uapi/asm/*.h.

What I meant by generic structures is those include/uapi/asm-generic/*.h
structures but compiled in an ILP32 context (exported headers not as
they are compiled in the LP64 kernel). Many of the asm/compat.h had to
be defined so that we can build them in the kernel context but many of
them are the same as the asm-generic ones (when compiled as ILP32).

BTW, we have to sort out the exported headers as well since we can't
rely on AArch32 for this. In the kernel, we'll have to re-use
asm/compat.h or some other asm/ilp32.h.

> > > Finally, there is a certain set of security issues from each new syscall
> > > we introduce. With the aarch32 syscall table, we have a higher degree
> > > of reuse of existing code, so we won't introduce security bugs that
> > > are only in one of the two ilp32 ABIs (aarch32 and aarch64).
> > 
> > Note that the current aarch32 compat ABI assumes that the top 32-bit of
> > every register is either zeroed or preserved by the architecture on
> > exception entry. We know that an AArch32 application cannot access the
> > top 32-bit of an AArch64 register. With native ILP32 however this is no
> > longer the case (it is running in AArch64 mode). I can't immediately
> > think of a problem (information leak) but it needs to be reviewed.
> 
> Hmm, interesting point. I'd have to think about this a bit more, but
> I believe it is already solved:
> 
> - For input arguments, we have the COMPAT_SYSCALL_DEFINE wrappers that
>   are meant to deal with this problem.
> - For output arguments, the kernel controls the register contents,
>   and I don't see a way that the function return value could leak
>   data in the upper bits. All syscall return 'long', so it should
>   be well-defined.

I think you are right. I was more thinking of those routed directly to
the native (non-compat) syscalls. We would need to make sure the return
value (X0 being the only register not restored on return from exception)
has the top 32-bit part zeroed.

-- 
Catalin

  reply	other threads:[~2015-04-15 11:22 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-13 19:44 Philipp Tomsich
2015-04-13 19:44 ` [PATCH v4 01/24] arm64:ilp32: add documentation on the ILP32 ABI " Philipp Tomsich
2015-04-13 19:44 ` [PATCH v4 02/24] arm64: ensure the kernel is compiled for LP64 Philipp Tomsich
2015-04-13 19:44 ` [PATCH v4 03/24] arm64: rename COMPAT to AARCH32_EL0 in Kconfig Philipp Tomsich
2015-04-13 19:44 ` [PATCH v4 04/24] arm64: change some CONFIG_COMPAT over to use CONFIG_AARCH32_EL0 instead Philipp Tomsich
2015-04-13 19:44 ` [PATCH v4 05/24] arm64:ilp32: expose 'kernel_long' as 'long long' for ILP32 Philipp Tomsich
2015-04-13 19:44 ` [PATCH v4 06/24] arm64:uapi: set __BITS_PER_LONG correctly for ILP32 and LP64 Philipp Tomsich
2015-04-13 19:44 ` [PATCH v4 07/24] arm64:ilp32: share signal structures between ILP32 and LP64 ABIs Philipp Tomsich
2015-04-13 19:44 ` [PATCH v4 08/24] arm64:ilp32: use 64bit syscall-names for ILP32 when passing 64bit registers Philipp Tomsich
2015-04-13 19:44 ` [PATCH v4 09/24] arm64:ilp32: use non-compat syscall names for ILP32 as for LP64 Philipp Tomsich
2015-04-13 19:44 ` [PATCH v4 10/24] arm64: introduce is_a32_task and is_a32_thread (for AArch32 compat) Philipp Tomsich
2015-04-13 19:44 ` [PATCH v4 11/24] arm64:ilp32: add is_ilp32_compat_{task,thread} and TIF_32BIT_AARCH64 Philipp Tomsich
2015-04-13 19:44 ` [PATCH v4 12/24] arm64:ilp32: COMPAT_USE_64BIT_TIME is true for ILP32 tasks Philipp Tomsich
2015-04-13 19:44 ` [PATCH v4 13/24] arm64:ilp32: share HWCAP between LP64 and ILP32 Philipp Tomsich
2015-04-13 19:44 ` [PATCH v4 14/24] arm64:ilp32 use the native LP64 'start_thread' for ILP32 threads Philipp Tomsich
2015-04-13 19:44 ` [PATCH v4 15/24] arm64:ilp32: support core dump generation for ILP32 Philipp Tomsich
2015-04-13 19:44 ` [PATCH v4 16/24] arm64: add support for starting ILP32 (ELFCLASS32) binaries Philipp Tomsich
2015-04-13 19:44 ` [PATCH v4 17/24] arm64:ilp32: add vdso-ilp32 and use for signal return Philipp Tomsich
2015-04-13 19:44 ` [PATCH v4 18/24] ptrace: Allow compat to use the native siginfo Philipp Tomsich
2015-04-13 19:44 ` [PATCH v4 19/24] arm64:ilp32: add sys_ilp32.c and a separate table (in entry.S) to use it Philipp Tomsich
2015-04-13 19:44 ` [PATCH v4 20/24] arm64:ilp32: use compat-syscalls for msgsnd and msgrcv for ILP32 Philipp Tomsich
2015-04-13 19:44 ` [PATCH v4 21/24] arm64:ilp32: use the native siginfo instead of the compat siginfo Philipp Tomsich
2015-04-13 19:44 ` [PATCH v4 22/24] arm64:ilp32: use compat for stack_t Philipp Tomsich
2015-05-05  0:03   ` Pinski, Andrew
2015-04-13 19:44 ` [PATCH v4 23/24] arm64:ilp32: change COMPAT_ELF_PLATFORM to report a a subplatform for ILP32 Philipp Tomsich
2015-04-13 19:44 ` [PATCH v4 24/24] arm64:ilp32: add ARM64_ILP32 to Kconfig Philipp Tomsich
2015-04-13 21:01 ` [PATCH v4 00/24] ILP32 for ARM64 Arnd Bergmann
2015-04-13 22:58   ` Dr. Philipp Tomsich
2015-04-14  9:40     ` Arnd Bergmann
     [not found]     ` <AC03A80E-49F8-4A08-9DDA-0B9F8B734F51@theobroma-systems.com>
2015-04-14 10:08       ` Arnd Bergmann
2015-04-14 10:45         ` Pinski, Andrew
2015-04-14 11:14           ` Arnd Bergmann
2015-04-14 11:50             ` Dr. Philipp Tomsich
2015-04-14 14:07               ` Arnd Bergmann
2015-04-14 15:00                 ` Catalin Marinas
2015-04-14 22:28                   ` Arnd Bergmann
2015-04-15  9:18                     ` Dr. Philipp Tomsich
2015-04-15 10:01                       ` Catalin Marinas
2015-04-15 15:15                         ` Arnd Bergmann
2015-04-15 15:38                           ` Catalin Marinas
2015-04-15 17:01                             ` Dr. Philipp Tomsich
2015-04-15 17:22                               ` Catalin Marinas
2015-04-15 22:25                                 ` Alexander Graf
2015-04-16 11:03                                   ` Catalin Marinas
2015-04-16 11:19                                     ` Dr. Philipp Tomsich
2015-04-16 11:33                                       ` Pinski, Andrew
2015-04-16 13:31                                         ` Catalin Marinas
2015-04-16 15:21                                           ` Arnd Bergmann
2015-04-17  9:01                                             ` Catalin Marinas
2015-04-17 13:17                                               ` Arnd Bergmann
2015-04-17 14:06                                                 ` Alexander Graf
2015-04-17 14:46                                                 ` Catalin Marinas
2015-04-17 15:15                                                   ` Dr. Philipp Tomsich
2015-04-18 19:24                                                     ` Arnd Bergmann
2015-05-04 10:29                                                       ` Arnd Bergmann
2015-05-04 10:32                                                         ` Dr. Philipp Tomsich
2015-05-04 14:43                                                           ` Arnd Bergmann
2015-05-05 13:11                                                         ` Arnd Bergmann
2015-04-17 15:49                                                   ` Arnd Bergmann
2015-04-20 15:56                                                     ` Catalin Marinas
2015-04-20 17:40                                                       ` Arnd Bergmann
2015-04-20 14:37                                                 ` Zhangjian (Bamvor)
2015-04-16 14:27                                       ` Catalin Marinas
     [not found]                 ` <38FDDD2B-89C4-43C8-897D-A9DB6D023B7D@theobroma-systems.com>
2015-04-15 12:25                   ` Arnd Bergmann
2015-04-14 11:51             ` Pinski, Andrew
2015-04-14 14:56               ` Catalin Marinas
2015-04-14 13:38           ` Catalin Marinas
2015-04-14 14:47         ` Catalin Marinas
2015-04-14 15:29           ` Dr. Philipp Tomsich
2015-04-14 16:55             ` Catalin Marinas
2015-04-15 10:31               ` Dr. Philipp Tomsich
2015-04-15 12:47               ` Arnd Bergmann
2015-04-15 12:42             ` Arnd Bergmann
2015-04-14 15:44           ` Arnd Bergmann
2015-04-15 11:22             ` Catalin Marinas [this message]
     [not found]               ` <721B7D5F-0A9A-45B7-8036-730ED54FB3AB@theobroma-systems.com>
2015-04-15 15:49                 ` Catalin Marinas

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=20150415112224.GA26099@e104818-lin.cambridge.arm.com \
    --to=catalin.marinas@arm.com \
    --cc=andreas.kraschitzer@theobroma-systems.com \
    --cc=apinski@cavium.com \
    --cc=arnd@arndb.de \
    --cc=benedikt.huber@theobroma-systems.com \
    --cc=christoph.muellner@theobroma-systems.com \
    --cc=ksankaran@apm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=philipp.tomsich@theobroma-systems.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®