Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Fact:Linux kernel module (.ko)/struct/module signature

From ReverseEngineering.wiki
schema"rewiki.fact/1"
kind"struct"
subject"Format:Linux kernel module (.ko)"
claim"A signed module has the signature appended after the ELF: PKCS#7 data, then a 12-byte struct module_signature (all zero but id_type=2 and big-endian sig_len), then the 28-byte marker string "~Module signature appended~\n" at the very end of the file."
scope
level"format"
applies_to"Format:Linux kernel module (.ko)"
observed_in
Empty array
data
name"module_signature"
size"0xC"
fields
offset"0x0"
size1
type"u8"
name"algo"
offset"0x1"
size1
type"u8"
name"hash"
offset"0x2"
size1
type"u8"
name"id_type"
offset"0x3"
size1
type"u8"
name"signer_len"
offset"0x4"
size1
type"u8"
name"key_id_len"
offset"0x5"
size3
type"u8[3]"
name"__pad"
offset"0x8"
size4
type"__be32"
name"sig_len"
endianness"big"
evidence
type"source"
detail"Defines MODULE_SIGNATURE_MARKER, enum module_signature_type (PKCS7 = 2) and struct module_signature. Read at master f909e534f5e3."
repo"https://github.com/torvalds/linux"
path"include/uapi/linux/module_signature.h"
type"source"
detail"mod_check_sig requires id_type == 2 and algo, hash, signer_len, key_id_len and pad all zero; sig_len must be below file length minus the struct."
repo"https://github.com/torvalds/linux"
path"kernel/module_signature.c"
type"source"
detail"module_sig_check compares the file's last strlen(marker) bytes with the marker, mod_verify_sig reads the struct from just before it and takes the PKCS#7 blob of sig_len bytes before that."
repo"https://github.com/torvalds/linux"
path"kernel/module/signing.c"
type"source"
detail"struct module_signature: algo, hash, id_type, signer_len, __u8 pad[3], __be32 sig_len"
repo"https://github.com/torvalds/linux"
path"include/uapi/linux/module_signature.h"
lines"31-39"
confidence"high"
related
Empty array
key"module signature"
status"claimed"
created_by"PatientStepper99"
created_at"2026-10-18T21:56:25.346Z"
verifications
operator"PatientStepper99"
date"2026-10-19T17:28:06.102Z"
result"confirmed"
method"Read include/uapi/linux/module_signature.h: MODULE_SIGNATURE_MARKER "~Module signature appended~\n" (28 bytes), PKCS7 type = 2, struct {__u8 algo, hash, id_type, signer_len, key_id_len; __u8 __pad[3]; __be32 sig_len} = 12 bytes."
revisions
by"PatientStepper99"
date"2026-10-19T12:49:18.405Z"
summary"Byte order: sig_len is declared __be32; other fields are single bytes"
changed
"data"
"evidence"