Bug 8881 - [Anolis23.1 GA][Beta][ANCK-6.6.25-2][aarch64/x86_64]libhugetlbfs测试用例LD_PRELOAD=libhugetlbfs.so,HUGETLB_MORECORE=yes,malloc执行失败,报错"Address is not hugepage"
Summary: [Anolis23.1 GA][Beta][ANCK-6.6.25-2][aarch64/x86_64]libhugetlbfs测试用例LD_PRELOA...
Status: CLOSED INVALID
Alias: None
Product: ANCK 6.6 Dev
Classification: ANCK
Component: mm (show other bugs) mm
Version: 6.6.25-2
Hardware: All Linux
: P3-Medium S3-normal
Target Milestone: ---
Assignee: xuyu
QA Contact:
URL:
Whiteboard:
Keywords: Function
Depends on:
Blocks:
 
Reported: 2024-04-24 15:02 UTC by zhixin01
Modified: 2024-05-21 17:06 UTC (History)
11 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description zhixin01 alibaba_cloud_group 2024-04-24 15:02:53 UTC
[缺陷描述]:
libhugetlbfs测试用例LD_PRELOAD=libhugetlbfs.so,HUGETLB_MORECORE=yes,malloc执行失败,报错"Address is not hugepage"

[复现概率]:
必现

[复现环境]:
内核:
# uname -r
6.6.25-2_rc1.an23.x86_64

# cat /etc/os-release
NAME="Anolis OS"
VERSION="23"
ID="anolis"
VERSION_ID="23"
PLATFORM_ID="platform:an23"
PRETTY_NAME="Anolis OS 23"
ANSI_COLOR="0;31"
HOME_URL="https://openanolis.cn/"
BUG_REPORT_URL="https://bugzilla.openanolis.cn/"

CPU信息:
# lscpu
Architecture:             x86_64
  CPU op-mode(s):         32-bit, 64-bit
  Address sizes:          52 bits physical, 57 bits virtual
  Byte Order:             Little Endian
CPU(s):                   4
  On-line CPU(s) list:    0-3
Vendor ID:                GenuineIntel
  BIOS Vendor ID:         Alibaba Cloud
  Model name:             Intel(R) Xeon(R) Platinum 8475B
    BIOS Model name:      pc-q35-df-2.1  CPU @ 0.0GHz
    BIOS CPU family:      1
    CPU family:           6
    Model:                143
    Thread(s) per core:   2
    Core(s) per socket:   2
    Socket(s):            1
    Stepping:             8
    CPU(s) scaling MHz:   84%
    CPU max MHz:          3800.0000
    CPU min MHz:          800.0000
    BogoMIPS:             5400.00
    Flags:                fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtsc
                          p lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq monitor ssse3 fma cx16 pdcm
                          pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid_fault ibrs_enhanced
                          fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512c
                          d sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves avx_vnni avx512_bf16 wbnoinvd ida arat hwp hwp_notify hwp_act_window h
                          wp_epp hwp_pkg_req avx512vbmi umip pku ospke waitpkg avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntd
                          q rdpid bus_lock_detect cldemote movdiri movdir64b enqcmd fsrm md_clear serialize tsxldtrk amx_bf16 avx512_fp16 amx_tile amx_int
                          8 arch_capabilities
Virtualization features:
  Hypervisor vendor:      KVM
  Virtualization type:    full
Caches (sum of all):
  L1d:                    96 KiB (2 instances)
  L1i:                    64 KiB (2 instances)
  L2:                     4 MiB (2 instances)
  L3:                     97.5 MiB (1 instance)
NUMA:
  NUMA node(s):           1
  NUMA node0 CPU(s):      0-3
Vulnerabilities:
  Gather data sampling:   Not affected
  Itlb multihit:          Not affected
  L1tf:                   Not affected
  Mds:                    Not affected
  Meltdown:               Not affected
  Mmio stale data:        Unknown: No mitigations
  Reg file data sampling: Not affected
  Retbleed:               Not affected
  Spec rstack overflow:   Not affected
  Spec store bypass:      Vulnerable
  Spectre v1:             Mitigation; usercopy/swapgs barriers and __user pointer sanitization
  Spectre v2:             Mitigation; Enhanced / Automatic IBRS, RSB filling, PBRSB-eIBRS SW sequence
  Srbds:                  Not affected
  Tsx async abort:        Not affected

