From 3d8dd98381853976c5d8b31dc4931e5732f2e43d Mon Sep 17 00:00:00 2001 From: Edward Tomasz Napierala Date: Mon, 15 Jun 2020 20:12:10 +0000 Subject: [PATCH] Make Linux uname(2) return x86_64 to 32-bit apps. This helps Steam. PR: kern/240432 Analyzed by by: Alex S Reviewed by: emaste MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25248 --- sys/compat/linux/linux_misc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index 517365c7b01e..72a7d5555907 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -704,7 +704,17 @@ linux_newuname(struct thread *td, struct linux_newuname_args *args) *p = '\0'; break; } +#if defined(__amd64__) + /* + * On amd64, Linux uname(2) needs to return "x86_64" + * for both 64-bit and 32-bit applications. On 32-bit, + * the string returned by getauxval(AT_PLATFORM) needs + * to remain "i686", though. + */ + strlcpy(utsname.machine, "x86_64", LINUX_MAX_UTSNAME); +#else strlcpy(utsname.machine, linux_kplatform, LINUX_MAX_UTSNAME); +#endif return (copyout(&utsname, args->buf, sizeof(utsname))); }