Language Selection

English French German Italian Portuguese Spanish

Understanding a Kernel OOPS

Filed under
Linux
HowTos

Understanding a kernel panic and doing forensics to catch the bug is considered a hacker‘s job. This is one of those complex tasks that requires a sound knowledge of the architecture you are working on, and the internals of the Linux kernel. Depending the on the type of error detected by the kernel, panics in the Linux kernel are classified as hard panics (Aiee!) and soft panics (Oops!). This article explains a sample Linux kernel oops, and helps to create a simple oops and debug it. It is mainly intended for developers getting into kernel development, who need to debug the panics that the kernel throws at them. Knowledge of the Linux kernel, and C programming, is assumed.

An oops is what the kernel throws at us when it finds something faulty, or an exception, in the kernel code. Oopses are somewhat like the segfaults of user-space. An oops dumps its message on the console; it contains processor status, and CPU registers when the fault occurred. The offending process which triggered this oops gets killed without releasing locks or cleaning up structures. The system may not even resume its normal operations sometimes; this is called an unstable state. Once an oops has occurred, the system cannot be trusted any further.

Let’s try to generate an oops message with sample code, and try to understand the dump.

Setting up the machine to capture an oops

The running kernel should be compiled with CONFIG_DEBUG_INFO, and syslogd should be running. To generate and understand an oops message, let’s throw together a sample kernel module, oops.c:

rest here




More in Tux Machines

Android Leftovers

Software and Development: CodeBlocks, Cumulonimbus, LibreOffice, devRantron, GCC

  • CodeBlocks – A Free & Cross-Platform C, C++ and Fortran IDE
    CodeBlocks is a free and open-source IDE for C, C++ and FORTRAN development. It features a consistent User Interface across all desktop platforms with a class browser, a tabbed interface, and its functions can be extended using plugins. It also features keyboard shortcuts, smart indentation, code folding, and a to-do list management panel that different users can use, among others. It is written in C++ and it does not require any interpreted languages or proprietary libraries.
  • Cumulonimbus: Terrible Name, Terrific Podcast Client
    Unlike many other Electron podcast apps I have come across on Github this one is still being developed, is easy to install, and it supports Linux.
  • LibreOffice Calc Is Finally Being Threaded
    While LibreOffice Calc for a while now has been offering OpenCL support for speeding up spreadsheet computations, with not all drivers/GPUs supporting OpenCL, this Microsoft Office alternative is finally receiving proper multi-threading support. Collabora developers have landed their initial work on multi-threading / parallelism as they look to speed-up the LibreOffice Calc spreadsheet program's calculations.
  • devRantron – An Unofficial Desktop Client for devRant Programmers
    devRantron is a free, open-source, and cross-platform (unofficial) desktop client for the famous Dev Rant Android and iOS social media application for programmers, developers, and designers. Before now, devRant was only accessible on the mobile phones, but now users can post complaints and follow up on rants by developers from all around the globe even while working on their desktops and it’s thanks to a group of friends who concluded that devRant was taking too long to deliver a desktop client.
  • The New Compiler Features & Changes Of GCC 8
    With GCC 8 feature development over and onto bug fixing, here is a look at some of the changes to find with the GCC 8 compiler stack that will be released as stable early next year in the form of GCC 8.1.

ONAP Rolls Out Amsterdam Release

Less than nine months after AT&T and the Linux Foundation merged their open source projects to become the Open Network Automation Platform (ONAP), the group today rolled out its first code release, Amsterdam. The highly anticipated release, which integrates AT&T’s ECOMP and the Linux Foundation’s Open-O code bases into a common open source orchestration platform, aims to automate the virtualization of network services. Read more

Inspiring the Next Generation of Open Source

The Linux Foundation works through our projects, training and certification programs, events and more to bring people of all backgrounds into open source. We meet a lot of people, but find the drive and enthusiasm of some of our youngest community members to be especially infectious. In the past couple of months, we’ve invited 13-year-old algorithmist and cognitive developer Tanmay Bakshi, 11-year-old hacker and cybersecurity ambassador Reuben Paul, and 15-year-old programmer Keila Banks to speak at Linux Foundation conferences. In 2014 when he was 12, Zachary Dupont wrote a letter to his hero Linus Torvalds. We arranged for Zach to meet Linus–a visit that helped clinch his love for Linux. This year, Zach came to Open Source Summit in Los Angeles to catch up with Linus and let us know what he’s been up to. He’s kept busy with an internship at SAP and early acceptance to the Computer Networking and Digital Forensics program at the Delaware County Technical School. Read more