Bug 240432 - Linuxulator: uname (function) reports i686 machine to 32-bit executables on amd64
Summary: Linuxulator: uname (function) reports i686 machine to 32-bit executables on a...
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 12.0-RELEASE
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-emulation mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-09-09 05:35 UTC by Alex S
Modified: 2019-09-09 23:23 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex S 2019-09-09 05:35:15 UTC
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".
Comment 1 Theron Tarigo 2019-09-09 20:21:19 UTC
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.
Comment 2 Alex S 2019-09-09 23:23:45 UTC
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?