-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Buffer Too Small" when loading initrd from ext2 partition #38
Comments
I suggest you recompile EfiFs and add extra debug information in From what I can see, the kernel ( Per the UEFI Specs (Section 13.5 File Protocol), an application calling Note that, because we always do request a buffer that can accommodate a file size of MAX_PATH which one may see as overreaching, nowhere in the UEFI specs is it implied that the buffer size for So my guess is that whoever wrote your bootloader may have taken a shortcut and allocated a buffer for For the record, here's what I believe happens:
|
Thanks a lot for your time and suggestions. The boot loader in question is systemd-boot, which just recently got the ability to load EFI drivers. The only reference to I will try adding some debug info where you've suggested next week, thanks for the pointer. |
Okay. The other possibility is that So the other place that will return a The fact that we get What makes no sense however is that the systemd code does have a proper retry for
from your log, which we don't... Considering that it doesn't come from the systemd code you pointed to, I'm starting to think that the Most likely, the problem is located in the Linux kernel EFI Stub and how it handles |
Yup, here's your issue, and it's a pure kernel one: #define MAX_FILENAME_SIZE 256
(...)
struct finfo {
efi_file_info_t info;
efi_char16_t filename[MAX_FILENAME_SIZE];
};
info_sz = sizeof(struct finfo);
status = fh->get_info(fh, &info_guid, &info_sz, fi);
if (status != EFI_SUCCESS) {
efi_err("Failed to get file info\n");
fh->close(fh);
return status;
} And whereas EfiFs officially uses the same So the size of the buffer we request is 2 bytes larger than the fixed size buffer the kernel can accommodate, and thus the kernel bails out... |
Now, one way I could "fix" this in EfiFs is reduce the size of However, I think the kernel should really fix their |
Thanks! This is awesome research. I will try to apply suggested fixes to both kernel and efifs and see what helps. |
I'm going to push v1.9 of EfiFs which should sort the EFI Stub issue (by making sure that our buffer is the same size as the fixed size the kernel uses). This will close this issue as a result, but feel free to report if you find there's still an issue. |
@pbatard Thanks a lot! I've dropped v1.9 in place of v1.8 and it just works now. You're awesome! |
Excellent. Thanks for reporting back! |
While trying to make systemd-boot use these drivers to load initrd and kernel from custom XBOOTLDR partition, I get "Buffer Too Small" error when I try using ext2 with efifs driver instead of vfat for it. Is there some trick I'm missing for using these drivers?
You can reproduce my error by running
It's a NixOS system wrapped in QEMU VM in Docker image. Note that similar system that uses FAT boots just fine, even though it also loads
ext2_64.efi
driver:(you may omit
--device /dev/kvm
if you don't want containers to get access to it, but it will be slow)Both examples use the same version of everything, only the format of the boot drive differs.
In my previous attempts I managed to get more debug from systemd-boot:
it seems like it fails to get file information using this driver first, so "Buffer Too Small" might not be the root issue.
The text was updated successfully, but these errors were encountered: