From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "struct" |
|---|
| subject | "Format:NSO" |
|---|
| claim | "elf2nso writes a 0x100-byte NSO header: 'NSO0', flags 0x3F at 0xC (all three segments LZ4-compressed, all three hash-checked), three 16-byte segment records at 0x10 (file offset, memory offset, decompressed size, and alignment 1 for text and rodata or the bss size for the data segment), the GNU build id (up to 0x20 bytes) at 0x40, three compressed sizes at 0x60, and three SHA-256 hashes of the decompressed segments at 0xA0." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "Format:NSO" |
|---|
| observed_in | |
|---|
|
|---|
| data | | name | "NsoHeader" |
|---|
| size | "0x100" |
|---|
| endianness | "little" |
|---|
| fields | | offset | "0x0" |
|---|
| size | 4 |
|---|
| type | "u8[4]" |
|---|
| name | "Magic ('NSO0')" |
|---|
|
| offset | "0xC" |
|---|
| size | 4 |
|---|
| type | "u32" |
|---|
| name | "flags (elf2nso: Unk3 = 0x3f)" |
|---|
|
| offset | "0x10" |
|---|
| size | 48 |
|---|
| type | "NsoSegment[3]" |
|---|
| name | "Segments (u32 FileOff, DstOff, DecompSz, AlignOrTotalSz)" |
|---|
|
| offset | "0x40" |
|---|
| size | 32 |
|---|
| type | "u8[0x20]" |
|---|
| name | "BuildId" |
|---|
|
| offset | "0x60" |
|---|
| size | 12 |
|---|
| type | "u32[3]" |
|---|
| name | "CompSz" |
|---|
|
| offset | "0x90" |
|---|
| size | 16 |
|---|
| type | "u64[2]" |
|---|
| name | "Unk4, Unk5 (left zero by elf2nso)" |
|---|
|
| offset | "0xA0" |
|---|
| size | 96 |
|---|
| type | "u8[3][0x20]" |
|---|
| name | "Hashes (SHA-256 of the decompressed segments)" |
|---|
|
|
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "NsoSegment and NsoHeader structs (sizeof checked == 0x100 at line 74), Magic 'NSO0' and Unk3 = 0x3f, segment fields filled from the three PT_LOAD program headers (the data segment's last field is p_memsz - p_filesz, the bss size), SHA-256 of each segment and LZ4_compress_default of each, build id copied from the NT_GNU_BUILD_ID note truncated to 0x20 bytes. Offsets computed from the struct member sizes." |
|---|
| repo | "switchbrew/switch-tools" |
|---|
| commit | "22756068dd0ed6ff9734c59cb4f99ebd3f62555b" |
|---|
| path | "src/elf2nso.c" |
|---|
| lines | "14-35, 71-72, 125-150, 157-172" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "NSO header as written by elf2nso" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-19T01:20:43.925Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T08:38:05.846Z" |
|---|
| result | "confirmed" |
|---|
| method | "Read NsoSegment and NsoHeader in elf2nso.c lines 14-35 at the cited commit and recomputed offsets: Magic 0, Unk1 4, Unk2 8, Unk3 0xC (set 0x3f), Segments 0x10 (3 x 16), BuildId 0x40, CompSz 0x60, Padding[0x24] 0x6C, Unk4/Unk5 0x90, Hashes 0xA0 (3 x 0x20) = 0x100; code checks sizeof == 0x100." |
|---|
|
|
|---|