[PATCH] um: make personality(PER_LINUX32) work on x86_64
Maciej Żenczykowski
maze at google.com
Mon Aug 19 11:46:31 PDT 2024
On Mon, Aug 19, 2024 at 5:23 AM Johannes Berg <johannes at sipsolutions.net> wrote:
>
> On Tue, 2024-08-13 at 16:47 -0700, Maciej Żenczykowski wrote:
> > Without this patch:
> > #!/usr/bin/python3
> > import ctypes
> > import os
> > personality = ctypes.CDLL(None).personality
> > personality.restype = ctypes.c_int
> > personality.argtypes = [ctypes.c_ulong]
> > PER_LINUX32=8
> > personality(PER_LINUX32)
> > print(os.uname().machine)
> > returns:
> > x86_64
> > instead of the desired:
> > i686
> >
>
> But ... why should it work? UML has no 32-bit compat support anyway.
Well, that's certainly a fair point.
On 'native' x86_64 this works even for 64-bit processes though.
I wonder if that, in itself, is a feature or a bug...
In my case I was writing some debug code (to print the environment
some test code is running in, since I think it was failing due to
running 32-bit code in PER_LINUX32 on 64-bit arm) and testing (the
test code) on x86_64 UML. I was surprised to discover the difference
in UML vs my host desktop.
> johannes
--
Maciej Żenczykowski, Kernel Networking Developer @ Google
More information about the linux-um
mailing list