内存信息:
# free -h
               total        used        free      shared  buff/cache   available
Mem:            15Gi       585Mi       6.9Gi       364Mi       7.6Gi        13Gi
Swap:             0B          0B          0B

# cat /proc/meminfo  | grep "Hugepagesize"
Hugepagesize:       2048 kB

[复现步骤]:
#下载测试代码并编译
git clone --mirror git@gitlab-sp.alibaba-inc.com:AKTF/libhugetlbfs.git ./libhugetlbfs
cd libhugetlbfs
make BUILDTYPE=NATIVEONLY
obj/hugeadm --add-temp-swap=64 --pool-pages-min 2M:64 --hard

#执行测试
make check BUILDTYPE=NATIVEONLY

[预期结果]:
用例执行成功

[实际结果]:
用例执行失败,报错"Address is not hugepage"

用例执行日志如下:
malloc (2M: 64):         PASS
LD_PRELOAD=libhugetlbfs.so HUGETLB_MORECORE=yes malloc (2M: 64):         FAIL   Address is not hugepage
LD_PRELOAD=libhugetlbfs.so HUGETLB_MORECORE=yes HUGETLB_RESTRICT_EXE=unknown:none malloc (2M: 64):       PASS
LD_PRELOAD=libhugetlbfs.so HUGETLB_MORECORE=yes HUGETLB_RESTRICT_EXE=unknown:malloc malloc (2M: 64):     FAIL   Address is not hugepage
malloc_manysmall (2M: 64):       PASS
LD_PRELOAD=libhugetlbfs.so HUGETLB_MORECORE=yes malloc_manysmall (2M: 64):       FAIL   Address is not hugepage

