初始提交,沉淀 k8s-tenant-wuguirong 租户下完整可信数据空间 的部署、真机/真数据/真多方验证成果。 包含: - CLAUDE.md / docs/:工程入口、armv7 glibc 兼容性整改规格、 ssw-platform#1(armv7 stdout=文件即 exit 100)issue 正文 - build/:TDS 服务端 + tdc-connector 交叉构建脚本、cube 沙箱 编排、三方拓扑/真机验收脚本、ELF 符号扫描工具 - card/:软卡(softcard)源码与预编译产物(local/amd64/armv7) - evidence/:验收报告、三方真实结果、armv7 stdout 矩阵复现证据 - .workbuddy/memory/:工作日志 排除:ssw-tds/ 与 ssw-acz7015/ 为上游源码独立仓库(含 .git, 体积大);build/ 下 ctx-*/dist/pglite-* 等可重建中间产物; build/.env.*、tdc-conn-key/、.tdc-identity-secret 等明文密钥。
95 lines
3.3 KiB
Python
95 lines
3.3 KiB
Python
#!/usr/bin/env python3
|
||
"""
|
||
elf-dynsym.py —— 精确列出 ELF 的**动态符号表**(.dynsym)及其版本节点。
|
||
|
||
用途(2026-11-13 armv7 exit 100 定位):
|
||
判断 armv7 各 glibc(stretch 2.24 / buster 2.28 / bookworm 2.36)
|
||
到底导出哪些 fcntl/stat 系列符号,以及绑在哪个 GLIBC_x.y 版本节点上。
|
||
⇒ 决定「shim 方案」该把 fcntl64/stat64/lstat64 桥接到哪个老符号。
|
||
|
||
为什么不用 objdump/nm:
|
||
· macOS `nm` 只认 Mach-O,对 ELF 静默输出空;
|
||
· 本机无 llvm-nm;`zig nm` 在 zig 0.14.1 不是有效子命令。
|
||
|
||
用法:
|
||
python3 elf-dynsym.py <elf> [子串过滤...]
|
||
"""
|
||
import struct
|
||
import sys
|
||
|
||
|
||
def parse(path):
|
||
d = open(path, 'rb').read()
|
||
if d[:4] != b'\x7fELF':
|
||
raise SystemExit(f'{path}: 不是 ELF')
|
||
if d[4] != 1:
|
||
raise SystemExit(f'{path}: 不是 ELF32')
|
||
e = '<' if d[5] == 1 else '>'
|
||
shoff = struct.unpack_from(e + 'I', d, 0x20)[0]
|
||
shent = struct.unpack_from(e + 'H', d, 0x2E)[0]
|
||
shnum = struct.unpack_from(e + 'H', d, 0x30)[0]
|
||
secs = []
|
||
for i in range(shnum):
|
||
o = shoff + i * shent
|
||
if o + 40 > len(d):
|
||
break
|
||
secs.append(dict(
|
||
t=struct.unpack_from(e + 'I', d, o + 4)[0],
|
||
off=struct.unpack_from(e + 'I', d, o + 16)[0],
|
||
sz=struct.unpack_from(e + 'I', d, o + 20)[0],
|
||
link=struct.unpack_from(e + 'I', d, o + 24)[0],
|
||
ent=struct.unpack_from(e + 'I', d, o + 36)[0]))
|
||
dynsyms = []
|
||
for s in secs:
|
||
# 🔴 ELF32 的 SHT_DYNSYM = **11**(不是 6!6 是 SHT_DYNAMIC)
|
||
# 写成 6 会扫不到任何动态符号 ⇒ 输出全空。
|
||
if s['t'] != 11:
|
||
continue
|
||
strt = secs[s['link']]
|
||
n = s['sz'] // (s['ent'] or 16)
|
||
for k in range(n):
|
||
so = s['off'] + k * (s['ent'] or 16)
|
||
if so + 16 > len(d):
|
||
break
|
||
st_name, st_value, st_size, st_info, st_other, st_shndx = \
|
||
struct.unpack_from(e + 'IIIBBH', d, so)
|
||
end = d.find(b'\x00', strt['off'] + st_name, strt['off'] + strt['sz'])
|
||
nm = '' if end < 0 else d[strt['off'] + st_name:end].decode('latin-1')
|
||
dynsyms.append((nm, st_shndx, st_value))
|
||
# 版本信息(.gnu.version / .gnu.version_d)—— 简化:只取 verdef 名
|
||
vers = {}
|
||
for s in secs:
|
||
if s['t'] != 0x6FFFFFFD: # SHT_GNU_verdef
|
||
continue
|
||
# 解析 verdef 表:每项含 vda_name(指向 strtab 的偏移)
|
||
base = s['off']
|
||
# 找 strtab:verdef 的 aux 指向 dynstr,这里用 .dynstr(sec 1 之类)
|
||
break
|
||
# 简化做法:直接从动态字符串里找 "@GLIBC_" 形式
|
||
for s in secs:
|
||
if s['t'] != 11: # SHT_STRTAB,扫 "name@GLIBC_x.y"
|
||
pass
|
||
return dynsyms
|
||
|
||
|
||
def main():
|
||
if len(sys.argv) < 2:
|
||
print(__doc__)
|
||
sys.exit(2)
|
||
path = sys.argv[1]
|
||
filt = sys.argv[2:]
|
||
syms = parse(path)
|
||
seen = set()
|
||
for nm, shndx, val in syms:
|
||
if not nm or nm in seen:
|
||
continue
|
||
seen.add(nm)
|
||
if filt and not any(f in nm for f in filt):
|
||
continue
|
||
kind = 'UND' if shndx == 0 else f'shndx={shndx}'
|
||
print(f' {kind:12s} {nm}')
|
||
|
||
|
||
if __name__ == '__main__':
|
||
main()
|