All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiko Carstens <heiko.carstens@de.ibm.com>
To: Yury Norov <ynorov@caviumnetworks.com>
Cc: linux-arch@vger.kernel.org, linux-s390@vger.kernel.org,
	arnd@arndb.de, pinskia@gmail.com,
	Prasun.Kapoor@caviumnetworks.com, catalin.marinas@arm.com,
	Nathan_Lynch@mentor.com, linux-kernel@vger.kernel.org,
	agraf@suse.de, klimov.linux@gmail.com, broonie@kernel.org,
	joseph@codesourcery.com, schwidefsky@de.ibm.com,
	linux-arm-kernel@lists.infradead.org,
	christoph.muellner@theobroma-systems.com
Subject: Re: [PATCH 1/5] all: s390: move wrapper infrastructure to generic headers
Date: Tue, 2 Feb 2016 08:39:13 +0100	[thread overview]
Message-ID: <20160202073913.GB3990@osiris> (raw)
In-Reply-To: <20160201114251.GB973@yury-N73SV>

On Mon, Feb 01, 2016 at 02:42:51PM +0300, Yury Norov wrote:
> Hi Heiko,
> 
> I tried this idea, and I don't like what happened.
>  - Wrappers around safe syscalls does exist. We can remove it by
>    overcomplicating __SC_COMPAT_CAST, but I don't like it.
>  - We still need to declare numerous list of new compat syscalls.
>    And it becomes even bigger, as we need to declare all compat
>    syscall versions not declared in include/linux/compat.h already.
>    (Currently - only for unsafe syscalls.)
>  - 'Weak' trick doesn't work for the whole kernel, so we'd figure out
>    some new prefix for wrapped syscalls. Or declare all non-compat
>    syscalls explicitly with SYSCALL_COMPAT_DEFINE. So the list of
>    replacements grow. And for me, it's harder to explain why we are
>    wrapping safe syscalls. Or we introduce another bunch of useless
>    wrappers (with new prefix), and have to handle it in non-compat code.
>  - With all listed above, we move all wrapper logic to non-compat
>    'include/linux/syscalls.h' header. Which is not a good idea, if it
>    doesn't benefit us much in return.
> 
> > > No need to look up if a compat variant (or wrapper) exists or
> > > sys_<syscallname> should be used instead. Also no possibility for security
> > > bugs that could creep in because SYSCALL_DEFINE has been used instead of
> > > SYSCALL_DEFINE_WRAP.
> 
> I thought again about it. With current version, it's very easy to
> define whether we have wrapper or not - just by macro we use. Once
> reviewed, this list is hardly to be changed frequently. If someone is
> introducing new syscall, it will attract much attention, so security
> risk is minimal.
> 
> Maybe I missed some elegant implementation, and if so  I'll be happy
> if someone'll point me out. But with what I see, I'd vote for what we
> have now. (Plus description in docs, plus renaming new macro.)

Well, I'd like to have some proof by the compiler or linker that nothing
went wrong. Which seems hard if only selected system call defines will be
converted to the new defines.

How can you tell that nothing has been forgotten?

Also, what happens if the prototype of a system call get's changed shortly
after it was merged. We might miss such changes and have bugs.

Therefore, and to get to a solution, I think we should stick with your
first idea, which only moves the compat_wrapper.c file.

Before doing that I think you should actually revert this patch: my commit
7681df456f97 ("s390/compat: remove superfluous compat wrappers") probably
wasn't a very bright idea :)

This again allows me to use only compat system calls in s390's system call
table (execpt for system calls without parameters, but that can be easily
fixed).

What I still don't like is that you need to add all the protoypes. Why are
the system call tables actually written in C and not in asm?

WARNING: multiple messages have this Message-ID (diff)
From: heiko.carstens@de.ibm.com (Heiko Carstens)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/5] all: s390: move wrapper infrastructure to generic headers
Date: Tue, 2 Feb 2016 08:39:13 +0100	[thread overview]
Message-ID: <20160202073913.GB3990@osiris> (raw)
In-Reply-To: <20160201114251.GB973@yury-N73SV>

On Mon, Feb 01, 2016 at 02:42:51PM +0300, Yury Norov wrote:
> Hi Heiko,
> 
> I tried this idea, and I don't like what happened.
>  - Wrappers around safe syscalls does exist. We can remove it by
>    overcomplicating __SC_COMPAT_CAST, but I don't like it.
>  - We still need to declare numerous list of new compat syscalls.
>    And it becomes even bigger, as we need to declare all compat
>    syscall versions not declared in include/linux/compat.h already.
>    (Currently - only for unsafe syscalls.)
>  - 'Weak' trick doesn't work for the whole kernel, so we'd figure out
>    some new prefix for wrapped syscalls. Or declare all non-compat
>    syscalls explicitly with SYSCALL_COMPAT_DEFINE. So the list of
>    replacements grow. And for me, it's harder to explain why we are
>    wrapping safe syscalls. Or we introduce another bunch of useless
>    wrappers (with new prefix), and have to handle it in non-compat code.
>  - With all listed above, we move all wrapper logic to non-compat
>    'include/linux/syscalls.h' header. Which is not a good idea, if it
>    doesn't benefit us much in return.
> 
> > > No need to look up if a compat variant (or wrapper) exists or
> > > sys_<syscallname> should be used instead. Also no possibility for security
> > > bugs that could creep in because SYSCALL_DEFINE has been used instead of
> > > SYSCALL_DEFINE_WRAP.
> 
> I thought again about it. With current version, it's very easy to
> define whether we have wrapper or not - just by macro we use. Once
> reviewed, this list is hardly to be changed frequently. If someone is
> introducing new syscall, it will attract much attention, so security
> risk is minimal.
> 
> Maybe I missed some elegant implementation, and if so  I'll be happy
> if someone'll point me out. But with what I see, I'd vote for what we
> have now. (Plus description in docs, plus renaming new macro.)

