Bug #77357 [Opn->Fbk]: base64_encode / base64_decode doest not work on nested VM

From: Date: Thu, 03 Jan 2019 09:28:24 +0000
Subject: Bug #77357 [Opn->Fbk]: base64_encode / base64_decode doest not work on nested VM
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-218775@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77357&edit=1 ID: 77357 Updated by: nikic@php.net Reported by: hsiangjen at gmail dot com Summary: base64_encode / base64_decode doest not work on nested VM -Status: Open +Status: Feedback Type: Bug Package: *General Issues Operating System: Windows 2012R2 PHP Version: 7.3.0 Block user comment: N Private report: N New Comment: I've committed a possible fix at https://github.com/php/php-src/commit/5a361c3a54c055cdf7088e76aa8efa159334e096. If you could try a snapshot build with this change (once it is available at https://windows.php.net/snapshots/), that would be great. Previous Comments: ------------------------------------------------------------------------ [2019-01-03 09:19:37] nikic@php.net Okay, I think I see what the issue is. We're not using CPUID correctly. Here is (what I guess) is happening: * We're calling CPUID with EAX 7, which is above the maximum basic CPUID level of 4 supported by your CPU. * Per Intel instruction set reference, "If a value entered for CPUID.EAX is higher than the maximum input value for basic or extended function for that processor then the data for the highest basic information leaf is returned." * This means we get back the level 4 information. * AVX2 support if bit 5 of EBX at level 7, while bits 0-11 of EBX at level 4 are the System Cache Coherence Size minus one. As this is probably a power of 2 >= 64, bit 5 will be set. We should not be calling CPUID with values above the maximum basic function. ------------------------------------------------------------------------ [2019-01-03 09:08:02] spam2 at rhsoft dot net https://superuser.com/questions/453786/how-do-i-get-avx-support-in-qemu is about AVX not passed to the guest which in fact happens on your guest given "Instructions sets MMX, SSE, SSE2, SSE3, EM64T, VT-x" but in that case PHP must not use the instructions ------------------------------------------------------------------------ [2019-01-03 09:01:14] hsiangjen at gmail dot com Thank you for the help. I guess since I am under KVM virtual machine enviornment. The CPU AVX instruction does not passvia to the guest level by default. I will bootup a Linux guest machine to try it also. Maybe the isseu is like this: https://superuser.com/questions/453786/how-do-i-get-avx-support-in-qemu ------------------------------------------------------------------------ [2019-01-03 08:49:36] nikic@php.net Thanks, that does look more reasonable. We're crashing inphp7ts!php_base64_encode_avx2+82 with a 0xc000001d exception, i.e. illegal instruction. Clearly we're trying to execute an AVX2 instruction on a CPU that doesn't support it. The question is why... ------------------------------------------------------------------------ [2019-01-03 08:43:04] hsiangjen at gmail dot com I chagned order version of Debug Diagonstic tool (version 1.2) Here is the dump again. https://www.dropbox.com/s/00hjbnny4hcomai/CrashHang_Report__Date_01_03_2019__Time_04_40_55PM__58.mht?dl=0 Hope this will help more. Thank you. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=77357 -- Edit this bug report at https://bugs.php.net/bug.php?id=77357&edit=1

« previous php.bugs (#218775) next »