[原因分析]
通过strace跟踪用例执行过程如下:
# LD_PRELOAD=libhugetlbfs.so 
# HUGETLB_MORECORE=yes
# strace ./malloc
execve("./malloc", ["./malloc"], 0x7ffe6d0f01f0 /* 36 vars */) = 0
brk(NULL)                               = 0x9c8000
arch_prctl(0x3001 /* ARCH_??? */, 0x7ffd35834be0) = -1 EINVAL (Invalid argument)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f369a673000
openat(AT_FDCWD, "glibc-hwcaps/x86-64-v4/libhugetlbfs.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "glibc-hwcaps/x86-64-v3/libhugetlbfs.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "glibc-hwcaps/x86-64-v2/libhugetlbfs.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "tls/haswell/avx512_1/x86_64/libhugetlbfs.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "tls/haswell/avx512_1/libhugetlbfs.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "tls/haswell/x86_64/libhugetlbfs.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "tls/haswell/libhugetlbfs.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "tls/avx512_1/x86_64/libhugetlbfs.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "tls/avx512_1/libhugetlbfs.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "tls/x86_64/libhugetlbfs.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "tls/libhugetlbfs.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "haswell/avx512_1/x86_64/libhugetlbfs.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "haswell/avx512_1/libhugetlbfs.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "haswell/x86_64/libhugetlbfs.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "haswell/libhugetlbfs.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "avx512_1/x86_64/libhugetlbfs.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "avx512_1/libhugetlbfs.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "x86_64/libhugetlbfs.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "libhugetlbfs.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/root/zx/tone/run/libhugetlbfs/obj64/glibc-hwcaps/x86-64-v4/libhugetlbfs.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/root/zx/tone/run/libhugetlbfs/obj64/glibc-hwcaps/x86-64-v4", 0x7ffd35833280, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/root/zx/tone/run/libhugetlbfs/obj64/glibc-hwcaps/x86-64-v3/libhugetlbfs.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/root/zx/tone/run/libhugetlbfs/obj64/glibc-hwcaps/x86-64-v3", 0x7ffd35833280, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/root/zx/tone/run/libhugetlbfs/obj64/glibc-hwcaps/x86-64-v2/libhugetlbfs.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/root/zx/tone/run/libhugetlbfs/obj64/glibc-hwcaps/x86-64-v2", 0x7ffd35833280, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/root/zx/tone/run/libhugetlbfs/obj64/tls/haswell/avx512_1/x86_64/libhugetlbfs.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/root/zx/tone/run/libhugetlbfs/obj64/tls/haswell/avx512_1/x86_64", 0x7ffd35833280, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/root/zx/tone/run/libhugetlbfs/obj64/tls/haswell/avx512_1/libhugetlbfs.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/root/zx/tone/run/libhugetlbfs/obj64/tls/haswell/avx512_1", 0x7ffd35833280, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/root/zx/tone/run/libhugetlbfs/obj64/tls/haswell/x86_64/libhugetlbfs.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/root/zx/tone/run/libhugetlbfs/obj64/tls/haswell/x86_64", 0x7ffd35833280, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/root/zx/tone/run/libhugetlbfs/obj64/tls/haswell/libhugetlbfs.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/root/zx/tone/run/libhugetlbfs/obj64/tls/haswell", 0x7ffd35833280, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/root/zx/tone/run/libhugetlbfs/obj64/tls/avx512_1/x86_64/libhugetlbfs.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/root/zx/tone/run/libhugetlbfs/obj64/tls/avx512_1/x86_64", 0x7ffd35833280, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/root/zx/tone/run/libhugetlbfs/obj64/tls/avx512_1/libhugetlbfs.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/root/zx/tone/run/libhugetlbfs/obj64/tls/avx512_1", 0x7ffd35833280, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/root/zx/tone/run/libhugetlbfs/obj64/tls/x86_64/libhugetlbfs.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/root/zx/tone/run/libhugetlbfs/obj64/tls/x86_64", 0x7ffd35833280, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/root/zx/tone/run/libhugetlbfs/obj64/tls/libhugetlbfs.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/root/zx/tone/run/libhugetlbfs/obj64/tls", 0x7ffd35833280, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/root/zx/tone/run/libhugetlbfs/obj64/haswell/avx512_1/x86_64/libhugetlbfs.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/root/zx/tone/run/libhugetlbfs/obj64/haswell/avx512_1/x86_64", 0x7ffd35833280, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/root/zx/tone/run/libhugetlbfs/obj64/haswell/avx512_1/libhugetlbfs.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/root/zx/tone/run/libhugetlbfs/obj64/haswell/avx512_1", 0x7ffd35833280, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/root/zx/tone/run/libhugetlbfs/obj64/haswell/x86_64/libhugetlbfs.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/root/zx/tone/run/libhugetlbfs/obj64/haswell/x86_64", 0x7ffd35833280, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/root/zx/tone/run/libhugetlbfs/obj64/haswell/libhugetlbfs.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/root/zx/tone/run/libhugetlbfs/obj64/haswell", 0x7ffd35833280, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/root/zx/tone/run/libhugetlbfs/obj64/avx512_1/x86_64/libhugetlbfs.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/root/zx/tone/run/libhugetlbfs/obj64/avx512_1/x86_64", 0x7ffd35833280, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/root/zx/tone/run/libhugetlbfs/obj64/avx512_1/libhugetlbfs.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/root/zx/tone/run/libhugetlbfs/obj64/avx512_1", 0x7ffd35833280, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/root/zx/tone/run/libhugetlbfs/obj64/x86_64/libhugetlbfs.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/root/zx/tone/run/libhugetlbfs/obj64/x86_64", 0x7ffd35833280, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/root/zx/tone/run/libhugetlbfs/obj64/libhugetlbfs.so", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 832) = 832
newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=180776, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 107848, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f369a658000
mmap(0x7f369a65a000, 36864, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f369a65a000
mmap(0x7f369a663000, 12288, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xb000) = 0x7f369a663000
mmap(0x7f369a666000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xe000) = 0x7f369a666000
mmap(0x7f369a668000, 42312, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f369a668000
close(3)                                = 0
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "glibc-hwcaps/x86-64-v4/libhugetlbfs_privutils.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "glibc-hwcaps/x86-64-v3/libhugetlbfs_privutils.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "glibc-hwcaps/x86-64-v2/libhugetlbfs_privutils.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "tls/haswell/avx512_1/x86_64/libhugetlbfs_privutils.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "tls/haswell/avx512_1/libhugetlbfs_privutils.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "tls/haswell/x86_64/libhugetlbfs_privutils.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "tls/haswell/libhugetlbfs_privutils.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "tls/avx512_1/x86_64/libhugetlbfs_privutils.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "tls/avx512_1/libhugetlbfs_privutils.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "tls/x86_64/libhugetlbfs_privutils.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "tls/libhugetlbfs_privutils.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "haswell/avx512_1/x86_64/libhugetlbfs_privutils.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "haswell/avx512_1/libhugetlbfs_privutils.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "haswell/x86_64/libhugetlbfs_privutils.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "haswell/libhugetlbfs_privutils.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "avx512_1/x86_64/libhugetlbfs_privutils.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "avx512_1/libhugetlbfs_privutils.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "x86_64/libhugetlbfs_privutils.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "libhugetlbfs_privutils.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/root/zx/tone/run/libhugetlbfs/obj64/libhugetlbfs_privutils.so", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 832) = 832
newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=92488, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 78696, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f369a644000
mmap(0x7f369a646000, 16384, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f369a646000
mmap(0x7f369a64a000, 8192, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x6000) = 0x7f369a64a000
mmap(0x7f369a64c000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7000) = 0x7f369a64c000
mmap(0x7f369a64e000, 37736, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f369a64e000
close(3)                                = 0
openat(AT_FDCWD, "glibc-hwcaps/x86-64-v4/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "glibc-hwcaps/x86-64-v3/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "glibc-hwcaps/x86-64-v2/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "tls/haswell/avx512_1/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "tls/haswell/avx512_1/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "tls/haswell/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "tls/haswell/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "tls/avx512_1/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "tls/avx512_1/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "tls/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "tls/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "haswell/avx512_1/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "haswell/avx512_1/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "haswell/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "haswell/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "avx512_1/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "avx512_1/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/root/zx/tone/run/libhugetlbfs/obj64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=17551, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 17551, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f369a63f000
close(3)                                = 0
openat(AT_FDCWD, "/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\2207\2\0\0\0\0\0"..., 832) = 832
pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784
newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=2202416, ...}, AT_EMPTY_PATH) = 0
pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784
mmap(NULL, 1932592, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f369a467000
mmap(0x7f369a489000, 1396736, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x22000) = 0x7f369a489000
mmap(0x7f369a5de000, 339968, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x177000) = 0x7f369a5de000
mmap(0x7f369a631000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1c9000) = 0x7f369a631000
mmap(0x7f369a637000, 32048, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f369a637000
close(3)                                = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f369a465000
arch_prctl(ARCH_SET_FS, 0x7f369a465b80) = 0
set_tid_address(0x7f369a465e50)         = 194465
set_robust_list(0x7f369a465e60, 24)     = 0
rseq(0x7f369a4664a0, 0x20, 0, 0x53053053) = 0
mprotect(0x7f369a631000, 16384, PROT_READ) = 0
mprotect(0x7f369a64c000, 4096, PROT_READ) = 0
mprotect(0x7f369a666000, 4096, PROT_READ) = 0
mprotect(0x403000, 4096, PROT_READ)     = 0
mprotect(0x7f369a6a5000, 8192, PROT_READ) = 0
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
munmap(0x7f369a63f000, 17551)           = 0
uname({sysname="Linux", nodename="iZbp1c9jzchxjqive233ucZ", ...}) = 0
openat(AT_FDCWD, "/proc/mounts", O_RDONLY) = 3
read(3, "proc /proc proc rw,nosuid,nodev,"..., 2048) = 2048
lseek(3, -1996, SEEK_CUR)               = 52
read(3, "sysfs /sys sysfs rw,seclabel,nos"..., 2048) = 2048
lseek(3, -1986, SEEK_CUR)               = 114
read(3, "devtmpfs /dev devtmpfs rw,seclab"..., 2048) = 2020
lseek(3, -1936, SEEK_CUR)               = 198
read(3, "securityfs /sys/kernel/security "..., 2048) = 1936
lseek(3, -1857, SEEK_CUR)               = 277
read(3, "tmpfs /dev/shm tmpfs rw,seclabel"..., 2048) = 1857
lseek(3, -1775, SEEK_CUR)               = 359
read(3, "devpts /dev/pts devpts rw,seclab"..., 2048) = 1775
lseek(3, -1685, SEEK_CUR)               = 449
read(3, "tmpfs /run tmpfs rw,seclabel,nos"..., 2048) = 1685
lseek(3, -1599, SEEK_CUR)               = 535
read(3, "cgroup2 /sys/fs/cgroup cgroup2 r"..., 2048) = 1599
lseek(3, -1491, SEEK_CUR)               = 643
read(3, "pstore /sys/fs/pstore pstore rw,"..., 2048) = 1491
lseek(3, -1417, SEEK_CUR)               = 717
read(3, "bpf /sys/fs/bpf bpf rw,nosuid,no"..., 2048) = 1417
lseek(3, -1352, SEEK_CUR)               = 782
read(3, "/dev/nvme0n1p2 / xfs rw,seclabel"..., 2048) = 1352
lseek(3, -1261, SEEK_CUR)               = 873
read(3, "selinuxfs /sys/fs/selinux selinu"..., 2048) = 1261
lseek(3, -1195, SEEK_CUR)               = 939
read(3, "systemd-1 /proc/sys/fs/binfmt_mi"..., 2048) = 1195
lseek(3, -1071, SEEK_CUR)               = 1063
read(3, "mqueue /dev/mqueue mqueue rw,sec"..., 2048) = 1071
lseek(3, -1000, SEEK_CUR)               = 1134
read(3, "debugfs /sys/kernel/debug debugf"..., 2048) = 1000
lseek(3, -921, SEEK_CUR)                = 1213
read(3, "tracefs /sys/kernel/tracing trac"..., 2048) = 921
lseek(3, -840, SEEK_CUR)                = 1294
read(3, "tmpfs /tmp tmpfs rw,seclabel,nos"..., 2048) = 840
lseek(3, -762, SEEK_CUR)                = 1372
read(3, "ramfs /run/credentials/systemd-s"..., 2048) = 762
lseek(3, -656, SEEK_CUR)                = 1478
read(3, "fusectl /sys/fs/fuse/connections"..., 2048) = 656
lseek(3, -579, SEEK_CUR)                = 1555
read(3, "configfs /sys/kernel/config conf"..., 2048) = 579
lseek(3, -506, SEEK_CUR)                = 1628
read(3, "ramfs /run/credentials/systemd-t"..., 2048) = 506
lseek(3, -388, SEEK_CUR)                = 1746
read(3, "ramfs /run/credentials/systemd-t"..., 2048) = 388
lseek(3, -274, SEEK_CUR)                = 1860
read(3, "binfmt_misc /proc/sys/fs/binfmt_"..., 2048) = 274
lseek(3, -189, SEEK_CUR)                = 1945
read(3, "tracefs /sys/kernel/debug/tracin"..., 2048) = 189
lseek(3, -102, SEEK_CUR)                = 2032
read(3, "tmpfs /run/user/0 tmpfs rw,secla"..., 2048) = 102
lseek(3, 0, SEEK_CUR)                   = 2134
read(3, "", 2048)                       = 0
close(3)                                = 0
uname({sysname="Linux", nodename="iZbp1c9jzchxjqive233ucZ", ...}) = 0
uname({sysname="Linux", nodename="iZbp1c9jzchxjqive233ucZ", ...}) = 0
openat(AT_FDCWD, "/proc/meminfo", O_RDONLY) = 3
read(3, "MemTotal:       15862640 kB\nMemF"..., 2048) = 1587
close(3)                                = 0
openat(AT_FDCWD, "/proc/mounts", O_RDONLY) = 3
read(3, "proc /proc proc rw,nosuid,nodev,"..., 2048) = 2048
lseek(3, -1996, SEEK_CUR)               = 52
read(3, "sysfs /sys sysfs rw,seclabel,nos"..., 2048) = 2048
lseek(3, -1986, SEEK_CUR)               = 114
read(3, "devtmpfs /dev devtmpfs rw,seclab"..., 2048) = 2020
lseek(3, -1936, SEEK_CUR)               = 198
read(3, "securityfs /sys/kernel/security "..., 2048) = 1936
lseek(3, -1857, SEEK_CUR)               = 277
read(3, "tmpfs /dev/shm tmpfs rw,seclabel"..., 2048) = 1857
lseek(3, -1775, SEEK_CUR)               = 359
read(3, "devpts /dev/pts devpts rw,seclab"..., 2048) = 1775
lseek(3, -1685, SEEK_CUR)               = 449
read(3, "tmpfs /run tmpfs rw,seclabel,nos"..., 2048) = 1685
lseek(3, -1599, SEEK_CUR)               = 535
read(3, "cgroup2 /sys/fs/cgroup cgroup2 r"..., 2048) = 1599
lseek(3, -1491, SEEK_CUR)               = 643
read(3, "pstore /sys/fs/pstore pstore rw,"..., 2048) = 1491
lseek(3, -1417, SEEK_CUR)               = 717
read(3, "bpf /sys/fs/bpf bpf rw,nosuid,no"..., 2048) = 1417
lseek(3, -1352, SEEK_CUR)               = 782
read(3, "/dev/nvme0n1p2 / xfs rw,seclabel"..., 2048) = 1352
lseek(3, -1261, SEEK_CUR)               = 873
read(3, "selinuxfs /sys/fs/selinux selinu"..., 2048) = 1261
lseek(3, -1195, SEEK_CUR)               = 939
read(3, "systemd-1 /proc/sys/fs/binfmt_mi"..., 2048) = 1195
lseek(3, -1071, SEEK_CUR)               = 1063
read(3, "mqueue /dev/mqueue mqueue rw,sec"..., 2048) = 1071
lseek(3, -1000, SEEK_CUR)               = 1134
read(3, "debugfs /sys/kernel/debug debugf"..., 2048) = 1000
lseek(3, -921, SEEK_CUR)                = 1213
read(3, "tracefs /sys/kernel/tracing trac"..., 2048) = 921
lseek(3, -840, SEEK_CUR)                = 1294
read(3, "tmpfs /tmp tmpfs rw,seclabel,nos"..., 2048) = 840
lseek(3, -762, SEEK_CUR)                = 1372
read(3, "ramfs /run/credentials/systemd-s"..., 2048) = 762
lseek(3, -656, SEEK_CUR)                = 1478
read(3, "fusectl /sys/fs/fuse/connections"..., 2048) = 656
lseek(3, -579, SEEK_CUR)                = 1555
read(3, "configfs /sys/kernel/config conf"..., 2048) = 579
lseek(3, -506, SEEK_CUR)                = 1628
read(3, "ramfs /run/credentials/systemd-t"..., 2048) = 506
lseek(3, -388, SEEK_CUR)                = 1746
read(3, "ramfs /run/credentials/systemd-t"..., 2048) = 388
lseek(3, -274, SEEK_CUR)                = 1860
read(3, "binfmt_misc /proc/sys/fs/binfmt_"..., 2048) = 274
lseek(3, -189, SEEK_CUR)                = 1945
read(3, "tracefs /sys/kernel/debug/tracin"..., 2048) = 189
lseek(3, -102, SEEK_CUR)                = 2032
read(3, "tmpfs /run/user/0 tmpfs rw,secla"..., 2048) = 102
lseek(3, 0, SEEK_CUR)                   = 2134
read(3, "", 2048)                       = 0
close(3)                                = 0
uname({sysname="Linux", nodename="iZbp1c9jzchxjqive233ucZ", ...}) = 0
rt_sigaction(SIGINT, {sa_handler=0x401780, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7f369a49fa60}, NULL, 8) = 0
getpid()                                = 194465
newfstatat(1, "", {st_mode=S_IFCHR|0620, st_rdev=makedev(0x88, 0x1), ...}, AT_EMPTY_PATH) = 0
getrandom("\x9d\x77\x7b\xad\xa7\x3d\x2b\xd9", 8, GRND_NONBLOCK) = 8
brk(NULL)                               = 0x9c8000
brk(0x9e9000)                           = 0x9e9000
write(1, "Starting testcase \"./malloc\", pi"..., 41Starting testcase "./malloc", pid 194465
) = 41
write(1, "HUGETLB_MORECORE=yes\n", 21HUGETLB_MORECORE=yes
)  = 21
write(1, "HUGETLB_RESTRICT_EXE=(null)\n", 28HUGETLB_RESTRICT_EXE=(null)
) = 28
write(1, "expect_hugepage=1\n", 18expect_hugepage=1
)     = 18
write(1, "malloc(4) = 0x9c86b0\n", 21malloc(4) = 0x9c86b0
)  = 21
openat(AT_FDCWD, "/proc/self/smaps", O_RDONLY) = 3
newfstatat(3, "", {st_mode=S_IFREG|0444, st_size=0, ...}, AT_EMPTY_PATH) = 0
read(3, "00400000-00401000 r--p 00000000 "..., 1024) = 1024
read(3, ":                   4 kB\nPss:   "..., 1024) = 1024
read(3, "         4 kB\nAnonymous:        "..., 1024) = 1024
read(3, "Private_Hugetlb:       0 kB\nSwap"..., 1024) = 1024
read(3, "000 rw-p 00000000 00:00 0       "..., 1024) = 1024
close(3)                                = 0
write(1, "FAIL\tAddress is not hugepage\n", 29FAIL      Address is not hugepage
) = 29
exit_group(2)                           = ?
+++ exited with 2 +++
Comment 1 zhixin01 alibaba_cloud_group 2024-04-24 15:12:57 UTC
libhugetlbfs还有如下6个用例失败,aarch64和x86_64都有类似的问题,麻烦开发同学确认下是否属于同一问题

LD_PRELOAD=libhugetlbfs.so HUGETLB_MORECORE=yes HUGETLB_RESTRICT_EXE=unknown:malloc malloc (2M: 64):     FAIL   Address is not hugepage

LD_PRELOAD=libhugetlbfs.so HUGETLB_MORECORE=yes malloc_manysmall (2M: 64):       FAIL   Address is not hugepage

GLIBC_TUNABLES=glibc.malloc.tcache_count=0 LD_PRELOAD=libhugetlbfs.so HUGETLB_MORECORE=yes heapshrink (2M: 64):  FAIL   Heap not on hugepages

GLIBC_TUNABLES=glibc.malloc.tcache_count=0 LD_PRELOAD=libhugetlbfs.so libheapshrink.so HUGETLB_MORECORE=yes heapshrink (2M: 64):         FAIL   Heap not on hugepages

shmoverride_linked_static (2M: 64):      FAIL   shmget failed size 2097152 from line 176: Success

HUGETLB_SHM=yes shmoverride_linked_static (2M: 64):      FAIL   shmget failed size 2097152 from line 176: Success
Comment 2 yunmeng365524 2024-05-09 20:44:47 UTC
请研发帮忙确认一下,5.10上运行时OK的。
https://tone.aliyun-inc.com/ws/6yddz4ne/test_result/171188
Comment 3 xiangzao alibaba_cloud_group 2024-05-17 17:29:50 UTC
commit 7ba91d2256d2834b7d92e510782b8f7543daf678
Author: Matheus Castanho <msc@linux.ibm.com>
Date:   Thu Aug 12 16:38:46 2021 -0300

    Disable hugepage-backed malloc if __morecore is not available

    Starting with glibc 2.32, __morecore hook has been marked as deprecated, and was
    completely removed on glibc 2.34, which causes an undefined symbol error during
    the build of libhugetlbfs.

    Greater changes are needed in order to keep providing the same functionality
    with future versions of glibc (see issue #52). Meanwhile, we can disable
    hugepage-backed malloc setup if __morecore is not available so users can at
    least keep using the other features provided by the library.  Related tests are
    also conditionally disabled, and will show as SKIPPED if __morecore is not
    available.

    Tested on powerpc64le and x86_64 with glibc 2.34 and olders.

    Signed-off-by: Matheus Castanho <msc@linux.ibm.com>
    Tested-by: Breno Leitao <leitao@debian.org>

an23 glibc 版本为 2.36,__morecore 已经被完全移除,本bugzilla 里 FAIL 的用例都是因为使用了 hugepage-backed malloc。使用了 2.2.4 版本的 libhugetlbfs,本bugzilla FAIL 用例均为 SKIPPED 或 PASS

LD_PRELOAD=libhugetlbfs.so HUGETLB_MORECORE=yes malloc (2M: 64):	SKIPPED
LD_PRELOAD=libhugetlbfs.so HUGETLB_MORECORE=yes HUGETLB_RESTRICT_EXE=unknown:none malloc (2M: 64):	SKIPPED
LD_PRELOAD=libhugetlbfs.so HUGETLB_MORECORE=yes HUGETLB_RESTRICT_EXE=unknown:malloc malloc (2M: 64):	SKIPPED
LD_PRELOAD=libhugetlbfs.so HUGETLB_MORECORE=yes malloc_manysmall (2M: 64):      SKIPPED
GLIBC_TUNABLES=glibc.malloc.tcache_count=0 LD_PRELOAD=libhugetlbfs.so HUGETLB_MORECORE=yes heapshrink (2M: 64): SKIPPED
GLIBC_TUNABLES=glibc.malloc.tcache_count=0 LD_PRELOAD=libheapshrink.so HUGETLB_MORECORE=yes HUGETLB_MORECORE_SHRINK=yes heapshrink (2M: 64):    SKIPPED
shmoverride_linked (2M: 64):    PASS
HUGETLB_SHM=yes shmoverride_linked (2M: 64):    PASS

建议在 an23 上用新版本 libhugetlbfs 进行测试
测试用例问题,置为invalid
Comment 4 yunmeng365524 2024-05-21 17:06:17 UTC
测试记录一下,后续23.1 的版本更新libhugetlbfs的版本。