fix(core): bind numeric type identities and qualify note owners

This commit is contained in:
morluto committed 2026-10-24 02:50:02 +08:00
1 parent 1bc27d2378
commit 9b4deb2655
14 files changed
+184 -94

No files matched your search

+13
View File
@@ -64,6 +64,19 @@ save("truncated-owner", content)
content = bytearray(original)
content[status.n_offset + image.structs.Elf_Nhdr.sizeof()] = 255
save("opaque-owner", content)
for name, kind in [("gnu-type3", 3), ("gnu-file-collision", 0x46494c45)]:
content = bytearray(original)
note_header(content, status, n_type=kind)
owner_start = status.n_offset + image.structs.Elf_Nhdr.sizeof()
# Preserve the original five-byte name extent and all note alignment.
content[owner_start:owner_start + 5] = b"GNU\0\0"
save(name, content)
for name, kind in [("aarch64-archext", 0x70000000), ("aarch64-unwind", 0x70000001)]:
header = Container(**dict(image.header, e_machine="EM_AARCH64", e_phoff=64, e_phentsize=56,
e_phnum=1, e_shoff=0, e_shnum=0, e_shstrndx=0))
segment = Container(p_type=kind, p_flags=4, p_offset=120, p_vaddr=0, p_paddr=0,
p_filesz=4, p_memsz=4, p_align=4)
save(name, image.structs.Elf_Ehdr.build(header) + image.structs.Elf_Phdr.build(segment) + bytes(4))
content = bytearray(original)
for note in notes:
if note.n_type == "NT_SIGINFO":
+27
View File
@@ -180,6 +180,33 @@ try {
);
assert.equal(opaque.threads.length, 1);
cases++;
for (const [name, kind] of [
["gnu-type3", 3],
["gnu-file-collision", 0x46494c45],
]) {
const value = await basic.inspect(mode, fixtures[name]);
assert.ok(
value.notes.some(
(note) =>
note.owner_display === "GNU" &&
note.type === kind &&
note.type_id === kind,
),
);
assert.equal(value.threads.length, 1);
cases++;
}
for (const [name, kind, label] of [
["aarch64-archext", 0x70000000, "PT_AARCH64_ARCHEXT"],
["aarch64-unwind", 0x70000001, "PT_AARCH64_UNWIND"],
]) {
const value = await basic.inspect(mode, fixtures[name]);
assert.equal(value.architecture, "aarch64-little-endian");
assert.equal(value.segments[0]?.type_id, kind);
assert.equal(value.segments[0]?.type, label);
assert.equal(value.threads.length, 0);
cases++;
}
const noSignals = await basic.inspect(mode, fixtures["unknown-signals"]);
assert.equal(noSignals.signals.length, 0);
assert.equal(noSignals.threads.length, 2);