{"id":463,"date":"2018-03-21T22:56:27","date_gmt":"2018-03-21T22:56:27","guid":{"rendered":"http:\/\/www.redfelineninja.org.uk\/daniel\/?p=463"},"modified":"2018-04-11T19:52:20","modified_gmt":"2018-04-11T19:52:20","slug":"experimenting-with-64k-pages-for-aarch32-code","status":"publish","type":"post","link":"http:\/\/www.redfelineninja.org.uk\/daniel\/2018\/03\/experimenting-with-64k-pages-for-aarch32-code\/","title":{"rendered":"Experimenting with 64k pages for AArch32 code"},"content":{"rendered":"<p>Someone asked me about 64K pages and the AArch32 ABI again recently. It&#8217;s a question that has passed across my desk multiple times and even followed me through multiple companies. Given that long history, and the changes made to the Arm toolchains to ensure freshly built ELF binaries can be loaded, I was interested to see whether Debian 9 (Stretch) armhf userspace would on a machine with 64K pages. I also had access to a Developerbox to help me indulge my curiosity. The short answer is that it is *not* possible to boot Debian Stretch armhf container on a machine with 64k pages because the kernel cannot map the init process&#8230; but is only half the story; it really was very close to working!<\/p>\n<p><!--more--><\/p>\n<p>I put together a fairly spartan Debian rootfs (console only, no build tools). The resulting OS has 709 executables in \/bin, \/usr\/bin, \/sbin and \/usr\/sbin, of which 571 are 32-bit ELF executables (the rest are scripts). I then tried loading each one using ldd; ldd works internally by performing dynamic linking and loading but it does not jump to the actual entry point and instead calls into to some post-analysis tool to show where the libraries came from. It is a good proxy to test whether the executable could work with 64K pages and is gives a consistent output that makes it easy to run from a script.<\/p>\n<p>Of the 571 ELF executables, 46 cannot be mapped because they contain segments that are not (64K) page aligned. More interestingly the problems loading 46 executables boil down to just four libraries: libnfnetlink.so.0, libsystemd.so.0, libudev.so.1, and libXau.so.6. It is interesting that both libsystemd and libudev are part of systemd; makinng it likely there is just three packages left that prevent the use of 64K pages.<\/p>\n<p>Anyhow, that about it, except to observe that all the above stats were gathered by running a 32-bit chroot with 64k pages. \/sbin\/init might be broken but bash, grep, cut, ldd and a bunch of other common shell tools needed to do the above analysis all worked just fine!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Someone asked me about 64K pages and the AArch32 ABI again recently. It&#8217;s a question that has passed across my desk multiple times and even followed me through multiple companies. Given that long history, and the changes made to the Arm toolchains to ensure freshly built ELF binaries can be loaded, I was interested to &hellip; <a href=\"http:\/\/www.redfelineninja.org.uk\/daniel\/2018\/03\/experimenting-with-64k-pages-for-aarch32-code\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Experimenting with 64k pages for AArch32 code&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27,12,29,5],"tags":[],"class_list":["post-463","post","type-post","status-publish","format-standard","hentry","category-96boards","category-gnulinux","category-linaro","category-software"],"_links":{"self":[{"href":"http:\/\/www.redfelineninja.org.uk\/daniel\/wp-json\/wp\/v2\/posts\/463","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.redfelineninja.org.uk\/daniel\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.redfelineninja.org.uk\/daniel\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.redfelineninja.org.uk\/daniel\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.redfelineninja.org.uk\/daniel\/wp-json\/wp\/v2\/comments?post=463"}],"version-history":[{"count":4,"href":"http:\/\/www.redfelineninja.org.uk\/daniel\/wp-json\/wp\/v2\/posts\/463\/revisions"}],"predecessor-version":[{"id":468,"href":"http:\/\/www.redfelineninja.org.uk\/daniel\/wp-json\/wp\/v2\/posts\/463\/revisions\/468"}],"wp:attachment":[{"href":"http:\/\/www.redfelineninja.org.uk\/daniel\/wp-json\/wp\/v2\/media?parent=463"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.redfelineninja.org.uk\/daniel\/wp-json\/wp\/v2\/categories?post=463"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.redfelineninja.org.uk\/daniel\/wp-json\/wp\/v2\/tags?post=463"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}