Skip to main content

musl

caution
  • malloc 大场景性能弱 - 性能要求高的场景使用 jemalloc 或 mimaloc
  • 不支持 utmp/wtmp - last,who,users 命令部分功能不可用

环境变量

EnvUsed byNote
PATHexecvp, execlp, posix_spawnp
TZstdoffset[dst[offset][,start[/time],end[/time]] 或 名字
DATEMSKgetdate
PWDget_current_dir_name, getcwd
LOGNAMEgetlogin
LD_PRELOADsetuid, setgid 忽略dl 预加载动态库列表
LD_LIBRARY_PATHsetuid, setgid 忽略动态库搜索目录列表

DNS 问题

resolv 不支持 dns over tcp/edns, 因此一次 resolve 最多返回 一个包,512 bytes,有时候解析会因此出现问题。

# 监控 DNS 请求
tcpdump -ni eth0 port 53

# 完整查询内容例如 |03|www|07|example|03|com
# 使用 match-set 禁用 AAAA
iptables -N AAAA
# iptables -I FORWARD 1 -p udp -s 192.168.0.0/16 --dport 53 -j AAAA
iptables -I OUTPUT 1 -p udp --dport 53 -j AAAA
# drop 会导致超时 - 最好是返回 NXDATA 或者 NXDOMAIN
iptables -A AAAA -m string --algo bm --from 40 --hex-string '|001c|' -j DROP

musl issues

malloc performance

pthread_attr_setaffinity_np