|
|
Log in / Subscribe / Register

personality(2) already exists

personality(2) already exists

Posted Apr 28, 2024 18:07 UTC (Sun) by Hello71 (guest, #103412)
Parent article: Support for the TSO memory model on Arm CPUs

Linux already has a system call to enable special compatibility logic in the kernel for old binaries. personality(2) was added 30 years ago in Linux 1.1.20 and has gained various "weird memory" modes over the years, including "ADDR_LIMIT_32BIT (since Linux 2.2): Limit the address space to 32 bits." and "ADDR_NO_RANDOMIZE (since Linux 2.6.12): With this flag set, disable address-space-layout randomization.". There has not been a surge of poorly-written programs relying on these modes.

Fundamentally, CPU emulation is a heavy compatibility mode. A reasonable argument could, and has endlessly been made that Wine and other emulators are detrimental to the long-term success of portable applications, but I see no principle why Wine, QEMU, ADDR_LIMIT_32BIT, and ADDR_NO_RANDOMIZE should be acceptable but PR_SET_MEM_MODEL_TSO shouldn't.


to post comments

personality(2) already exists

Posted Apr 29, 2024 7:27 UTC (Mon) by pm215 (subscriber, #98099) [Link] (3 responses)

As it happens QEMU has generally either not needed or not succeeded in getting into the kernel compat tweaks for its emulation. (The one I'm thinking of is that if you're emulating a 32 bit guest readdir syscall you need to fill a 32 bit d_off in struct dirent, but a 64 bit host kernel with some filesystems will put a 64 bit hash in the d_off, which can't fit into the guest's 32 bit field, and there's no way to say "give me something I can put in 32 bits". We tried to get patches for an fcntl to toggle this into the kernel a few years back but they went nowhere.)

personality(2) already exists

Posted Apr 30, 2024 6:34 UTC (Tue) by linusw (subscriber, #40300) [Link] (2 responses)

I tried to fix this for QEMU but ended up getting ignored I think.
Personally I can live with this, but it's probably not good for QEMU.
https://lore.kernel.org/linux-fsdevel/20201117233928.2556...

personality(2) already exists

Posted Apr 30, 2024 15:53 UTC (Tue) by mb (subscriber, #50428) [Link] (1 responses)

What does qemu currently do, when it encounters this situation?

personality(2) already exists

Posted May 2, 2024 14:53 UTC (Thu) by pm215 (subscriber, #98099) [Link]

The typical failure mode is that QEMU returns the 64-bit value in the struct from the getdents64(2) syscall, and the guest libc then fails the readdir(3) library call with EOVERFLOW when it can't fit the quart into the pint pot. The guest program is usually terminally unhappy with that.

personality(2) already exists

Posted Apr 29, 2024 20:33 UTC (Mon) by justincormack (subscriber, #70439) [Link]

emacs used to disable ASLR with that, not aware of any other usage, and eventually they gave up.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds