linux revision 234250
1226048Sobrien 268349Sobrien#------------------------------------------------------------------------------ 3234250Sobrien# $File: linux,v 1.42 2012/02/07 21:35:03 christos Exp $ 468349Sobrien# linux: file(1) magic for Linux files 568349Sobrien# 668349Sobrien# Values for Linux/i386 binaries, from Daniel Quinlan <quinlan@yggdrasil.com> 768349Sobrien# The following basic Linux magic is useful for reference, but using 868349Sobrien# "long" magic is a better practice in order to avoid collisions. 968349Sobrien# 1068349Sobrien# 2 leshort 100 Linux/i386 1168349Sobrien# >0 leshort 0407 impure executable (OMAGIC) 1268349Sobrien# >0 leshort 0410 pure executable (NMAGIC) 1368349Sobrien# >0 leshort 0413 demand-paged executable (ZMAGIC) 1468349Sobrien# >0 leshort 0314 demand-paged executable (QMAGIC) 1568349Sobrien# 1668349Sobrien0 lelong 0x00640107 Linux/i386 impure executable (OMAGIC) 1768349Sobrien>16 lelong 0 \b, stripped 1868349Sobrien0 lelong 0x00640108 Linux/i386 pure executable (NMAGIC) 1968349Sobrien>16 lelong 0 \b, stripped 2068349Sobrien0 lelong 0x0064010b Linux/i386 demand-paged executable (ZMAGIC) 2168349Sobrien>16 lelong 0 \b, stripped 2268349Sobrien0 lelong 0x006400cc Linux/i386 demand-paged executable (QMAGIC) 2368349Sobrien>16 lelong 0 \b, stripped 2468349Sobrien# 2568349Sobrien0 string \007\001\000 Linux/i386 object file 2668349Sobrien>20 lelong >0x1020 \b, DLL library 2768349Sobrien# Linux-8086 stuff: 2868349Sobrien0 string \01\03\020\04 Linux-8086 impure executable 2968349Sobrien>28 long !0 not stripped 3068349Sobrien0 string \01\03\040\04 Linux-8086 executable 3168349Sobrien>28 long !0 not stripped 3268349Sobrien# 3368349Sobrien0 string \243\206\001\0 Linux-8086 object file 3468349Sobrien# 3568349Sobrien0 string \01\03\020\20 Minix-386 impure executable 3668349Sobrien>28 long !0 not stripped 3768349Sobrien0 string \01\03\040\20 Minix-386 executable 3868349Sobrien>28 long !0 not stripped 3968349Sobrien# core dump file, from Bill Reynolds <bill@goshawk.lanl.gov> 4068349Sobrien216 lelong 0421 Linux/i386 core file 4168349Sobrien>220 string >\0 of '%s' 4268349Sobrien>200 lelong >0 (signal %d) 4368349Sobrien# 4468349Sobrien# LILO boot/chain loaders, from Daniel Quinlan <quinlan@yggdrasil.com> 4568349Sobrien# this can be overridden by the DOS executable (COM) entry 4668349Sobrien2 string LILO Linux/i386 LILO boot/chain loader 4768349Sobrien# 48226048Sobrien# Linux make config build file, from Ole Aamot <oka@oka.no> 49226048Sobrien28 string make\ config Linux make config build file 50226048Sobrien# 5168349Sobrien# PSF fonts, from H. Peter Anvin <hpa@yggdrasil.com> 52226048Sobrien# Updated by Adam Buchbinder <adam.buchbinder@gmail.com> 53226048Sobrien# See: http://www.win.tue.nl/~aeb/linux/kbd/font-formats-1.html 54226048Sobrien0 leshort 0x0436 Linux/i386 PC Screen Font v1 data, 55226048Sobrien>2 byte&0x01 0 256 characters, 56226048Sobrien>2 byte&0x01 !0 512 characters, 57226048Sobrien>2 byte&0x02 0 no directory, 58226048Sobrien>2 byte&0x02 !0 Unicode directory, 5968349Sobrien>3 byte >0 8x%d 60226048Sobrien0 string \x72\xb5\x4a\x86\x00\x00 Linux/i386 PC Screen Font v2 data, 61226048Sobrien>16 lelong x %d characters, 62226048Sobrien>12 lelong&0x01 0 no directory, 63226048Sobrien>12 lelong&0x01 !0 Unicode directory, 64226048Sobrien>24 lelong x %d 65226048Sobrien>28 lelong x \bx%d 66226048Sobrien 6768349Sobrien# Linux swap file, from Daniel Quinlan <quinlan@yggdrasil.com> 6868349Sobrien4086 string SWAP-SPACE Linux/i386 swap file 69159764Sobrien# From: Jeff Bailey <jbailey@ubuntu.com> 70159764Sobrien# Linux swap file with swsusp1 image, from Jeff Bailey <jbailey@ubuntu.com> 71159764Sobrien4076 string SWAPSPACE2S1SUSPEND Linux/i386 swap file (new style) with SWSUSP1 image 72226048Sobrien# From: James Hunt <james.hunt@ubuntu.com> 73226048Sobrien4076 string SWAPSPACE2LINHIB0001 Linux/i386 swap file (new style) (compressed hibernate) 74103373Sobrien# according to man page of mkswap (8) March 1999 75226048Sobrien# volume label and UUID Russell Coker 76226048Sobrien# http://etbe.coker.com.au/2008/07/08/label-vs-uuid-vs-device/ 77226048Sobrien4086 string SWAPSPACE2 Linux/i386 swap file (new style), 78226048Sobrien>0x400 long x version %d (4K pages), 79226048Sobrien>0x404 long x size %d pages, 80226048Sobrien>1052 string \0 no label, 81226048Sobrien>1052 string >\0 LABEL=%s, 82226048Sobrien>0x40c belong x UUID=%08x 83226048Sobrien>0x410 beshort x \b-%04x 84226048Sobrien>0x412 beshort x \b-%04x 85226048Sobrien>0x414 beshort x \b-%04x 86226048Sobrien>0x416 belong x \b-%08x 87226048Sobrien>0x41a beshort x \b%04x 88226048Sobrien# From Daniel Novotny <dnovotny@redhat.com> 89226048Sobrien# swap file for PowerPC 90226048Sobrien65526 string SWAPSPACE2 Linux/ppc swap file 9168349Sobrien# 9268349Sobrien# Linux kernel boot images, from Albert Cahalan <acahalan@cs.uml.edu> 9368349Sobrien# and others such as Axel Kohlmeyer <akohlmey@rincewind.chemie.uni-ulm.de> 9468349Sobrien# and Nicol�s Lichtmaier <nick@debian.org> 9568349Sobrien# All known start with: b8 c0 07 8e d8 b8 00 90 8e c0 b9 00 01 29 f6 29 96133359Sobrien# Linux kernel boot images (i386 arch) (Wolfram Kleff) 97133359Sobrien514 string HdrS Linux kernel 98133359Sobrien>510 leshort 0xAA55 x86 boot executable 99186690Sobrien>>518 leshort >0x1ff 100192348Sdelphij>>>529 byte 0 zImage, 101133359Sobrien>>>529 byte 1 bzImage, 102133359Sobrien>>>(526.s+0x200) string >\0 version %s, 103133359Sobrien>>498 leshort 1 RO-rootFS, 104133359Sobrien>>498 leshort 0 RW-rootFS, 105133359Sobrien>>508 leshort >0 root_dev 0x%X, 106133359Sobrien>>502 leshort >0 swap_dev 0x%X, 107133359Sobrien>>504 leshort >0 RAMdisksize %u KB, 108133359Sobrien>>506 leshort 0xFFFF Normal VGA 109133359Sobrien>>506 leshort 0xFFFE Extended VGA 110133359Sobrien>>506 leshort 0xFFFD Prompt for Videomode 111133359Sobrien>>506 leshort >0 Video mode %d 11268349Sobrien# This also matches new kernels, which were caught above by "HdrS". 11368349Sobrien0 belong 0xb8c0078e Linux kernel 11468349Sobrien>0x1e3 string Loading version 1.3.79 or older 11568349Sobrien>0x1e9 string Loading from prehistoric times 116133359Sobrien 117133359Sobrien# System.map files - Nicol�s Lichtmaier <nick@debian.org> 118186690Sobrien8 search/1 \ A\ _text Linux kernel symbol map text 119133359Sobrien 120133359Sobrien# LSM entries - Nicol�s Lichtmaier <nick@debian.org> 121186690Sobrien0 search/1 Begin3 Linux Software Map entry text 122186690Sobrien0 search/1 Begin4 Linux Software Map entry text (new format) 123103373Sobrien 124186690Sobrien# From Matt Zimmerman, enhanced for v3 by Matthew Palmer 125186690Sobrien0 belong 0x4f4f4f4d User-mode Linux COW file 126186690Sobrien>4 belong <3 \b, version %d 127186690Sobrien>>8 string >\0 \b, backing file %s 128186690Sobrien>4 belong >2 \b, version %d 129186690Sobrien>>32 string >\0 \b, backing file %s 130133359Sobrien 131103373Sobrien############################################################################ 132103373Sobrien# Linux kernel versions 133103373Sobrien 134103373Sobrien0 string \xb8\xc0\x07\x8e\xd8\xb8\x00\x90 Linux 135103373Sobrien>497 leshort 0 x86 boot sector 136103373Sobrien>>514 belong 0x8e of a kernel from the dawn of time! 137103373Sobrien>>514 belong 0x908ed8b4 version 0.99-1.1.42 138103373Sobrien>>514 belong 0x908ed8b8 for memtest86 139103373Sobrien 140103373Sobrien>497 leshort !0 x86 kernel 141103373Sobrien>>504 leshort >0 RAMdisksize=%u KB 142103373Sobrien>>502 leshort >0 swap=0x%X 143103373Sobrien>>508 leshort >0 root=0x%X 144103373Sobrien>>>498 leshort 1 \b-ro 145103373Sobrien>>>498 leshort 0 \b-rw 146103373Sobrien>>506 leshort 0xFFFF vga=normal 147103373Sobrien>>506 leshort 0xFFFE vga=extended 148103373Sobrien>>506 leshort 0xFFFD vga=ask 149103373Sobrien>>506 leshort >0 vga=%d 150103373Sobrien>>514 belong 0x908ed881 version 1.1.43-1.1.45 151103373Sobrien>>514 belong 0x15b281cd 152103373Sobrien>>>0xa8e belong 0x55AA5a5a version 1.1.46-1.2.13,1.3.0 153103373Sobrien>>>0xa99 belong 0x55AA5a5a version 1.3.1,2 154103373Sobrien>>>0xaa3 belong 0x55AA5a5a version 1.3.3-1.3.30 155103373Sobrien>>>0xaa6 belong 0x55AA5a5a version 1.3.31-1.3.41 156103373Sobrien>>>0xb2b belong 0x55AA5a5a version 1.3.42-1.3.45 157103373Sobrien>>>0xaf7 belong 0x55AA5a5a version 1.3.46-1.3.72 158103373Sobrien>>514 string HdrS 159103373Sobrien>>>518 leshort >0x1FF 160103373Sobrien>>>>529 byte 0 \b, zImage 161103373Sobrien>>>>529 byte 1 \b, bzImage 162103373Sobrien>>>>(526.s+0x200) string >\0 \b, version %s 163103373Sobrien 164103373Sobrien# Linux boot sector thefts. 165103373Sobrien0 belong 0xb8c0078e Linux 166103373Sobrien>0x1e6 belong 0x454c4b53 ELKS Kernel 167103373Sobrien>0x1e6 belong !0x454c4b53 style boot sector 168103373Sobrien 169103373Sobrien############################################################################ 170226048Sobrien# Linux S390 kernel image 171226048Sobrien# Created by: Jan Kaluza <jkaluza@redhat.com> 172226048Sobrien8 string \x02\x00\x00\x18\x60\x00\x00\x50\x02\x00\x00\x68\x60\x00\x00\x50\x40\x40\x40\x40\x40\x40\x40\x40 Linux S390 173226048Sobrien>0x00010000 search/b/4096 \x00\x0a\x00\x00\x8b\xad\xcc\xcc 174226048Sobrien# 64bit 175226048Sobrien>>&0 string \xc1\x00\xef\xe3\xf0\x68\x00\x00 Z10 64bit kernel 176226048Sobrien>>&0 string \xc1\x00\xef\xc3\x00\x00\x00\x00 Z9-109 64bit kernel 177226048Sobrien>>&0 string \xc0\x00\x20\x00\x00\x00\x00\x00 Z990 64bit kernel 178226048Sobrien>>&0 string \x00\x00\x00\x00\x00\x00\x00\x00 Z900 64bit kernel 179226048Sobrien# 32bit 180226048Sobrien>>&0 string \x81\x00\xc8\x80\x00\x00\x00\x00 Z10 32bit kernel 181226048Sobrien>>&0 string \x81\x00\xc8\x80\x00\x00\x00\x00 Z9-109 32bit kernel 182226048Sobrien>>&0 string \x80\x00\x20\x00\x00\x00\x00\x00 Z990 32bit kernel 183226048Sobrien>>&0 string \x80\x00\x00\x00\x00\x00\x00\x00 Z900 32bit kernel 184226048Sobrien 185234250Sobrien# Linux ARM compressed kernel image 186234250Sobrien# From: Kevin Cernekee <cernekee@gmail.com> 187234250Sobrien36 lelong 0x016f2818 Linux kernel ARM boot executable zImage (little-endian) 188234250Sobrien36 belong 0x016f2818 Linux kernel ARM boot executable zImage (big-endian) 189234250Sobrien 190226048Sobrien############################################################################ 191103373Sobrien# Linux 8086 executable 192103373Sobrien0 lelong&0xFF0000FF 0xC30000E9 Linux-Dev86 executable, headerless 193103373Sobrien>5 string . 194103373Sobrien>>4 string >\0 \b, libc version %s 195103373Sobrien 196103373Sobrien0 lelong&0xFF00FFFF 0x4000301 Linux-8086 executable 197103373Sobrien>2 byte&0x01 !0 \b, unmapped zero page 198103373Sobrien>2 byte&0x20 0 \b, impure 199103373Sobrien>2 byte&0x20 !0 200103373Sobrien>>2 byte&0x10 !0 \b, A_EXEC 201103373Sobrien>2 byte&0x02 !0 \b, A_PAL 202103373Sobrien>2 byte&0x04 !0 \b, A_NSYM 203103373Sobrien>2 byte&0x08 !0 \b, A_STAND 204103373Sobrien>2 byte&0x40 !0 \b, A_PURE 205103373Sobrien>2 byte&0x80 !0 \b, A_TOVLY 206103373Sobrien>28 long !0 \b, not stripped 207103373Sobrien>37 string . 208103373Sobrien>>36 string >\0 \b, libc version %s 209103373Sobrien 210103373Sobrien# 0 lelong&0xFF00FFFF 0x10000301 ld86 I80386 executable 211103373Sobrien# 0 lelong&0xFF00FFFF 0xB000301 ld86 M68K executable 212103373Sobrien# 0 lelong&0xFF00FFFF 0xC000301 ld86 NS16K executable 213103373Sobrien# 0 lelong&0xFF00FFFF 0x17000301 ld86 SPARC executable 214103373Sobrien 215139368Sobrien# SYSLINUX boot logo files (from 'ppmtolss16' sources) 216139368Sobrien# http://syslinux.zytor.com/ 217139368Sobrien# 218139368Sobrien0 lelong =0x1413f33d SYSLINUX' LSS16 image data 219139368Sobrien>4 leshort x \b, width %d 220139368Sobrien>6 leshort x \b, height %d 221159764Sobrien 222159764Sobrien0 string OOOM User-Mode-Linux's Copy-On-Write disk image 223159764Sobrien>4 belong x version %d 224159764Sobrien 225159764Sobrien# SE Linux policy database 226159764Sobrien# From: Mike Frysinger <vapier@gentoo.org> 227159764Sobrien0 lelong 0xf97cff8c SE Linux policy 228159764Sobrien>16 lelong x v%d 229159764Sobrien>20 lelong 1 MLS 230159764Sobrien>24 lelong x %d symbols 231159764Sobrien>28 lelong x %d ocons 232159764Sobrien 233159764Sobrien# Linux Logical Volume Manager (LVM) 234159764Sobrien# Emmanuel VARAGNAT <emmanuel.varagnat@guzu.net> 235159764Sobrien# 236159764Sobrien# System ID, UUID and volume group name are 128 bytes long 237159764Sobrien# but they should never be full and initialized with zeros... 238159764Sobrien# 239159764Sobrien# LVM1 240159764Sobrien# 241159764Sobrien0x0 string HM\001 LVM1 (Linux Logical Volume Manager), version 1 242159764Sobrien>0x12c string >\0 , System ID: %s 243159764Sobrien 244159764Sobrien0x0 string HM\002 LVM1 (Linux Logical Volume Manager), version 2 245159764Sobrien>0x12c string >\0 , System ID: %s 246159764Sobrien 247159764Sobrien# LVM2 248159764Sobrien# 249159764Sobrien# It seems that the label header can be in one the four first sector 250159764Sobrien# of the disk... (from _find_labeller in lib/label/label.c of LVM2) 251159764Sobrien# 252159764Sobrien# 0x200 seems to be the common case 253159764Sobrien 254226048Sobrien0x218 string LVM2\ 001 LVM2 PV (Linux Logical Volume Manager) 255159764Sobrien# read the offset to add to the start of the header, and the header 256159764Sobrien# start in 0x200 257226048Sobrien>&(&-12.l-0x21) byte x 258226048Sobrien# display UUID in LVM format + display all 32 bytes (instead of max string length: 31) 259226048Sobrien>>&0x0 string >\x2f \b, UUID: %.6s 260226048Sobrien>>&0x6 string >\x2f \b-%.4s 261226048Sobrien>>&0xa string >\x2f \b-%.4s 262226048Sobrien>>&0xe string >\x2f \b-%.4s 263226048Sobrien>>&0x12 string >\x2f \b-%.4s 264226048Sobrien>>&0x16 string >\x2f \b-%.4s 265226048Sobrien>>&0x1a string >\x2f \b-%.6s 266226048Sobrien>>&0x20 lequad x \b, size: %lld 267159764Sobrien 268226048Sobrien0x018 string LVM2\ 001 LVM2 PV (Linux Logical Volume Manager) 269226048Sobrien>&(&-12.l-0x21) byte x 270226048Sobrien# display UUID in LVM format + display all 32 bytes (instead of max string length: 31) 271226048Sobrien>>&0x0 string >\x2f \b, UUID: %.6s 272226048Sobrien>>&0x6 string >\x2f \b-%.4s 273226048Sobrien>>&0xa string >\x2f \b-%.4s 274226048Sobrien>>&0xe string >\x2f \b-%.4s 275226048Sobrien>>&0x12 string >\x2f \b-%.4s 276226048Sobrien>>&0x16 string >\x2f \b-%.4s 277226048Sobrien>>&0x1a string >\x2f \b-%.6s 278226048Sobrien>>&0x20 lequad x \b, size: %lld 279159764Sobrien 280226048Sobrien0x418 string LVM2\ 001 LVM2 PV (Linux Logical Volume Manager) 281226048Sobrien>&(&-12.l-0x21) byte x 282226048Sobrien# display UUID in LVM format + display all 32 bytes (instead of max string length: 31) 283226048Sobrien>>&0x0 string >\x2f \b, UUID: %.6s 284226048Sobrien>>&0x6 string >\x2f \b-%.4s 285226048Sobrien>>&0xa string >\x2f \b-%.4s 286226048Sobrien>>&0xe string >\x2f \b-%.4s 287226048Sobrien>>&0x12 string >\x2f \b-%.4s 288226048Sobrien>>&0x16 string >\x2f \b-%.4s 289226048Sobrien>>&0x1a string >\x2f \b-%.6s 290226048Sobrien>>&0x20 lequad x \b, size: %lld 291159764Sobrien 292226048Sobrien0x618 string LVM2\ 001 LVM2 PV (Linux Logical Volume Manager) 293226048Sobrien>&(&-12.l-0x21) byte x 294226048Sobrien# display UUID in LVM format + display all 32 bytes (instead of max string length: 31) 295226048Sobrien>>&0x0 string >\x2f \b, UUID: %.6s 296226048Sobrien>>&0x6 string >\x2f \b-%.4s 297226048Sobrien>>&0xa string >\x2f \b-%.4s 298226048Sobrien>>&0xe string >\x2f \b-%.4s 299226048Sobrien>>&0x12 string >\x2f \b-%.4s 300226048Sobrien>>&0x16 string >\x2f \b-%.4s 301226048Sobrien>>&0x1a string >\x2f \b-%.6s 302226048Sobrien>>&0x20 lequad x \b, size: %lld 303169942Sobrien 304186690Sobrien# LVM snapshot 305186690Sobrien# from Jason Farrel 306186690Sobrien0 string SnAp LVM Snapshot (CopyOnWrite store) 307186690Sobrien>4 lelong !0 - valid, 308186690Sobrien>4 lelong 0 - invalid, 309186690Sobrien>8 lelong x version %d, 310186690Sobrien>12 lelong x chunk_size %d 311186690Sobrien 312169942Sobrien# SE Linux policy database 313169942Sobrien0 lelong 0xf97cff8c SE Linux policy 314169942Sobrien>16 lelong x v%d 315169942Sobrien>20 lelong 1 MLS 316169942Sobrien>24 lelong x %d symbols 317169942Sobrien>28 lelong x %d ocons 318169962Sobrien 319169962Sobrien# LUKS: Linux Unified Key Setup, On-Disk Format, http://luks.endorphin.org/spec 320169962Sobrien# Anthon van der Neut (anthon@mnt.org) 321169962Sobrien0 string LUKS\xba\xbe LUKS encrypted file, 322169962Sobrien>6 beshort x ver %d 323169962Sobrien>8 string x [%s, 324169962Sobrien>40 string x %s, 325169962Sobrien>72 string x %s] 326169962Sobrien>168 string x UUID: %s 327169962Sobrien 328186690Sobrien 329186690Sobrien# Summary: Xen saved domain file 330186690Sobrien# Created by: Radek Vokal <rvokal@redhat.com> 331186690Sobrien0 string LinuxGuestRecord Xen saved domain 332186690Sobrien>20 search/256 (name 333186690Sobrien>>&1 string x (name %s) 334186690Sobrien 335226048Sobrien# Type: Xen, the virtual machine monitor 336226048Sobrien# From: Radek Vokal <rvokal@redhat.com> 337226048Sobrien0 string LinuxGuestRecord Xen saved domain 338226048Sobrien#>2 regex \(name\ [^)]*\) %s 339226048Sobrien>20 search/256 (name (name 340226048Sobrien>>&1 string x %s...) 341