Re: [PATCH] prctl: implement PR_GET_ENDIAN for all architectures

From: Andrew Morton
Date: Wed Feb 01 2017 - 17:03:28 EST


On Wed, 1 Feb 2017 20:47:06 +0100 Helge Deller <deller@xxxxxx> wrote:

> Hi Andrew,
>
> On 01.02.2017 01:26, Andrew Morton wrote:
> > On Sat, 28 Jan 2017 12:13:10 +0100 Helge Deller <deller@xxxxxx> wrote:
> >
> >> The prctl(PR_GET_ENDIAN) syscall was added to Kernel 2.6.18, but
> >> implemented for PowerPC only.
> >> This trivial patch adds support for this syscall for all other architectures.
> >
> > Seems reasonable. I guess.
>
> Heck, I did forgot but I submitted a similar patch 8 years ago:
> http://www.serverphorums.com/read.php?12,51902
>
> > Why is this needed?
>
> It's not actually needed beside the trivial reason of providing an interface
> not just for one single architecture.
>
> After reading the discussion from 2009 again, I'm fine if
> you would simply drop the patch. The decision up to you.

Can't decide. I guess that moving it into the kernel will, over time,
eliminate some irritating ifdefs from userspace code.

The implementation itself is a bit half-assed. The put_user() in
arch/powerpc/kernel/process.c:get_endian() should be moved into
kernel/sys.c. So the arch code only does the "what endianness am I"
function and common code copies that out to userspace.