Sometimes boot issues are posted here on L1T, so decided to clarify things a bit regarding EFI / UEFI issues.
(Not an expert on the subject, nor do i need to be. When sometimes considering the levels of expertise on this forum) No pun intended. (Anyone welcome with their input) Let’s get into it.
So there are SEVERAL levels of usage of both EFI and UEFI. (Let’s stick to UEFI in this thread) It’s not and or if, necessarily. As there are options in BIOS settings to choose whether or not to activate UEFI boot or sometimes in description is called (Booting In Order With Windows OS Compliance).
By selecting to boot with UEFI and if pki keys are loaded correctly, it will then make sure that the machine boots in accordance with the loaded keys. It won’t allow changes outside of the loaded default keys which should be unique to that particular device / machine.
Again by selecting the UEFI boot option it’s possible to load a UEFI compliant operating system. If the booted operating system is not ALLOWED to load, then you can be sure that it’s because of the operating system that is somehow not loading in the way that the UEFI declares it should.
That does NOT mean that a UEFI / EFI boot isn’t possible. It’s still possible although not on a hardware BIOS level (As it should) Instead, (correct me if wrong) It loads the EFI / UEFI on a SOFTWARE level on the NVRAM on the device. Thereby essensitially STILL using some form of booting protection on a software level as opposed to hardware level (Which should be preferred)
( Point Of Thread Incoming ) Seen many threads regarding this subject matter and many if not all talk about EFI / UEFI being activated versus deactivated. What i haven’t seen is that it can also be used on a software NVRAM level of the device. Thereby not necessarily needing hardware BIOS compliancy
Maybe you mean to differentiate CMS (BIOS Compatibility) from uEFI? uEFI does not require keys to boot. That is a feature of uEFI called Secure Boot. That can be toggled on and off at will on most enthusiast hardware. There was a time when laptops came with that turned on and the only keys it had were to boot MS Windows. IE, you could not load an alternative OS on the laptop because Secure Boot was locked and the vendor did not give an option to turn it off.
**Edit
CMS Existed (maybe still exists) because uEFI need hardware that could speak uEFI to confidently boot and also display what their boot options are. Most uEFI aware devices had an onboard ePROM to deal with this.
Exactly, it does not require keys in hardware. It may virtualize keys in software instead. To boot if secure-boot is set to un-toogled. If not, it does require motherboard keys for secure-boot UEFI compliancy.
If secure-boot is disabled and CMS is NOT enabled. It will then usually use the secure-boot feature on a software NVRAM level instead. Thereby still using the same feature in software.
Forgot to add about CMS. Thanks. It has to be set to disabled to enable secure-boot in software mode. Otherwise the system might override the feature entirely, if CMS is enabled.
Is that a newer feature? My board does not do this. ASUS Sabertooth 990FX r2. Granted I don’t have anything like PSP or IME so, I could just be ignorant on this front.
I also finished my thought on CMS… I got interrupted.
It’s not a ‘newer’ feature as such. It happens on any given system, with the specified values enabled / disabled. It’s just not mentioned or ‘talked about’ let alone a popular topic.
Then again, it can also depend if some entity deems it reasonable for an end-user to know about. (For example manufacturer)
So it’s the operating system that handles these kind of features for any given device. The process is automated.
The Gnu / Linux system uses EFI folders on a boot partition (Probably not sandboxed? idk but still)
Same with MacOS (Although MacOS virtualizes the process in a NVRAM container / sandbox, on a usb stick for example before being loaded unto the system partition, say example hackintosh)
Think of Secure Boot as just a signed code enforcement option. When toggled on it verifies the bootloader has been signed with the private key that corresponds to a public key stored in UEFI NVRAM. If signature validation passes, the bootloader is allowed to boot. If it fails, then the motherboard will not proceed in the boot process.
CSM is an emulated boot mode that’s backward compatible with legacy BIOS mode. CSM mode does not support Secure Boot.
All UEFI compliant OSs use the EFI file system including Microsoft.
Oracle has some great documentation that breaks down the UEFI boot process, including Secure Boot and signed boot shims.
Well said. That sound very likely to closer to the actual booting procedure.
Stop taking things out of context, to add something of your own. If you want to add something add the entire line. In case you DIDN’T know that either, here’s what it looks like:
That does not answer whether or not it’s virtualized or sandboxed, which was what the question was.
Sorry man. I should had articulated better in my point. Was trying to convey that CSM and Secure Boot are mutually exclusive.
Nothing is sand boxed or virtualized on the EFI system partition. Linux protects the filesystem by requiring root privileges to make changes, but otherwise there are no other protections in place for the filesystem. This is why Secure Boot is so important. It’s trivial to write a new boot image to the partition..
Ah ok. Suddenly i had this idea that NVRAM “filesystem” where boot options are stored could be stuffed with things like e.g. uboot or custom ipxe or similar that could fetch kernels over mTLS https or something…
Not sure how much space is there and if there’s limitations on use. (don’t really care about windows, but would prefer to get the kernel somehow).
This might not be the terminology that the UEFI (or previously EFI) specification uses, but for the average user, the boot mechanism basically has these three options:
Legacy OS support (CSM, BIOS-emulating), using executable code in a drive’s MBR
EFI mode, using PE/COFF executable file (*.efi) specified via either:
BootOrder/BootNext entry in NVRAM variables (see efibootmgr on Linux)
removable media behaviour - the default location, \EFI\BOOT\BOOT{arch}.EFI, in a drive’s ESP (EFI System Partition)
I am potentially leaving out network booting (though it could just be a different type of BootOrder/BootNext entry) as well as executing a PE/COFF file directly from the EFI shell (which not every firmware includes).
As @Four0Four mentioned, legacy/CSM behaviour cannot be signed, there is no file to sign after all, whereas the PE/COFF files used in EFI mode can be signed. Signatures are verified against keys in NVRAM. These signature keys are loaded by the OEM, the operating system, or a user.
I have no idea what you mean by either of these.
EFI firmware code is just as much software as an operating system is; it runs on the same CPU cores, but is loaded from EEPROM rather than a normal block storage device (SATA/SAS/NVMe drive, optical disc, USB).
I have read a fair amount about EFI/UEFI, but I have never heard about an “NVRAM level” nor this phantom secure-boot state you appear to be describing.
This too makes no sense; Mac OSX/macOS uses the same ESP (EFI System Partition) structure that everyone else uses. I have never heard of anything remotely close to sandboxing or virtualisation in any firmware implementing EFI/UEFI.
Are you thinking of the T2 chip on recent Intel Macs? T2 definitely changes the boot process on those Macs, but it is not a “sandboxed” mode, it is a completely separate ARM chip that checks the UEFI firmware before it is loaded by the CPU, before the CPU even turns on.
If secure-boot is disabled or set to other OS and CMS in NOT enabled. The operating system can still run the Secure-Boot feature and other security measures from the operating system itself.
The operating system CANNOT use the secure-boot feature, or the secure-boot measures it has, if CMS option is enabled in bios. (For CMS compatibility reasons)
What i’m describing is not a “Phantom secure-boot per-say” It’s still what looks like some sort of secure-boot feature from BIOS, but can also simply be security measures that are otherwise not allowed. For compatibility reasons. Again this is not possible, If the CMS BIOS option is set to enabled.
The MacOS part, uses the EFI it’s installed upon (Example a usb-key) that runs the ESP / EFI code from the usb-key itself, which also makes it bootable.
The MacOS EFI also contains the NVRAM requirements on the usb. Otherwise without the virtualized NVRAM option for a hackintosh boot, wouldn’t work. And by transferring the EFI from the MacOS usb-key to the installed operating system, the usb-key is no longer needed to boot into the MacOS hackintosh system.
You seem to be trying to describe security measures besides the code signing protections that UEFI provides. What security measures are you talking about? Please describe what they do.
The emulated NVRAM you are describing is not part of actual UEFI firmware, it appears to be a hackintosh workaround to fake the existence of features that macOS expects to find on genuine Apple hardware. It is probably being implemented as an EFI executable that is run from the ESP.
Normal:
UEFI Firmware [in EEPROM] → OS [in drive partition]
Hackintosh (from what I can tell):
UEFI Firmware [in EEPROM] → OpenCore [in drive partition] → OS [in drive partition]
You will not find NVRAM emulation in any normal UEFI firmware.
Exactly. Can’t describe the actual process, from what i could tell it’s seems similar to some sort of secure-boot process (From the looks of it) What actual code is and what’s it’s doing? I do not know that.
Another interesting thing about BIOS settings on older motherboards in comparison to newer boards, is that the BIOS secure-boot options can be set to DISABLED on older motherboards. (Disabling the feature, entirely) As opposed to being set to the OTHER OS option on newer motherboards. (Which should still allow to run some safety-measures from the selected OTHER OS option)
Yes yes, very correct.
Although i didn’t actually say anywhere, that the UEFI firmware handles the supposed NVRAM emulation.
No because the PE/COFF file in the ESP is not necessarily a bootloader. For example, Linux users can use EFIstub to directly load the kernel from EFI without GRUB or any other intermediaries.
So how do you know it exists? Is this in a particular motherboard’s documentation? If so could you link us the support page and manual so we could read up on it?
This could be just a naming change for the particular board OEM or firmware developer (ex: AMI, Insyde, Phoenix). If I look at UEFI Specification version 2.9, page 86 (161rd page in the PDF), the description of the SecureBoot variable does not leave room for a partially-on state; so when booting via this “Other OS” option you describe, SecureBoot will be 0; unless the UEFI firmware changes it back to 1 on the next boot.