Well, I'd like to have some proof by the compiler or linker that nothing
went wrong. Which seems hard if only selected system call defines will be
converted to the new defines.

How can you tell that nothing has been forgotten?

Also, what happens if the prototype of a system call get's changed shortly
after it was merged. We might miss such changes and have bugs.

Therefore, and to get to a solution, I think we should stick with your
first idea, which only moves the compat_wrapper.c file.

Before doing that I think you should actually revert this patch: my commit
7681df456f97 ("s390/compat: remove superfluous compat wrappers") probably
wasn't a very bright idea :)

This again allows me to use only compat system calls in s390's system call
table (execpt for system calls without parameters, but that can be easily
fixed).

What I still don't like is that you need to add all the protoypes. Why are
the system call tables actually written in C and not in asm?

  reply	other threads:[~2016-02-02  7:39 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-25 16:57 [PATCH 0/5] all: s390: make compat wrappers the generic solution Yury Norov
2016-01-25 16:57 ` Yury Norov
2016-01-25 16:57 ` Yury Norov
2016-01-25 16:57 ` Yury Norov
2016-01-25 16:57 ` [PATCH 1/5] all: s390: move wrapper infrastructure to generic headers Yury Norov
2016-01-25 16:57   ` Yury Norov
2016-01-25 16:57   ` Yury Norov
2016-01-25 18:10   ` kbuild test robot
2016-01-25 18:10     ` kbuild test robot
2016-01-25 18:10     ` kbuild test robot
2016-01-25 18:10     ` kbuild test robot
2016-01-28 12:16   ` Heiko Carstens
2016-01-28 12:16     ` Heiko Carstens
2016-01-28 16:31     ` Yury Norov
2016-01-28 16:31       ` Yury Norov
2016-01-28 16:31       ` Yury Norov
2016-02-01 11:42       ` Yury Norov
2016-02-01 11:42         ` Yury Norov
2016-02-01 11:42         ` Yury Norov
2016-02-02  7:39         ` Heiko Carstens [this message]
2016-02-02  7:39           ` Heiko Carstens
2016-02-02 15:43           ` Yury Norov
2016-02-02 15:43             ` Yury Norov
2016-02-02 15:43             ` Yury Norov
2016-02-02 16:08             ` Heiko Carstens
2016-02-02 16:08               ` Heiko Carstens
2016-02-02 19:54               ` Heiko Carstens
2016-02-02 19:54                 ` Heiko Carstens
2016-02-02 20:41                 ` Yury Norov
2016-02-02 20:41                   ` Yury Norov
2016-02-02 20:41                   ` Yury Norov
2016-02-03  8:01                   ` Heiko Carstens
2016-02-03  8:01                     ` Heiko Carstens
2016-02-17  8:22                   ` Heiko Carstens
2016-02-17  8:22                     ` Heiko Carstens
2016-02-17 13:57                     ` Yury Norov
2016-02-17 13:57                       ` Yury Norov
2016-02-17 13:57                       ` Yury Norov
2016-01-25 16:57 ` [PATCH 2/5] all: declare new wrappers Yury Norov
2016-01-25 16:57   ` Yury Norov
2016-01-25 16:57   ` Yury Norov
2016-01-25 16:57 ` [PATCH 3/5] all: s390: redefine wrappers in generic code Yury Norov
2016-01-25 16:57   ` Yury Norov
2016-01-25 16:57   ` Yury Norov
2016-01-25 16:57 ` [PATCH 4/5] all: wrap getdents64 syscall Yury Norov
2016-01-25 16:57   ` Yury Norov
2016-01-25 16:57   ` Yury Norov
2016-01-25 16:57 ` [PATCH 5/5] all: introduce COMPAT_WRAPPER option and enable it for s390 Yury Norov
2016-01-25 16:57   ` Yury Norov
2016-01-25 16:57   ` Yury Norov

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=20160202073913.GB3990@osiris \
    --to=heiko.carstens@de.ibm.com \
    --cc=Nathan_Lynch@mentor.com \
    --cc=Prasun.Kapoor@caviumnetworks.com \
    --cc=agraf@suse.de \
    --cc=arnd@arndb.de \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=christoph.muellner@theobroma-systems.com \
    --cc=joseph@codesourcery.com \
    --cc=klimov.linux@gmail.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=pinskia@gmail.com \
    --cc=schwidefsky@de.ibm.com \
    --cc=ynorov@caviumnetworks.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 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.