Re: [PATCH 1/1] x86: Make _syscallX() macros compile in PIC mode oni386

From: Andrew Morton
Date: Thu Mar 09 2006 - 22:22:57 EST


Markus Gutschke <markus@xxxxxxxxxx> wrote:
>
> Andrew Morton wrote:
> > But we don't compile the kernel with -fpic... We might want to, for kdump
> > convenience at some stage, perhaps.
>
> Unless I am really confused, there should be no place in the kernel that
> uses any of the _syscallX() macros. These macros are for the benefit of
> userspace, and they get picked up by and distributed with glibc. They
> just happen to be shipped and maintained with the kernel.

Nope, there's an int-80-based execve() implemented in
include/asm-i386/unistd.h. It's called from init/do_mounts_initrd.c
and kernel/kmod.c (at least).

> > If we do, it'd be better to simply replace those _syscallX functions with
> > versions which work in either mode, rather than having two versions.
>
> That is certainly possible. The new macros work in both modes, but they
> are slightly less efficient than the old macros, if you have access to
> %ebx (i.e. in non-PIC code). If you prefer, we could just remove the old
> macros and unconditionally replace them with the new ones.

I'd be OK with that - the kernel doesn't (shouldn't) care about the
performance of __KERNEL_SYSCALLS__ stuff. I doubt if glibc is borrowing
the kernel's macros.

> > The syscallX() macros are almost obsolete - it's preferred that code simply
> > include syscalls.h and call sys_foo() directly. But there are a few
> > hard-to-convert places, iirc.
>
> Are you thinking of the code that jumps through the vdso entry point?
> That is not always an easy option for user-space applications which need
> to remain backwards compatible to older versions of the kernel and of libc.
>

afaik, execve() is the only reason for retaining __KERNEL_SYSCALLS__
support on x86.
-
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/