Page MenuHomePhabricator

Add NetBSD syscall hooks skeleton in sanitizers
ClosedPublic

Authored by krytarowski on Jan 14 2018, 11:20 PM.

Details

Summary

Implement the skeleton of NetBSD syscall hooks for use with sanitizers.

Add a script that generates the rules to handle syscalls
on NetBSD: generate_netbsd_syscalls.awk. It has been written
in NetBSD awk(1) (patched nawk) and is compatible with gawk.

Generate lib/sanitizer_common/sanitizer_platform_limits_netbsd.h
that is a public header for applications, and included as:
<sanitizer_common/sanitizer_platform_limits_netbsd.h>.

Generate sanitizer_syscalls_netbsd.inc that defines all the
syscall rules for NetBSD. This file is modeled after the Linux
specific file: sanitizer_common_syscalls.inc.

Start recognizing NetBSD syscalls with existing sanitizers:
ASan, ESan, HWASan, TSan, MSan.

Sponsored by <The NetBSD Foundation>

Diff Detail

Repository
rL LLVM

Event Timeline

krytarowski created this revision.Jan 14 2018, 11:20 PM

Extracted from a larger patch D41588.

Can we start upstreaming this one? I will keep pushing 1 syscall with 1 patch proposal with attached tests.

vitalybuka resigned from this revision.Feb 14 2018, 5:17 PM

@vitalybuka who could review this? I can land this code as is without a reviewer and ask for review for newer patches in the same topic.

In Future other BSDs could follow NetBSD and craft their scripts to generate similar files in similar fashion.
We diverged around 1995, but the core set of syscalls and format is similar (but not the same).

vitalybuka accepted this revision.Feb 14 2018, 5:34 PM
vitalybuka added inline comments.
lib/sanitizer_common/sanitizer_netbsd_syscalls.inc
9 ↗(On Diff #129802)

sanitizer_syscalls_netbsd.inc ?

This revision is now accepted and ready to land.Feb 14 2018, 5:34 PM

Rename sanitizer_netbsd_syscalls.inc to sanitizer_syscalls_netbsd.inc

krytarowski edited the summary of this revision. (Show Details)Feb 14 2018, 6:33 PM
This revision was automatically updated to reflect the committed changes.
krytarowski added a comment.EditedFeb 15 2018, 7:19 AM

I've decided after evaluations that I will commit NetBSD-only code with the bodies of syscalls without review. As the amounts of code are not really reviewable in reasonable timeframe (over 11k lines of diff). It would be a fulltime effort of few months, but right now nobody can keep reviewing it in this mode.

Author: kamil
Date: Thu Feb 15 07:15:45 2018
New Revision: 325248

URL: http://llvm.org/viewvc/llvm-project?rev=325248&view=rev
Log:
Implement a large part of NetBSD syscalls of netbsd_syscall_hooks.h

This is a follow up of:

  r325206 - Add NetBSD syscall hooks skeleton in sanitizers

Sponsored by <The NetBSD Foundation>

Modified:
    compiler-rt/trunk/include/sanitizer/netbsd_syscall_hooks.h
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_syscalls_netbsd.inc
    compiler-rt/trunk/utils/generate_netbsd_syscalls.awk