Consider the following program compiled with -m32 flag: #include <stdio.h> #include <sys/utsname.h> int main() { struct utsname name; uname(&name); printf("machine: %s\n", name.machine); return 0; } This prints "machine: i686" under Linuxulator, while Ubuntu 18.04 gives me "machine: x86_64".
Which would be the correct behavior? (1) Always return x86_64 for FreeBSD on amd64 CPU. (2) Conditionally return x86_64 vs. i686 on whether linux64 module is loaded.
For reference, my use case is the Linux Steam client, which uses this information to decide whether you are allowed to install 64-bit games. The client itself is 32-bit application. Of course, I already have a workaround applied (https://github.com/shkhln/linuxulator-steam-utils/blob/5ec9e681e97e0c797202f058210602c71e17e009/src/steamfix.c#L144). I just thought it would be nice to report this. (In reply to Theron Tarigo from comment #1) > Which would be the correct behavior? > ... > (2) Conditionally return x86_64 vs. i686 > on whether linux64 module is loaded. Is there any practical reason not to load linux64 in the first place?
Proposed patch: https://reviews.freebsd.org/D25248
Created attachment 215495 [details] Slightly improved test program
A commit references this bug: Author: trasz Date: Mon Jun 15 20:12:11 UTC 2020 New revision: 362205 URL: https://svnweb.freebsd.org/changeset/base/362205 Log: Make Linux uname(2) return x86_64 to 32-bit apps. This helps Steam. PR: kern/240432 Analyzed by by: Alex S <iwtcex@gmail.com> Reviewed by: emaste MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25248 Changes: head/sys/compat/linux/linux_misc.c
A commit references this bug: Author: trasz Date: Mon Aug 24 12:54:20 UTC 2020 New revision: 364668 URL: https://svnweb.freebsd.org/changeset/base/364668 Log: MFC r362205: Make Linux uname(2) return x86_64 to 32-bit apps. This helps Steam. PR: kern/240432 Analyzed by: Alex S <iwtcex@gmail.com> Sponsored by: The FreeBSD Foundation Changes: _U stable/12/ stable/12/sys/compat/linux/linux_misc.c