34

Inspired by some comments on the question "The history of the NULL pointer":-

There was a practice in the '70s to use the hexadecimal code 0xDEADBEEF to indicate an invalid value. This could be to fill memory that was freed after a previous allocation, as the value of NULL in C, or as an inaccessible address.

The use of DEADBEEF is said to have originated on IBM midrange machines, as an easily identifiable error code when looking at a hex dump. My experience of it is on VMS on DEC Vax machines, it allegedly was used on Apple Macs and the Commodore Amiga. However, I haven't encountered it in use for several years.

Quick searching throws up differing and contradictory stories as to its spread and usage, so...

Did IBM system engineers change jobs and take DEADBEEF with them as a code in other systems?

user3840170
  • 23,072
  • 4
  • 91
  • 150
Chenmunka
  • 8,141
  • 3
  • 39
  • 65
  • 15
    It’s used quite a bit in the Linux kernel: git grep -i deadbeef | wc -l prints 404. According to Wikipedia it’s also used to mark freed memory in Solaris. – Stephen Kitt Feb 06 '18 at 13:12
  • 4
    I realy can't add hard facts here, just hearsay - and an experiance that all machines I fould it where big endian types. Personally I'd put its usage more into the region of the 80s desprite being developed in the 70s, as it is based on the existence 32 bit pointers. – Raffzahn Feb 06 '18 at 13:20
  • 2
    BTW: Love the question, even though I have no answer. – Raffzahn Feb 06 '18 at 13:21
  • From what I remember, it's used in a JVM for something internal like the type tag on a certain object or something. – Omar and Lorraine Feb 06 '18 at 13:37
  • 11
    Note than an Ox is also of species of bovine cattle. – Stavr00 Feb 06 '18 at 14:45
  • @Chenmunka, is your question about where the value is used nowadays, or about its history? – Stephen Kitt Feb 06 '18 at 15:23
  • related: https://stackoverflow.com/questions/2907262/what-does-dead-beef-mean - Also has some usages – tofro Feb 06 '18 at 15:37
  • 4
    FWIW, the Dalvik VM on Android dereferenced 0xdeadd00d and 0xdeadbaad to cause specific crash signatures when internal problems were detected. That was a play on 0xdeadbeef. (This causes a segmentation fault on 32-bit Android because 0xdead**** is an address in Linux kernel space that user-space code can't write to.) – fadden Feb 06 '18 at 16:27
  • However, I haven't encountered it in use for several years.<-- I've seen it used in production code circa 2005. – Matt Lacey Feb 06 '18 at 23:35
  • 1
    It's not an answer because the question is "how widely used was" rather than is but a quick in-code search on GitHub — https://github.com/search?q=0xdeadbeef&type=Code&utf8=%E2%9C%93 — provides 2,705,863 usages. Huge numbers of duplicates because that double(/triple/etc) counts forks and the like but it's clearly there in QEMU, GDB binutils and Python. – Tommy Feb 07 '18 at 16:38
  • 1
    @StephenKitt - I can attest to the solaris connection, as that's where I first encountered it. It's also used for the same purposes in some debug builds of glibc (I don't know whether this information is still current, however, as most of my low-level work tends to be in other environments, these days...). – Jules Feb 07 '18 at 20:55
  • I still use it for some things today. Like tripping a logic analyzer on a data corruption/miscompare issue when bringing up new hardware. It's just a value, like any other hex sequence you might use. There are a lot of english words that can be spelled with just hex and a loose interpretation of 0, 1, etc. – Randy Howard Feb 10 '18 at 04:16
  • 1
    Since the late 70s, I have been using DEADBEEF, 00C0FFEE, F00D5AFE and all sorts of words that I could make up with 1 as I, 2 as Z, 5 as S, 6 as G. 5AFEBEEF was a favourite during the BSE scare. In those days, you just made up stuff to keep the debuggers and bug reporters amused. I've never seen it in any production code except the stuff I write. Brings a smile to your face when reading there is C0FFEE is coming through the network or 5AFE BEEF is appearing all over the screen. If someone is using a logic analyser it would be the AA/55 or CC/33: nice, easily recognizable patterns. – cup Feb 09 '20 at 10:51
  • I seem to remember that certain HP's MPE machines would display F0FF as a status.... – user16204 Feb 09 '20 at 07:41
  • @cup, just remember 0xDECAFBAD. – Geo... Nov 22 '23 at 14:35
  • A games company I worked at in the early 2000s used it when developing memory systems on Nintendo handhelds. – Matt Lacey Nov 22 '23 at 14:51
  • 1
  • I was never an IBM programmer and I've used 0xDEADBEEF in my career stretching from the 90's till now. – Michael Kohne Dec 04 '23 at 19:43

4 Answers4

25

It can be found in implementations of zfs such as OpenZFS, inherited from the Solaris Kernel Memory C header file:

https://github.com/openzfs/openzfs/blob/master/usr/src/uts/common/sys/kmem_impl.h line 80

#define KMEM_FREE_PATTERN       0xdeadbeefdeadbeefULL

Quote from the magic number wiki page:

"Dead beef", Famously used on IBM systems such as the RS/6000, also used in the classic Mac OS operating systems, OPENSTEP Enterprise, and the Commodore Amiga. On Sun Microsystems' Solaris, marks freed kernel memory (KMEM_FREE_PATTERN)

Stavr00
  • 938
  • 6
  • 10
16

In a similar vein, Algol-68R on ICL 1900 (a 24-bit machine) initialized memory to -6815700, which when displayed as text (four 6-bit characters), spelled 'F00L', as well as possessing numerous other virtues.

https://en.wikipedia.org/wiki/ALGOL_68-R#F00L

dave
  • 35,301
  • 3
  • 80
  • 160
  • 1
    I remember that - mainly used to show that the memory was uninitialized. Always got lots of F00Ls when the program crashed. – cup Feb 09 '20 at 10:56
  • That is a FourCC code. Although the term was probably not coined back then. – PaulHK Feb 10 '20 at 06:26
  • 3
    Myrias, a parallel processor company I worked for in the 80's, used 0x4E4F4E4F for uninitialized memory. Looking out for NONO's in data was a common activity :-) – Travelling Man May 21 '23 at 18:57
5

I've been working on IBM CICS transaction system and VSE operating system in the middle '80s and in the system dumps (I can't really remember if VSE's or CICS's) programmers put what they called "eyecatchers". The most famous one was really 0xDEADBEEF. I'm pretty sure I've seen and used it a couple of times... it helped you spot the control block in the dump page and from there you could easily position to the offset you needed to check. Remember that dumps, at those times, were pack of printed paper weighing some Kg. I tried to search for this specific eyecatcher on the net but could not find anything related... maybe some old (wiser) IBMer could remember if it was CICS or VSE!

truxpin
  • 51
  • 1
  • 2
2

HETE 2 used DEADBEEF as padding in the downlink, together with BABECAFE as packet sync.

John Doty
  • 2,344
  • 6
  • 12