From: John Wolfe Date: Tue, 21 Jul 2020 18:53:00 +0000 (-0700) Subject: hostinfoPosix: remove NOT_IMPLEMENTED() when NO_IOPL X-Git-Tag: stable-11.2.0~124 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=695611c22bb41a50abf71850ebc69de5ee415b09;p=thirdparty%2Fopen-vm-tools.git hostinfoPosix: remove NOT_IMPLEMENTED() when NO_IOPL When running "vmtoolsd -b pidfile" on Linux arm64, we hit this error: [error] [vmsvc] NOT_IMPLEMENTED hostinfoPosix.c:2526 Linux arm64 does not implement iopl() and the Hostinfo_ResetProcessState() is raising a NOT_IMPLEMENTED() because of that. However if there's no iopl(), there is no reason to drop IO privileges, so we can just skip that code. This change also restores usage of getloadavg() for non Android arm64 platforms: ESX vmx and tools for Linux arm64. --- diff --git a/open-vm-tools/lib/misc/hostinfoPosix.c b/open-vm-tools/lib/misc/hostinfoPosix.c index fbccdf39c..700bf3d9e 100644 --- a/open-vm-tools/lib/misc/hostinfoPosix.c +++ b/open-vm-tools/lib/misc/hostinfoPosix.c @@ -245,12 +245,18 @@ DetailedDataField detailedDataFields[] = { #if defined __ANDROID__ || defined __aarch64__ /* - * Android doesn't support getloadavg() or iopl(). + * Android and arm64 do not support iopl(). */ -#define NO_GETLOADAVG #define NO_IOPL #endif +#if defined __ANDROID__ +/* + * Android doesn't support getloadavg(). + */ +#define NO_GETLOADAVG +#endif + /* *---------------------------------------------------------------------- @@ -2526,6 +2532,7 @@ Hostinfo_ResetProcessState(const int *keepFds, // IN: } #ifdef __linux__ +#ifndef NO_IOPL /* * Drop iopl to its default value. * iopl() is not implemented in userworlds @@ -2539,16 +2546,12 @@ Hostinfo_ResetProcessState(const int *keepFds, // IN: privileges --hpreg */ ASSERT(euid != 0 || getuid() == 0); Id_SetEUid(0); -#if defined NO_IOPL - NOT_IMPLEMENTED(); - errno = ENOSYS; -#else err = iopl(0); -#endif Id_SetEUid(euid); VERIFY(err == 0); } #endif +#endif }