2 #------------------------------------------------------------------------------
3 # $File: linux,v 1.33 2009/10/23 16:44:59 christos Exp $
4 # linux: file(1) magic for Linux files
6 # Values for Linux/i386 binaries, from Daniel Quinlan <quinlan@yggdrasil.com>
7 # The following basic Linux magic is useful for reference, but using
8 # "long" magic is a better practice in order to avoid collisions.
10 # 2 leshort 100 Linux/i386
11 # >0 leshort 0407 impure executable (OMAGIC)
12 # >0 leshort 0410 pure executable (NMAGIC)
13 # >0 leshort 0413 demand-paged executable (ZMAGIC)
14 # >0 leshort 0314 demand-paged executable (QMAGIC)
16 0 lelong 0x00640107 Linux/i386 impure executable (OMAGIC)
17 >16 lelong 0 \b, stripped
18 0 lelong 0x00640108 Linux/i386 pure executable (NMAGIC)
19 >16 lelong 0 \b, stripped
20 0 lelong 0x0064010b Linux/i386 demand-paged executable (ZMAGIC)
21 >16 lelong 0 \b, stripped
22 0 lelong 0x006400cc Linux/i386 demand-paged executable (QMAGIC)
23 >16 lelong 0 \b, stripped
25 0 string \007\001\000 Linux/i386 object file
26 >20 lelong >0x1020 \b, DLL library
28 0 string \01\03\020\04 Linux-8086 impure executable
29 >28 long !0 not stripped
30 0 string \01\03\040\04 Linux-8086 executable
31 >28 long !0 not stripped
33 0 string \243\206\001\0 Linux-8086 object file
35 0 string \01\03\020\20 Minix-386 impure executable
36 >28 long !0 not stripped
37 0 string \01\03\040\20 Minix-386 executable
38 >28 long !0 not stripped
39 # core dump file, from Bill Reynolds <bill@goshawk.lanl.gov>
40 216 lelong 0421 Linux/i386 core file
41 >220 string >\0 of '%s'
42 >200 lelong >0 (signal %d)
44 # LILO boot/chain loaders, from Daniel Quinlan <quinlan@yggdrasil.com>
45 # this can be overridden by the DOS executable (COM) entry
46 2 string LILO Linux/i386 LILO boot/chain loader
48 # PSF fonts, from H. Peter Anvin <hpa@yggdrasil.com>
49 0 leshort 0x0436 Linux/i386 PC Screen Font data,
50 >2 byte 0 256 characters, no directory,
51 >2 byte 1 512 characters, no directory,
52 >2 byte 2 256 characters, Unicode directory,
53 >2 byte 3 512 characters, Unicode directory,
55 # Linux swap file, from Daniel Quinlan <quinlan@yggdrasil.com>
56 4086 string SWAP-SPACE Linux/i386 swap file
57 # From: Jeff Bailey <jbailey@ubuntu.com>
58 # Linux swap file with swsusp1 image, from Jeff Bailey <jbailey@ubuntu.com>
59 4076 string SWAPSPACE2S1SUSPEND Linux/i386 swap file (new style) with SWSUSP1 image
60 # according to man page of mkswap (8) March 1999
61 4086 string SWAPSPACE2 Linux/i386 swap file (new style)
62 >0x400 long x %d (4K pages)
63 >0x404 long x size %d pages
64 >>4086 string SWAPSPACE2
65 >>>1052 string >\0 Label %s
66 # From Daniel Novotny <dnovotny@redhat.com>
67 # swap file for PowerPC
68 65526 string SWAPSPACE2 Linux/ppc swap file
69 # ECOFF magic for OSF/1 and Linux (only tested under Linux though)
71 # from Erik Troan (ewt@redhat.com) examining od dumps, so this
73 # updated by David Mosberger (davidm@azstarnet.com) based on
74 # GNU BFD and MIPS info found below.
76 0 leshort 0x0183 ECOFF alpha
77 >24 leshort 0407 executable
79 >24 leshort 0413 demand paged
80 >8 long >0 not stripped
82 >23 leshort >0 - version %ld.
84 # Linux kernel boot images, from Albert Cahalan <acahalan@cs.uml.edu>
85 # and others such as Axel Kohlmeyer <akohlmey@rincewind.chemie.uni-ulm.de>
86 # and Nicolás Lichtmaier <nick@debian.org>
87 # All known start with: b8 c0 07 8e d8 b8 00 90 8e c0 b9 00 01 29 f6 29
88 # Linux kernel boot images (i386 arch) (Wolfram Kleff)
89 514 string HdrS Linux kernel
90 >510 leshort 0xAA55 x86 boot executable
93 >>>529 byte 1 bzImage,
94 >>>(526.s+0x200) string >\0 version %s,
95 >>498 leshort 1 RO-rootFS,
96 >>498 leshort 0 RW-rootFS,
97 >>508 leshort >0 root_dev 0x%X,
98 >>502 leshort >0 swap_dev 0x%X,
99 >>504 leshort >0 RAMdisksize %u KB,
100 >>506 leshort 0xFFFF Normal VGA
101 >>506 leshort 0xFFFE Extended VGA
102 >>506 leshort 0xFFFD Prompt for Videomode
103 >>506 leshort >0 Video mode %d
104 # This also matches new kernels, which were caught above by "HdrS".
105 0 belong 0xb8c0078e Linux kernel
106 >0x1e3 string Loading version 1.3.79 or older
107 >0x1e9 string Loading from prehistoric times
109 # System.map files - Nicolás Lichtmaier <nick@debian.org>
110 8 search/1 \ A\ _text Linux kernel symbol map text
112 # LSM entries - Nicolás Lichtmaier <nick@debian.org>
113 0 search/1 Begin3 Linux Software Map entry text
114 0 search/1 Begin4 Linux Software Map entry text (new format)
116 # From Matt Zimmerman, enhanced for v3 by Matthew Palmer
117 0 belong 0x4f4f4f4d User-mode Linux COW file
118 >4 belong <3 \b, version %d
119 >>8 string >\0 \b, backing file %s
120 >4 belong >2 \b, version %d
121 >>32 string >\0 \b, backing file %s
123 ############################################################################
124 # Linux kernel versions
126 0 string \xb8\xc0\x07\x8e\xd8\xb8\x00\x90 Linux
127 >497 leshort 0 x86 boot sector
128 >>514 belong 0x8e of a kernel from the dawn of time!
129 >>514 belong 0x908ed8b4 version 0.99-1.1.42
130 >>514 belong 0x908ed8b8 for memtest86
132 >497 leshort !0 x86 kernel
133 >>504 leshort >0 RAMdisksize=%u KB
134 >>502 leshort >0 swap=0x%X
135 >>508 leshort >0 root=0x%X
136 >>>498 leshort 1 \b-ro
137 >>>498 leshort 0 \b-rw
138 >>506 leshort 0xFFFF vga=normal
139 >>506 leshort 0xFFFE vga=extended
140 >>506 leshort 0xFFFD vga=ask
141 >>506 leshort >0 vga=%d
142 >>514 belong 0x908ed881 version 1.1.43-1.1.45
143 >>514 belong 0x15b281cd
144 >>>0xa8e belong 0x55AA5a5a version 1.1.46-1.2.13,1.3.0
145 >>>0xa99 belong 0x55AA5a5a version 1.3.1,2
146 >>>0xaa3 belong 0x55AA5a5a version 1.3.3-1.3.30
147 >>>0xaa6 belong 0x55AA5a5a version 1.3.31-1.3.41
148 >>>0xb2b belong 0x55AA5a5a version 1.3.42-1.3.45
149 >>>0xaf7 belong 0x55AA5a5a version 1.3.46-1.3.72
151 >>>518 leshort >0x1FF
152 >>>>529 byte 0 \b, zImage
153 >>>>529 byte 1 \b, bzImage
154 >>>>(526.s+0x200) string >\0 \b, version %s
156 # Linux boot sector thefts.
157 0 belong 0xb8c0078e Linux
158 >0x1e6 belong 0x454c4b53 ELKS Kernel
159 >0x1e6 belong !0x454c4b53 style boot sector
161 ############################################################################
162 # Linux 8086 executable
163 0 lelong&0xFF0000FF 0xC30000E9 Linux-Dev86 executable, headerless
165 >>4 string >\0 \b, libc version %s
167 0 lelong&0xFF00FFFF 0x4000301 Linux-8086 executable
168 >2 byte&0x01 !0 \b, unmapped zero page
169 >2 byte&0x20 0 \b, impure
171 >>2 byte&0x10 !0 \b, A_EXEC
172 >2 byte&0x02 !0 \b, A_PAL
173 >2 byte&0x04 !0 \b, A_NSYM
174 >2 byte&0x08 !0 \b, A_STAND
175 >2 byte&0x40 !0 \b, A_PURE
176 >2 byte&0x80 !0 \b, A_TOVLY
177 >28 long !0 \b, not stripped
179 >>36 string >\0 \b, libc version %s
181 # 0 lelong&0xFF00FFFF 0x10000301 ld86 I80386 executable
182 # 0 lelong&0xFF00FFFF 0xB000301 ld86 M68K executable
183 # 0 lelong&0xFF00FFFF 0xC000301 ld86 NS16K executable
184 # 0 lelong&0xFF00FFFF 0x17000301 ld86 SPARC executable
186 # SYSLINUX boot logo files (from 'ppmtolss16' sources)
187 # http://syslinux.zytor.com/
189 0 lelong =0x1413f33d SYSLINUX' LSS16 image data
190 >4 leshort x \b, width %d
191 >6 leshort x \b, height %d
193 0 string OOOM User-Mode-Linux's Copy-On-Write disk image
194 >4 belong x version %d
196 # SE Linux policy database
197 # From: Mike Frysinger <vapier@gentoo.org>
198 0 lelong 0xf97cff8c SE Linux policy
201 >24 lelong x %d symbols
202 >28 lelong x %d ocons
204 # Linux Logical Volume Manager (LVM)
205 # Emmanuel VARAGNAT <emmanuel.varagnat@guzu.net>
207 # System ID, UUID and volume group name are 128 bytes long
208 # but they should never be full and initialized with zeros...
212 0x0 string HM\001 LVM1 (Linux Logical Volume Manager), version 1
213 >0x12c string >\0 , System ID: %s
215 0x0 string HM\002 LVM1 (Linux Logical Volume Manager), version 2
216 >0x12c string >\0 , System ID: %s
220 # It seems that the label header can be in one the four first sector
221 # of the disk... (from _find_labeller in lib/label/label.c of LVM2)
223 # 0x200 seems to be the common case
225 0x218 string LVM2\ 001 LVM2 (Linux Logical Volume Manager)
226 # read the offset to add to the start of the header, and the header
228 >(0x214.l+0x200) string >\0 , UUID: %s
230 0x018 string LVM2\ 001 LVM2 (Linux Logical Volume Manager)
231 >(0x014.l) string >\0 , UUID: %s
233 0x418 string LVM2\ 001 LVM2 (Linux Logical Volume Manager)
234 >(0x414.l+0x400) string >\0 , UUID: %s
236 0x618 string LVM2\ 001 LVM2 (Linux Logical Volume Manager)
237 >(0x614.l+0x600) string >\0 , UUID: %s
241 0 string SnAp LVM Snapshot (CopyOnWrite store)
242 >4 lelong !0 - valid,
243 >4 lelong 0 - invalid,
244 >8 lelong x version %d,
245 >12 lelong x chunk_size %d
247 # SE Linux policy database
248 0 lelong 0xf97cff8c SE Linux policy
251 >24 lelong x %d symbols
252 >28 lelong x %d ocons
254 # LUKS: Linux Unified Key Setup, On-Disk Format, http://luks.endorphin.org/spec
255 # Anthon van der Neut (anthon@mnt.org)
256 0 string LUKS\xba\xbe LUKS encrypted file,
261 >168 string x UUID: %s
264 # Summary: Xen saved domain file
265 # Created by: Radek Vokal <rvokal@redhat.com>
266 0 string LinuxGuestRecord Xen saved domain
268 >>&1 string x (name %s)