{"id":1403,"date":"2026-03-27T15:03:21","date_gmt":"2026-03-27T06:03:21","guid":{"rendered":"https:\/\/pg-mana.net\/blog\/?p=1403"},"modified":"2026-03-27T15:03:21","modified_gmt":"2026-03-27T06:03:21","slug":"musl-libc-mmap","status":"publish","type":"post","link":"https:\/\/pg-mana.net\/blog\/musl-libc-mmap\/","title":{"rendered":"musl libc\u306e\u6319\u52d5\u3092\u8ffd\u3044\u304b\u3051\u3066"},"content":{"rendered":"\n<p>\u81ea\u4f5cOS\u306eMethylenix\u306e\u4e0a\u3067busybox\u306einit\u3092\u52d5\u304b\u305d\u3046\u3068\u3057\u3066\u3044\u305f\u6642\u306b\u906d\u9047\u3057\u305f\u8a71\u3067\u3059\u3002<\/p>\n\n\n\n<p>busybox\u306f\u30e6\u30fc\u30b6\u30fc\u30e9\u30f3\u30c9\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u305f\u3081\u3001hlt\u547d\u4ee4\u306f\u5b9f\u884c\u3067\u304d\u306a\u3044\u306f\u305a\u306a\u306e\u306b\u3001busybox\u304chlt\u3092\u5b9f\u884c\u3057\u3088\u3046\u3068\u3057\u3066OS\u306b\u30c8\u30e9\u30c3\u30d7\u3055\u308c\u308b\u3001\u3068\u3044\u3046\u72b6\u614b\u3067\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u6700\u521d\u306f\u547d\u4ee4\u304c\u3046\u307e\u304f\u30e1\u30e2\u30ea\u306b\u5c55\u958b\u3055\u308c\u3066\u3044\u306a\u3044\u306e\u304b\u3068\u601d\u3044\u307e\u3057\u305f\u304c\u3001objdump\u3067\u30c0\u30f3\u30d7\u3057\u3066\u3082\u8a72\u5f53\u30a2\u30c9\u30ec\u30b9\u306bhlt\u547d\u4ee4\u304c\u7f6e\u304b\u308c\u3066\u3044\u308b\u305f\u3081\u3001\u3084\u306f\u308a\u610f\u56f3\u3057\u305f\u5b9f\u884c\u306e\u3088\u3046\u3067\u3059\u3002<\/p>\n\n\n\n<p>busybox\u306e\u30b3\u30fc\u30c9\u3067\u306f\u306a\u304f\u3001musl libc\u306e\u65b9\u3067\u4f55\u304b\u3057\u3066\u3044\u308b\u3068\u601d\u3063\u305f\u305f\u3081\u3001hlt\u3067grep\u3057\u305f\u3068\u3053\u308d\u3001<a href=\"https:\/\/git.musl-libc.org\/cgit\/musl\/tree\/arch\/x86_64\/atomic_arch.h?h=v1.2.5&amp;id=0784374d561435f7c787a555aeab8ede699ed298#n108\">crash\u6642\u306bhlt\u3092\u5b9f\u884c\u3057\u3066\u3044\u308b<\/a>\u3053\u3068\u304c\u5206\u304b\u308a\u307e\u3057\u305f\u3002<br>libc\u306e\u4e2d\u3067exit\u3092\u547c\u3076\u4f59\u529b\u3082\u7121\u3044\u969b\u306b\u306f\u3001\u4e0d\u6b63\u306a\u547d\u4ee4\u3092\u767a\u884c\u3057\u3066OS\u306b\u30c8\u30e9\u30c3\u30d7\u3057\u3066\u3082\u3089\u3046\u3088\u3046\u3067\u3059\u3002\u3061\u306a\u307f\u306bAArch64\u306e\u540c\u3058\u30d5\u30a1\u30a4\u30eb\u306b\u306f<code>a_crash<\/code>\u95a2\u6570\u306f\u5b9a\u7fa9\u3055\u308c\u3066\u304a\u3089\u305a\u3001<a href=\"https:\/\/git.musl-libc.org\/cgit\/musl\/tree\/src\/internal\/atomic.h?h=v1.2.5&amp;id=0784374d561435f7c787a555aeab8ede699ed298#n250\">nullptr\u66f8\u304d\u8fbc\u307f\u3067\u30af\u30e9\u30c3\u30b7\u30e5\u3059\u308b<\/a>\u6c4e\u7528\u7684\u306a\u65b9\u6cd5\u304c\u53d6\u3089\u308c\u3066\u3044\u307e\u3059\u3002\u306a\u305cx86\u306fhlt\u306a\u306e\u304b\u3001CISC\u3060\u304b\u30891\u30d0\u30a4\u30c8\u547d\u4ee4\u306b\u3057\u305f\u304b\u3063\u305f\u306e\u304b\u3001\u3067\u3082\u306a\u3093\u3067hlt\u306a\u3093\u3060\u308d\u3046\u304b\u3001ud2\u3084int3\u3058\u3083\u99c4\u76ee\u3060\u3063\u305f\u3093\u3060\u308d\u3046\u304b\u3001\u306a\u3069\u8272\u3005\u601d\u3046\u3068\u3053\u308d\u306f\u3042\u308a\u307e\u3059\u304c\u3001\u3068\u308a\u3042\u3048\u305amusl libc\u3067crash\u3057\u3066\u3044\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>musl libc\u306b\u3072\u305f\u3059\u3089<code>puts<\/code>\u3092\u5165\u308c\u3066\u30c7\u30d0\u30c3\u30b0\u3057\u3066\u307e\u3057\u305f\u304c\u3001\u305d\u308c\u3088\u308a\u3082QEMU\u3067\u52d5\u304b\u3057\u3066\u3044\u308b\u306e\u3067gdb\u304c\u4f7f\u7528\u3067\u304d\u308b\u3053\u3068\u3092\u601d\u3044\u51fa\u3057\u3066\u3001\u8a72\u5f53\u547d\u4ee4\u306e\u30a2\u30c9\u30ec\u30b9\u306bbreakpoint\u3092\u304a\u3044\u3066\u307f\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#0  a_crash () at .\/arch\/x86_64\/atomic_arch.h:108\n#1  enframe (g=0x4e0090, idx=0, n=2028, ctr=1) at src\/malloc\/mallocng\/meta.h:205\n#2  alloc_group (sc=19, req=&lt;optimized out>) at src\/malloc\/mallocng\/malloc.c:290\n#3  alloc_slot (sc=sc@entry=19, req=&lt;optimized out>) at src\/malloc\/mallocng\/malloc.c:314\n#4  0x000000000040d8a3 in alloc_group (sc=15, req=&lt;optimized out>) at src\/malloc\/mallocng\/malloc.c:282\n#5  alloc_slot (sc=sc@entry=15, req=&lt;optimized out>) at src\/malloc\/mallocng\/malloc.c:314\n#6  0x000000000040d8a3 in alloc_group (sc=2, req=48) at src\/malloc\/mallocng\/malloc.c:282\n#7  alloc_slot (sc=sc@entry=2, req=req@entry=40) at src\/malloc\/mallocng\/malloc.c:314\n#8  0x000000000041a81e in __libc_malloc_impl (n=40) at src\/malloc\/mallocng\/malloc.c:407<\/code><\/pre>\n\n\n\n<p>\u306a\u308b\u307b\u3069\u3001<code>malloc<\/code>\u306e\u4e2d\u3067<code>enframe<\/code>\u95a2\u6570\u3092\u547c\u3093\u3067\u843d\u3061\u3066\u3044\u308b\u3088\u3046\u3067\u3059\u3002<a href=\"https:\/\/git.musl-libc.org\/cgit\/musl\/tree\/src\/malloc\/mallocng\/meta.h?h=v1.2.5&amp;id=0784374d561435f7c787a555aeab8ede699ed298#n205\">\u95a2\u6570\u306e\u5b9f\u88c5<\/a>\u3092\u898b\u308b\u3068<code>mmap<\/code>\u3067\u3082\u3089\u3063\u3066\u304d\u305f\u30e1\u30e2\u30ea\u306e\u4e2d\u3067\u30e1\u30e2\u30ea\u30d6\u30ed\u30c3\u30af\u3092\u4f5c\u308d\u3046\u3068\u3057\u3066\u3044\u308b\u969b\u306b\u3001\u30e1\u30e2\u30ea\u304c\u975e\u30bc\u30ed\u306e\u969b\u306b\u30af\u30e9\u30c3\u30b7\u30e5\u3059\u308b\u3088\u3046\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u6700\u521d\u306fmusl libc\u306e\u30ed\u30b8\u30c3\u30af\u304c\u81ea\u4f5cOS\u4e0a\u3067\u72c2\u3063\u3066\u3044\u308b\u306e\u304b\u3068\u601d\u3044\u307e\u3057\u305f\u304c\u3001Linux\u4e0a\u3067\u3082\u81ea\u4f5cOS\u4e0a\u3067\u3082\u95a2\u6570\u306e\u901a\u308b\u9053\u306f\u540c\u3058\u3067\u3001\u6700\u521d\u306e\u5b9f\u884c\u6642\u306b\u81ea\u4f5cOS\u4e0a\u3060\u3051\u30af\u30e9\u30c3\u30b7\u30e5\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p><code>enframe<\/code>\u95a2\u6570\u4ee5\u524d\u3067<code>p[-3]<\/code>\u306b\u66f8\u304d\u8fbc\u3093\u3067\u3044\u308b\u30b3\u30fc\u30c9\u306f\u898b\u6e21\u3059\u9650\u308a\u3044\u307e\u305b\u3093\u3002\u3068\u3059\u308b\u3068\u3001\u3053\u306e\u30e1\u30e2\u30ea\u9818\u57df\u306e\u521d\u671f\u5024\u304c\u30bc\u30ed\u3067\u3042\u308b\u3053\u3068\u3092\u671f\u5f85\u3057\u3066\u304a\u308a\u3001musl libc\u3067\u306f<code>mmap(2)<\/code> syscall\u306e\u8fd4\u3057\u305f\u30e1\u30e2\u30ea\u3092\u30bc\u30ed\u30af\u30ea\u30a2\u3057\u3066\u3044\u308b\u3068\u3053\u308d\u306f\u898b\u304b\u3051\u307e\u305b\u3093\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/manpages.ubuntu.com\/manpages\/noble\/ja\/man2\/munmap.2.html\">mmap(2)\u306eman<\/a>\u3092\u8aad\u3080\u3068\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u8a18\u8ff0\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<pre class=\"wp-block-preformatted\"> <strong>MAP_ANONYMOUS<\/strong><br>\u30de\u30c3\u30d4\u30f3\u30b0\u306f\u3069\u306e\u30d5\u30a1\u30a4\u30eb\u3068\u3082\u95a2\u9023\u4ed8\u3051\u3055\u308c\u306a\u3044\u3002  \u30de\u30c3\u30d4\u30f3\u30b0\u306e\u5185\u5bb9\u306f 0 \u3067\u521d\u671f\u5316\u3055\u308c\u308b\u3002<\/pre>\n<\/blockquote>\n\n\n\n<p>\u8fd4\u5374\u3055\u308c\u308b\u30e1\u30e2\u30ea\u30a2\u30c9\u30ec\u30b9\u306fOS\u306b\u3088\u3063\u3066\u30bc\u30ed\u30af\u30ea\u30a2\u3055\u308c\u308b\u3053\u3068\u304c\u898f\u5b9a\u3055\u308c\u3066\u304a\u308a\u3001musl libc\u306f\u3053\u306e\u898f\u5b9a\u306b\u4f9d\u5b58\u3057\u3066\u3044\u305f\u308f\u3051\u3067\u3059\u306d\u3002OS\u3067\u30bc\u30ed\u30af\u30ea\u30a2\u3057\u305f\u3068\u3053\u308d\u3001\u30af\u30e9\u30c3\u30b7\u30e5\u305b\u305a\u306b\u51e6\u7406\u304c\u7d9a\u884c\u3059\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u3081\u3067\u305f\u3057\u3081\u3067\u305f\u3057<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u81ea\u4f5cOS\u306eMethylenix\u306e\u4e0a\u3067busybox\u306einit\u3092\u52d5\u304b\u305d\u3046\u3068\u3057\u3066\u3044\u305f\u6642\u306b\u906d\u9047\u3057\u305f\u8a71\u3067\u3059\u3002 busybox\u306f\u30e6\u30fc\u30b6\u30fc\u30e9\u30f3\u30c9\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u305f\u3081\u3001hlt\u547d\u4ee4\u306f\u5b9f\u884c\u3067\u304d\u306a\u3044\u306f\u305a\u306a\u306e\u306b\u3001busybox\u304chlt\u3092\u5b9f [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,5],"tags":[],"class_list":["post-1403","post","type-post","status-publish","format-standard","hentry","category-linux","category-programming"],"_links":{"self":[{"href":"https:\/\/pg-mana.net\/blog\/wp-json\/wp\/v2\/posts\/1403","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pg-mana.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pg-mana.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pg-mana.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pg-mana.net\/blog\/wp-json\/wp\/v2\/comments?post=1403"}],"version-history":[{"count":1,"href":"https:\/\/pg-mana.net\/blog\/wp-json\/wp\/v2\/posts\/1403\/revisions"}],"predecessor-version":[{"id":1404,"href":"https:\/\/pg-mana.net\/blog\/wp-json\/wp\/v2\/posts\/1403\/revisions\/1404"}],"wp:attachment":[{"href":"https:\/\/pg-mana.net\/blog\/wp-json\/wp\/v2\/media?parent=1403"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pg-mana.net\/blog\/wp-json\/wp\/v2\/categories?post=1403"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pg-mana.net\/blog\/wp-json\/wp\/v2\/tags?post=1403"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}