You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An apparently valid ELF file (when doing static analysis) causes a
segmentation fault when loaded. The kernel sends out a SIGSEGV signal
because something is not right with the ELF program. Use ftrace or some
similar tool to identify the root cause of the SIGSEGV in the kernel
code.
Signed-off-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Copy file name to clipboardExpand all lines: Documentation/teaching/labs/kernel_profiling.rst
+39Lines changed: 39 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -432,3 +432,42 @@ or is it a scheduling issue?
432
432
Try to trace the I/O operations using ``perf``, or use the
433
433
``iosnoop.sh`` script in order to inspect what I/O is happening at a
434
434
certain point.
435
+
436
+
5. Bad ELF
437
+
----------
438
+
439
+
.. note::
440
+
441
+
This is a bonus exercise that has been tested on a native Linux system.
442
+
It may run under the QEMU virtual machine, but the behavior was weird in our testing.
443
+
We recommend you used a native (or VirtualBox or VMware) Linux system.
444
+
445
+
We managed to build (as part of a `Unikraft <https://github.com/unikraft/unikraft>`__ build) an ELF file that is valid when doing static analysis, but that can't be executed.
446
+
The file is ``bad_elf``, located in the ``5-bad-elf/`` folder.
447
+
448
+
Running it triggers a *segmentation fault* message.
449
+
Running it using ``strace`` show an error with ``execve()``.
... skels/kernel_profiling/5-bad-elf$ readelf -a bad_elf
467
+
468
+
The issue is to be detected in the kernel.
469
+
470
+
Use either ``perf``, or, better yet `ftrace <https://jvns.ca/blog/2017/03/19/getting-started-with-ftrace/>`__ to inspect the kernel function calls done by the program.
471
+
Identify the function call that sends out the ``SIGSEGV`` signal.
472
+
Identify the cause of the issue.
473
+
Find that cause in the `manual page elf(5) <https://linux.die.net/man/5/elf>`__.
0 commit comments