Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 May 2021 13:26:09 +0200
From:      Harry Schmalzbauer <freebsd@omnilan.de>
To:        Konstantin Belousov <kostikbel@gmail.com>, Wei Hu <weh@microsoft.com>
Cc:        "freebsd-virtualization@freebsd.org" <freebsd-virtualization@freebsd.org>
Subject:   Re: FreeBSD 12.1 i386 on Hyper-V Fails to Mount Root
Message-ID:  <7986b561-dd26-a134-e76d-530900363deb@omnilan.de>
In-Reply-To: <22bbe4cd-82ed-b826-9ac0-05ef8aceba0e@omnilan.de>
References:  <CAHgj5TTKdiOU4bRu3SCBwKqnQaMqxUFynodh5MLBE7%2BycBiPYw@mail.gmail.com> <SG2P153MB0208B4185C3EB54120F10E74BB030@SG2P153MB0208.APCP153.PROD.OUTLOOK.COM> <c6013e67-4a37-43e1-4452-568d3ef6e5a7@omnilan.de> <ef85f9bb-ad8b-978e-da65-c887e8e8498e@omnilan.de> <PSAP153MB0440FD09AD1981FD569B7246BB2D9@PSAP153MB0440.APCP153.PROD.OUTLOOK.COM> <YKIDX/PjOlNc%2BtMa@kib.kiev.ua> <PSAP153MB0440A1511904E54767BF5344BB2D9@PSAP153MB0440.APCP153.PROD.OUTLOOK.COM> <YKIRelPB9wmtBzzo@kib.kiev.ua> <22bbe4cd-82ed-b826-9ac0-05ef8aceba0e@omnilan.de>

next in thread | previous in thread | raw e-mail | index | archive | help
Am 17.05.2021 um 11:39 schrieb Harry Schmalzbauer:
> Am 17.05.2021 um 08:47 schrieb Konstantin Belousov:
>> On Mon, May 17, 2021 at 06:33:19AM +0000, Wei Hu wrote:
>>>> -----Original Message-----
>>>> From: Konstantin Belousov <kostikbel@gmail.com>
>>>> Sent: Monday, May 17, 2021 1:47 PM
>>>> To: Wei Hu <weh@microsoft.com>
>>>> Cc: Harry Schmalzbauer <freebsd@omnilan.de>; Chris Knight
>>>> <stryqx@gmail.com>; freebsd-virtualization@freebsd.org
>>>> Subject: Re: FreeBSD 12.1 i386 on Hyper-V Fails to Mount Root
>>>>
>>>> On Mon, May 17, 2021 at 04:12:20AM +0000, Wei Hu wrote:
> :
> :
> :
>>>>> separately. The workaround for this on amd64 is either build these
>>>>> Hyper-V modules into the kernel or completely disable mitigation by
>>>>> setting vm.pmap.pti="0" in /boot/loader.conf in the affect FreeBSD 
>>>>> guests.
>>>>>
>
> Just to share some hopefully helpful pre-check's I've done so far:
>
> Disabling PTI via vm.pmap.pti="0" in /boot/loader.conf doesn't make 
> any difference for the i386 issue (at least x86/x86/local_apic.c 
> always uses non-pti path; tried nontheless, with identical result).
>
> As far as my analysis isn't completely wrong, the problem is about IDT 
> pointer.
> IDTVEC(rsvd) doesn't match in line 2180 of x86/x86/local_apic.c in 
> native_lapic_ipi_alloc():
> (ip->gd_hioffset << 16) | ip->gd_looffset;
>

I managed to setup an i386 vm with -current from 3 years ago (not the 
most straight forward task due to compiler infrastructure changes back 
then).
Up to r332488 vmbus(4) resp. hyperv(4) is working fine.
Updating r332488 to r332489 breaks like already described.

Since r332489 is a huge patch with lots of x86 art, the only chance I 
see, how this can be resolved, is with Konstantin's help.

I can just assure that I tracked it down to the single r332489 committ 
which makes vmbus(4) failing on i386.
Verification done:
- built/installed world&kernel on i386 HyV guest with r332488
   reboot fine.
- built/installed kernel on the same vm after svnlite up -r 332489
   reboot fails with "vmbus0: cannot find free IDT vector"
- loaded kernel.old/kernel, did revert 332489, by 'svnlite up -r 332488' 
and compiled/reinstalled kernel (again r332488)
   reboot fine.

I tried to revert r332489 on stable/13 but failed due to lots of 
conflicting changes (including CVE driven) affecting the same area.

To summarize: r332489 only breaks i386 native_lapic_ipi_alloc(), amd64 
is not affected (but haven't checked if PTI has any influence on amd64).
The effect is 100% reproducable.
Happy to test any suggestion or debug extension!

Thanks,
-harry







Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7986b561-dd26-a134-e76d-530900363deb>