summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2026-02-13 17:32:11 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2026-02-13 17:32:11 +0100
commit3d8b7be7a14f09b3d64a05a276deac5e42603145 (patch)
tree806d7e7ebd44a2ae25871b3cf900cbce2d06bc98
parent9523b61f4cfe8b70da8a8bac10c4332d96ec35cb (diff)
feat: kernel: net.efi: harderning and improvements.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
-rw-r--r--src/boot/modules/BootNet/BootNet.cc13
-rw-r--r--src/boot/src/HEL/AMD64/BootEFI.cc4
2 files changed, 14 insertions, 3 deletions
diff --git a/src/boot/modules/BootNet/BootNet.cc b/src/boot/modules/BootNet/BootNet.cc
index 34b8282b..bfb80d39 100644
--- a/src/boot/modules/BootNet/BootNet.cc
+++ b/src/boot/modules/BootNet/BootNet.cc
@@ -34,6 +34,17 @@ EXTERN_C Int32 BootNetModuleMain(Kernel::HEL::BootInfoHeader* handover) {
bootnet_read_ip_packet(inet, &inet_out);
+ if (!inet_out) {
+ writer.Write("BootNet: Not a packet, aborting.\r");
+ return kEfiFail;
+ }
+
+ if (inet_out->NB1 != 'O' || inet_out->NB1 != 'N' || inet_out->NB1 != 'E' ||
+ inet_out->NB1 != 'T') {
+ writer.Write("BootNet: Not a packet, aborting.\r");
+ return kEfiFail;
+ }
+
if (inet_out->Length < 1) {
writer.Write("BootNet: No executable attached to the packet, aborting.\r");
return kEfiFail;
@@ -115,4 +126,4 @@ STATIC Void bootnet_read_ip_packet(BOOTNET_INTERNET_HEADER inet,
kEfiProtocol->Stop(kEfiProtocol);
kEfiProtocol->Shutdown(kEfiProtocol);
-} \ No newline at end of file
+}
diff --git a/src/boot/src/HEL/AMD64/BootEFI.cc b/src/boot/src/HEL/AMD64/BootEFI.cc
index 54a66a51..9ef6d1ec 100644
--- a/src/boot/src/HEL/AMD64/BootEFI.cc
+++ b/src/boot/src/HEL/AMD64/BootEFI.cc
@@ -153,10 +153,10 @@ EFI_EXTERN_C EFI_API Int32 BootloaderMain(EfiHandlePtr image_handle, EfiSystemTa
free_pages -= 1024;
// Set bitmap to use the first free page region found.
- handover_hdr->f_BitMapStart = first_free_page;
+ handover_hdr->f_BitMapStart = first_free_page;
// Convert pages to bytes (assuming 4K pages) for bitmap size.
- handover_hdr->f_BitMapSize = free_pages * 4096;
+ handover_hdr->f_BitMapSize = free_pages * 4096;
handover_hdr->f_FirmwareCustomTables[Kernel::HEL::kHandoverTableBS] = (VoidPtr) BS;
handover_hdr->f_FirmwareCustomTables[Kernel::HEL::kHandoverTableST] = (VoidPtr) ST;