This time I will shortly iterate over the finished tasks as I would like to present slides on ptrace(2) in NetBSD.
As usual hundreds of ATF tests were introduced, few Problem Reports filed and two patches upstreamed to LLDB.
What has been done in NetBSD
I've managed to achieve the following goals:
- Marked exect(3) obsolete in libc
- Removed libpthread_dbg(3) from the base distribution
- Added new ptrace(2) operations PT_SET_SIGMASK and PT_GET_SIGMASK
- Switch ptrace(2) PT_WATCHPOINT API to PT_GETDBRGS and PT_SETDBREGS
- Validation of ptrace(2) PT_SYSCALL
The exect(3) interface is no longer functional and it's the proper time to obsolete it. The libpthread_dbg(3) library is no longer needed, it became unnecessary along with the M:N thread model removal.
I originally added the PT_*ET_SIGMASK interface in order to help the criu port for NetBSD. This software is used to checkpoint programs on Linux. Debuggers can also have checkpointing support, for example GDB/Linux has this ability.
The debug registers are finally in the proper form on NetBSD. The previous API had defects as it was designed to be safe, but keeping it safe on the kernel side was impractical. I've finally decided to adapt it to the existing FreeBSD semantics and reuse PT_*ETDBREGS operations. I've verified this new API on real hardware amd64 (Intel i7) and i386 (Intel Pentium IV) with newly written 390 tests. It's worth noting that this API renders GDB to support hardware watchpoints on NetBSD almost out-of-the-box! However it's not free of bugs, after catching a watchpoint, GDB enters on a trap in a dynamic linker (?).
(gdb) c Continuing. Watchpoint 2: traceme Old value = 0 New value = 16 main (argc=1, argv=0x7f7fff79fe30) at test.c:8 8 printf("traceme=%d\n", traceme); (gdb) c Continuing. Watchpoint 2 deleted because the program has left the block in which its expression is valid. 0x00007f7e3c000782 in _rtld_bind_start () from /usr/libexec/ld.elf_so (gdb) c Continuing. Program received signal SIGTRAP, Trace/breakpoint trap. 0x00007f7e3c0007b5 in _rtld_bind_start () from /usr/libexec/ld.elf_so (gdb) c Continuing. traceme=16 traceme=17 [Inferior 1 (process 28797) exited normally]
Sadly the PT_SYSCALL needs more work. The current implementation is currently broken and cannot stop the process on syscall entry.
What has been done in LLDB
As usual, I've pushed some ready patches to upstream LLDB. The first one covers Debug Register accessors and the second one adds proper thread identity detection on NetBSD.
Porting ptrace(2) software to NetBSD
I have prepared this presentation to illustrate the new code in the context of Linux and other BSDs.
To browse the slides one must use arrow buttons or the mouse scroll wheel. Press the h key for help.
This work was sponsored by The NetBSD Foundation.
The NetBSD Foundation is a non-profit organization and welcomes any donations to help us continue funding projects and services to the open-source community. Please consider visiting the following URL, and chip in what you can:
The NetBSD Project is pleased to announce NetBSD 7.1, the first feature update of the NetBSD 7 release branch. It represents a selected subset of fixes deemed important for security or stability reasons, as well as new features and enhancements.
Some highlights of NetBSD 7.1 are:
- Support for Raspberry Pi Zero.
- Initial DRM/KMS support for NVIDIA graphics cards via nouveau (Disabled by default. Uncomment nouveau and nouveaufb in your kernel config to test).
- The addition of vioscsi, a driver for the Google Compute Engine disk.
- Linux compatibility improvements, allowing, e.g., the use of Adobe Flash Player 24.
- C2000 KX and 2.5G support.
- Wake On Lan support.
- 82575 and newer SERDES based systems now work.
- ODROID-C1 Ethernet now works.
- Numerous bug fixes and stability improvements.
For more details, please see the release notes.
Complete source and binaries for NetBSD are available for download at many sites around the world. A list of download sites providing FTP, AnonCVS, SUP, and other services may be found at http://www.NetBSD.org/mirrors/.