{"id":96044,"date":"2025-07-27T06:29:09","date_gmt":"2025-07-27T06:29:09","guid":{"rendered":"https:\/\/www.europesays.com\/us\/96044\/"},"modified":"2025-07-27T06:29:09","modified_gmt":"2025-07-27T06:29:09","slug":"linux-6-17-looks-to-address-an-old-obscure-kernel-limitation-from-1993","status":"publish","type":"post","link":"https:\/\/www.europesays.com\/us\/96044\/","title":{"rendered":"Linux 6.17 Looks To Address An Old &#038; Obscure Kernel Limitation From 1993"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" alt=\"LINUX KERNEL\" src=\"https:\/\/www.europesays.com\/us\/wp-content\/uploads\/2025\/07\/linuxkernel.webp.webp\" width=\"100\" height=\"100\"\/><br \/>\nAssuming no objections are raised by Linus Torvalds, an early pull request has been submitted for the upcoming <a href=\"https:\/\/www.phoronix.com\/search\/Linux+6.17\" target=\"_blank\" rel=\"noopener\">Linux 6.17<\/a> merge window to address an obscure kernel limitation that has been in place going back  all the way to 1993 during the Linux v0.99 kernel days.<\/p>\n<p>A Linux engineer working at Alibaba recently reported on a script-generated Assembly file that when built by the GCC compiler and running as an ELF file would cause odd problems. This ELF file would fail to run on Linux AArch64\/ARM64 if using the standard 4K page size kernel due to an &#8220;exec format error&#8221;. But if using <a href=\"https:\/\/www.phoronix.com\/review\/ampereone-64k-linux611\" target=\"_blank\" rel=\"noopener\">the modern 64K page size for ARM64<\/a>, this ELF file would work just fine.&#13;\n<\/p>\n<p>The Alibaba engineer <a href=\"https:\/\/lore.kernel.org\/linux-mm\/sxokzxpo74u7yhrhfrmgtdvkpshwl464jicrwwkwtvkwl5d5dj@fqto77h2prj2\/\" target=\"_blank\" rel=\"noopener\">noted<\/a> that within one of the load ELF functions in the kernel was a check to see if the size was greater than ELF_MIN_ALIGN \/ PAGE_SIZE and bail out if that is the case, which it was given the number of program headers in this particular ELF file. But it wasn&#8217;t clear why this check was in place. If removing this kernel check the particular binary file ran fine on a 4K page size kernel.&#13;<br \/>\n<\/p>\n<p align=\"center\"><img decoding=\"async\" src=\"https:\/\/www.europesays.com\/us\/wp-content\/uploads\/2025\/07\/1753597749_912_image\" alt=\"The code change\"\/><\/p>\n<p>Longtime Linux developer Kees Cook dug through the old pre-Git code to try to figure it out. He <a href=\"https:\/\/lore.kernel.org\/linux-mm\/202506270854.A729825@keescook\/\" target=\"_blank\" rel=\"noopener\">explained<\/a>:<br \/>\n<\/p>\n<blockquote><p>&#8220;Looking through https:\/\/git.kernel.org\/pub\/scm\/linux\/kernel\/git\/history\/history.git (which doesn&#8217;t have linked history, so you have to examine explicit &#8220;pre git&#8221; tags), I see:&#13;<\/p>\n<p>4779b38bcb96 (&#8220;[PATCH] Linux-0.99.13 (September 19, 1993)&#8221;) Which says &#8220;ELF binary support it a notable change.&#8221; Here, the PAGE_SIZE&#13;<br \/>\n<br \/>check does not exist. When ELF interp support was added in 9e11983a5a3e (&#8220;Import 0.99.15f&#8221;), we see the check appear, and I can&#13;<br \/>\n<br \/>find no rationale.&#13;\n<\/p>\n<p>And with 6a8d38945cf4 (&#8220;binfmt_elf: Hoist ELF program header loading to a function&#8221;), the PAGE_SIZE check is _added_ for non-interp loads.&#13;\n<\/p>\n<p>It seems the 64K count limit is sufficient? (If the goal was to avoid large memory allocations happening from userspace, we&#8217;re way past PAGE_SIZE these days between IPC, BPF, etc.) Does this work for you?&#8221;<\/p>\n<\/blockquote>\n<p>So now for Linux 6.17 is <a href=\"https:\/\/lore.kernel.org\/lkml\/20250717110108.55586-1-fengwei_yin@linux.alibaba.com\/\" target=\"_blank\" rel=\"noopener\">a patch<\/a> to drop the 4K limitation of the program header size.<br \/>\n<\/p>\n<blockquote><p>&#8220;We have assembly code generated by a script. GCC successfully compiles it. However, the kernel cannot load it on an ARM64 platform with a 4K page size. In contrast, the same ELF file loads correctly on the same platform with a 64K page size.&#13;<\/p>\n<p>The root cause is the Linux kernel&#8217;s ELF_MIN_ALIGN limitation on the program headers of ELF files. The ELF file contains 78 program headers (the script inserts many holes when generating the assembly code). On ARM64 with a 4K page size, the ELF_MIN_ALLIGN enforces a maximum of 74 program headers, causing the ELF file to fail. However, with a 64K page size, the ELF_MIN_ALIGN is relaxed to over 1,184 program headers, allowing the file to run correctly.&#13;\n<\/p>\n<p>Cook kindly identified that this limitation was introduced in Linux-0.99.15f without an explanation for its purpose.&#13;\n<\/p>\n<p>The ELF specification does not impose such a restriction on program headers. Removing the ELF_MIN_ALIGN limitation on program headers to align with the ELF spec. After removing ELF_MIN_ALIGN limitation, 64K size limitation still exist which should be sufficient.&#8221;<\/p>\n<\/blockquote>\n<p>That patch was sent in as part of the <a href=\"https:\/\/lore.kernel.org\/lkml\/202507261437.F2079B3B7@keescook\/\" target=\"_blank\" rel=\"noopener\">execve changes<\/a> for Linux 6.17. Assuming no issues discovered from Linus Torvalds himself, this fix should be merged once the Linux 6.17 merge window opens&#8230; Which will be as soon as Monday assuming Linux 6.16 goes as planned on Sunday.<\/p>\n","protected":false},"excerpt":{"rendered":"Assuming no objections are raised by Linus Torvalds, an early pull request has been submitted for the upcoming&hellip;\n","protected":false},"author":3,"featured_media":96045,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[52124,52123,52121,52120,52127,52125,52122,52126,52119,52130,158,52128,52129,67,132,68],"class_list":{"0":"post-96044","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-technology","8":"tag-desktop-linux","9":"tag-linux-benchmarking","10":"tag-linux-hardware-benchmarks","11":"tag-linux-hardware-reviews","12":"tag-linux-how-to","13":"tag-linux-performance","14":"tag-linux-server-benchmarks","15":"tag-open-source-graphics","16":"tag-phoronix","17":"tag-phoronix-test-suite","18":"tag-technology","19":"tag-ubuntu-benchmarks","20":"tag-ubuntu-hardware","21":"tag-united-states","22":"tag-unitedstates","23":"tag-us"},"share_on_mastodon":{"url":"https:\/\/pubeurope.com\/@us\/114923789636108722","error":""},"_links":{"self":[{"href":"https:\/\/www.europesays.com\/us\/wp-json\/wp\/v2\/posts\/96044","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.europesays.com\/us\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.europesays.com\/us\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.europesays.com\/us\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.europesays.com\/us\/wp-json\/wp\/v2\/comments?post=96044"}],"version-history":[{"count":0,"href":"https:\/\/www.europesays.com\/us\/wp-json\/wp\/v2\/posts\/96044\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.europesays.com\/us\/wp-json\/wp\/v2\/media\/96045"}],"wp:attachment":[{"href":"https:\/\/www.europesays.com\/us\/wp-json\/wp\/v2\/media?parent=96044"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.europesays.com\/us\/wp-json\/wp\/v2\/categories?post=96044"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.europesays.com\/us\/wp-json\/wp\/v2\/tags?post=96044"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}