[RFC] making HAVE_SYSCALL_WRAPPERS universal (Re: Issues with "x86,um: switch to generic fork/vfork/clone" commit)

From: Al Viro
Date: Mon Jan 21 2013 - 17:55:09 EST


[linux-arch Cc'd]
On Mon, Jan 21, 2013 at 02:30:11AM +0000, Al Viro wrote:

> Neither do I, to be honest. It might be saving us a few cycles on
> some architectures, but I'd like to see examples of that. amd64
> doesn't seem to be one, at least...

*grumble*

OK, there is one problem - SYSCALL_ALIAS() is as arch-dependent as
cond_syscall(). As far as I can tell, with cond_syscall() we have
the following variants:
1) alpha, mips
.weak foo
foo = sys_ni_syscall
2) itanic, ppc
asmlinkage long x (void) __attribute__((weak,alias("sys_ni_syscall")))
3) very common - most of the architectures
.weak foo
.set foo sys_ni_syscall
3a) blackfin, h8300 - same as (3), except that asm symbols get
underscore prepended.
.weak _foo
.set _foo _sys_ni_syscall

For SYSCALL_ALIAS(foo,bar):
1) alpha, mips
foo = bar
.globl foo
2) ppc64
.globl foo
.set foo bar
.globl .foo
.set .foo .bar
[note that ppc64 cond_syscall ends up generating similar pair, only with
.globl replaced with .weak]
3) s390, sparc, tile
.globl foo
.set foo bar

I suspect that (3) here should cover the same things as (3,3a) for
cond_syscalls(), with the same "prepend _" variation on blackfin/h8300.
I really wonder what's going on with ppc64, though - as far as I can
tell, .foo is the real function there, while foo is a OPD entry refering
to it. Do we have anything similar on other architectures? And what
about itanic? After looking at the assembler generated by cond_syscall
there, I suspect that
foo# = bar#
.globl foo#
would be the right answer there, but I'd really like somebody familiar with
ia64 to confirm that...

Another question: what's the following comment from spu_callbacks.c about?
* 4. They are optional and we can't rely on them being
* linked into the kernel. Unfortunately, the cond_syscall
* helper does not work here as it does not add the necessary
* opd symbols:
* mbind, mq_open, ipc, ...
What isn't added? sys_ni_syscall is an OPD entry and weak aliases for it
*are* created. That comment predates the conversion of cond_syscall()
definition to the current one; it used to be
.weak .foo
.set .foo .sys_ni_syscall
and that wouldn't have created the second alias; is it simply obsolete?
Note that mbind and friends still are not available to SPU; should that
be changed now that we can do that?

I've tried to sanitize cond_syscall/SYSCALL_ALIAS situation; the tree is in
git.kernel.org/pub/scm/linux/kernel/git/viro/signal experimental-syscalls
NOTE: this is absolutely untested and might very well blow up
on any number of architectures.

Review and comments would be very welcome.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/