linux revision 192348
1219019Sgabor#------------------------------------------------------------------------------ 2219019Sgabor# linux: file(1) magic for Linux files 3219019Sgabor# 4219019Sgabor# Values for Linux/i386 binaries, from Daniel Quinlan <quinlan@yggdrasil.com> 5219019Sgabor# The following basic Linux magic is useful for reference, but using 6219019Sgabor# "long" magic is a better practice in order to avoid collisions. 7219019Sgabor# 8219019Sgabor# 2 leshort 100 Linux/i386 9219019Sgabor# >0 leshort 0407 impure executable (OMAGIC) 10219019Sgabor# >0 leshort 0410 pure executable (NMAGIC) 11219019Sgabor# >0 leshort 0413 demand-paged executable (ZMAGIC) 12219019Sgabor# >0 leshort 0314 demand-paged executable (QMAGIC) 13219019Sgabor# 14219019Sgabor0 lelong 0x00640107 Linux/i386 impure executable (OMAGIC) 15219019Sgabor>16 lelong 0 \b, stripped 16219019Sgabor0 lelong 0x00640108 Linux/i386 pure executable (NMAGIC) 17219019Sgabor>16 lelong 0 \b, stripped 18219019Sgabor0 lelong 0x0064010b Linux/i386 demand-paged executable (ZMAGIC) 19219019Sgabor>16 lelong 0 \b, stripped 20219019Sgabor0 lelong 0x006400cc Linux/i386 demand-paged executable (QMAGIC) 21219019Sgabor>16 lelong 0 \b, stripped 22219019Sgabor# 23219019Sgabor0 string \007\001\000 Linux/i386 object file 24219019Sgabor>20 lelong >0x1020 \b, DLL library 25219019Sgabor# Linux-8086 stuff: 26219019Sgabor0 string \01\03\020\04 Linux-8086 impure executable 27219019Sgabor>28 long !0 not stripped 28219019Sgabor0 string \01\03\040\04 Linux-8086 executable 29219019Sgabor>28 long !0 not stripped 30219019Sgabor# 31219019Sgabor0 string \243\206\001\0 Linux-8086 object file 32219019Sgabor# 33219019Sgabor0 string \01\03\020\20 Minix-386 impure executable 34219019Sgabor>28 long !0 not stripped 35219019Sgabor0 string \01\03\040\20 Minix-386 executable 36219019Sgabor>28 long !0 not stripped 37219019Sgabor# core dump file, from Bill Reynolds <bill@goshawk.lanl.gov> 38219019Sgabor216 lelong 0421 Linux/i386 core file 39219019Sgabor>220 string >\0 of '%s' 40219019Sgabor>200 lelong >0 (signal %d) 41219019Sgabor# 42219019Sgabor# LILO boot/chain loaders, from Daniel Quinlan <quinlan@yggdrasil.com> 43219019Sgabor# this can be overridden by the DOS executable (COM) entry 44219019Sgabor2 string LILO Linux/i386 LILO boot/chain loader 45219019Sgabor# 46219019Sgabor# PSF fonts, from H. Peter Anvin <hpa@yggdrasil.com> 47219019Sgabor0 leshort 0x0436 Linux/i386 PC Screen Font data, 48219019Sgabor>2 byte 0 256 characters, no directory, 49219019Sgabor>2 byte 1 512 characters, no directory, 50219019Sgabor>2 byte 2 256 characters, Unicode directory, 51219019Sgabor>2 byte 3 512 characters, Unicode directory, 52219019Sgabor>3 byte >0 8x%d 53219019Sgabor# Linux swap file, from Daniel Quinlan <quinlan@yggdrasil.com> 54219019Sgabor4086 string SWAP-SPACE Linux/i386 swap file 55219019Sgabor# From: Jeff Bailey <jbailey@ubuntu.com> 56219019Sgabor# Linux swap file with swsusp1 image, from Jeff Bailey <jbailey@ubuntu.com> 57219019Sgabor4076 string SWAPSPACE2S1SUSPEND Linux/i386 swap file (new style) with SWSUSP1 image 58219019Sgabor# according to man page of mkswap (8) March 1999 59219019Sgabor4086 string SWAPSPACE2 Linux/i386 swap file (new style) 60219019Sgabor>0x400 long x %d (4K pages) 61219019Sgabor>0x404 long x size %d pages 62219019Sgabor>>4086 string SWAPSPACE2 63219019Sgabor>>>1052 string >\0 Label %s 64219019Sgabor# ECOFF magic for OSF/1 and Linux (only tested under Linux though) 65219019Sgabor# 66219019Sgabor# from Erik Troan (ewt@redhat.com) examining od dumps, so this 67219019Sgabor# could be wrong 68219019Sgabor# updated by David Mosberger (davidm@azstarnet.com) based on 69219019Sgabor# GNU BFD and MIPS info found below. 70219019Sgabor# 71219019Sgabor0 leshort 0x0183 ECOFF alpha 72219019Sgabor>24 leshort 0407 executable 73219019Sgabor>24 leshort 0410 pure 74219019Sgabor>24 leshort 0413 demand paged 75219019Sgabor>8 long >0 not stripped 76219019Sgabor>8 long 0 stripped 77219019Sgabor>23 leshort >0 - version %ld. 78219019Sgabor# 79219019Sgabor# Linux kernel boot images, from Albert Cahalan <acahalan@cs.uml.edu> 80219019Sgabor# and others such as Axel Kohlmeyer <akohlmey@rincewind.chemie.uni-ulm.de> 81219019Sgabor# and Nicol�s Lichtmaier <nick@debian.org> 82219019Sgabor# All known start with: b8 c0 07 8e d8 b8 00 90 8e c0 b9 00 01 29 f6 29 83219019Sgabor# Linux kernel boot images (i386 arch) (Wolfram Kleff) 84219019Sgabor514 string HdrS Linux kernel 85219019Sgabor>510 leshort 0xAA55 x86 boot executable 86219019Sgabor>>518 leshort >0x1ff 87219019Sgabor>>>529 byte 0 zImage, 88219019Sgabor>>>529 byte 1 bzImage, 89219019Sgabor>>>(526.s+0x200) string >\0 version %s, 90219019Sgabor>>498 leshort 1 RO-rootFS, 91219019Sgabor>>498 leshort 0 RW-rootFS, 92219019Sgabor>>508 leshort >0 root_dev 0x%X, 93219019Sgabor>>502 leshort >0 swap_dev 0x%X, 94219019Sgabor>>504 leshort >0 RAMdisksize %u KB, 95219019Sgabor>>506 leshort 0xFFFF Normal VGA 96219019Sgabor>>506 leshort 0xFFFE Extended VGA 97219019Sgabor>>506 leshort 0xFFFD Prompt for Videomode 98219019Sgabor>>506 leshort >0 Video mode %d 99219019Sgabor# This also matches new kernels, which were caught above by "HdrS". 100219019Sgabor0 belong 0xb8c0078e Linux kernel 101219019Sgabor>0x1e3 string Loading version 1.3.79 or older 102219019Sgabor>0x1e9 string Loading from prehistoric times 103219019Sgabor 104219019Sgabor# System.map files - Nicol�s Lichtmaier <nick@debian.org> 105219019Sgabor8 search/1 \ A\ _text Linux kernel symbol map text 106219019Sgabor 107219019Sgabor# LSM entries - Nicol�s Lichtmaier <nick@debian.org> 108219019Sgabor0 search/1 Begin3 Linux Software Map entry text 109219019Sgabor0 search/1 Begin4 Linux Software Map entry text (new format) 110219019Sgabor 111219019Sgabor# From Matt Zimmerman, enhanced for v3 by Matthew Palmer 112219019Sgabor0 belong 0x4f4f4f4d User-mode Linux COW file 113219019Sgabor>4 belong <3 \b, version %d 114219019Sgabor>>8 string >\0 \b, backing file %s 115219019Sgabor>4 belong >2 \b, version %d 116219019Sgabor>>32 string >\0 \b, backing file %s 117219019Sgabor 118219019Sgabor############################################################################ 119219019Sgabor# Linux kernel versions 120219019Sgabor 121219019Sgabor0 string \xb8\xc0\x07\x8e\xd8\xb8\x00\x90 Linux 122>497 leshort 0 x86 boot sector 123>>514 belong 0x8e of a kernel from the dawn of time! 124>>514 belong 0x908ed8b4 version 0.99-1.1.42 125>>514 belong 0x908ed8b8 for memtest86 126 127>497 leshort !0 x86 kernel 128>>504 leshort >0 RAMdisksize=%u KB 129>>502 leshort >0 swap=0x%X 130>>508 leshort >0 root=0x%X 131>>>498 leshort 1 \b-ro 132>>>498 leshort 0 \b-rw 133>>506 leshort 0xFFFF vga=normal 134>>506 leshort 0xFFFE vga=extended 135>>506 leshort 0xFFFD vga=ask 136>>506 leshort >0 vga=%d 137>>514 belong 0x908ed881 version 1.1.43-1.1.45 138>>514 belong 0x15b281cd 139>>>0xa8e belong 0x55AA5a5a version 1.1.46-1.2.13,1.3.0 140>>>0xa99 belong 0x55AA5a5a version 1.3.1,2 141>>>0xaa3 belong 0x55AA5a5a version 1.3.3-1.3.30 142>>>0xaa6 belong 0x55AA5a5a version 1.3.31-1.3.41 143>>>0xb2b belong 0x55AA5a5a version 1.3.42-1.3.45 144>>>0xaf7 belong 0x55AA5a5a version 1.3.46-1.3.72 145>>514 string HdrS 146>>>518 leshort >0x1FF 147>>>>529 byte 0 \b, zImage 148>>>>529 byte 1 \b, bzImage 149>>>>(526.s+0x200) string >\0 \b, version %s 150 151# Linux boot sector thefts. 1520 belong 0xb8c0078e Linux 153>0x1e6 belong 0x454c4b53 ELKS Kernel 154>0x1e6 belong !0x454c4b53 style boot sector 155 156############################################################################ 157# Linux 8086 executable 1580 lelong&0xFF0000FF 0xC30000E9 Linux-Dev86 executable, headerless 159>5 string . 160>>4 string >\0 \b, libc version %s 161 1620 lelong&0xFF00FFFF 0x4000301 Linux-8086 executable 163>2 byte&0x01 !0 \b, unmapped zero page 164>2 byte&0x20 0 \b, impure 165>2 byte&0x20 !0 166>>2 byte&0x10 !0 \b, A_EXEC 167>2 byte&0x02 !0 \b, A_PAL 168>2 byte&0x04 !0 \b, A_NSYM 169>2 byte&0x08 !0 \b, A_STAND 170>2 byte&0x40 !0 \b, A_PURE 171>2 byte&0x80 !0 \b, A_TOVLY 172>28 long !0 \b, not stripped 173>37 string . 174>>36 string >\0 \b, libc version %s 175 176# 0 lelong&0xFF00FFFF 0x10000301 ld86 I80386 executable 177# 0 lelong&0xFF00FFFF 0xB000301 ld86 M68K executable 178# 0 lelong&0xFF00FFFF 0xC000301 ld86 NS16K executable 179# 0 lelong&0xFF00FFFF 0x17000301 ld86 SPARC executable 180 181# SYSLINUX boot logo files (from 'ppmtolss16' sources) 182# http://syslinux.zytor.com/ 183# 1840 lelong =0x1413f33d SYSLINUX' LSS16 image data 185>4 leshort x \b, width %d 186>6 leshort x \b, height %d 187 1880 string OOOM User-Mode-Linux's Copy-On-Write disk image 189>4 belong x version %d 190 191# SE Linux policy database 192# From: Mike Frysinger <vapier@gentoo.org> 1930 lelong 0xf97cff8c SE Linux policy 194>16 lelong x v%d 195>20 lelong 1 MLS 196>24 lelong x %d symbols 197>28 lelong x %d ocons 198 199# Linux Logical Volume Manager (LVM) 200# Emmanuel VARAGNAT <emmanuel.varagnat@guzu.net> 201# 202# System ID, UUID and volume group name are 128 bytes long 203# but they should never be full and initialized with zeros... 204# 205# LVM1 206# 2070x0 string HM\001 LVM1 (Linux Logical Volume Manager), version 1 208>0x12c string >\0 , System ID: %s 209 2100x0 string HM\002 LVM1 (Linux Logical Volume Manager), version 2 211>0x12c string >\0 , System ID: %s 212 213# LVM2 214# 215# It seems that the label header can be in one the four first sector 216# of the disk... (from _find_labeller in lib/label/label.c of LVM2) 217# 218# 0x200 seems to be the common case 219 2200x218 string LVM2\ 001 LVM2 (Linux Logical Volume Manager) 221# read the offset to add to the start of the header, and the header 222# start in 0x200 223>(0x214.l+0x200) string >\0 , UUID: %s 224 2250x018 string LVM2\ 001 LVM2 (Linux Logical Volume Manager) 226>(0x014.l) string >\0 , UUID: %s 227 2280x418 string LVM2\ 001 LVM2 (Linux Logical Volume Manager) 229>(0x414.l+0x400) string >\0 , UUID: %s 230 2310x618 string LVM2\ 001 LVM2 (Linux Logical Volume Manager) 232>(0x614.l+0x600) string >\0 , UUID: %s 233 234# LVM snapshot 235# from Jason Farrel 2360 string SnAp LVM Snapshot (CopyOnWrite store) 237>4 lelong !0 - valid, 238>4 lelong 0 - invalid, 239>8 lelong x version %d, 240>12 lelong x chunk_size %d 241 242# SE Linux policy database 2430 lelong 0xf97cff8c SE Linux policy 244>16 lelong x v%d 245>20 lelong 1 MLS 246>24 lelong x %d symbols 247>28 lelong x %d ocons 248 249# LUKS: Linux Unified Key Setup, On-Disk Format, http://luks.endorphin.org/spec 250# Anthon van der Neut (anthon@mnt.org) 2510 string LUKS\xba\xbe LUKS encrypted file, 252>6 beshort x ver %d 253>8 string x [%s, 254>40 string x %s, 255>72 string x %s] 256>168 string x UUID: %s 257 258 259# Summary: Xen saved domain file 260# Created by: Radek Vokal <rvokal@redhat.com> 2610 string LinuxGuestRecord Xen saved domain 262>20 search/256 (name 263>>&1 string x (name %s) 264 265