File:  [NetBSD Developer Wiki] / wikisrc / users / maya.mdwn
Revision 1.7: download - view: text, annotated - select for diffs
Sun Feb 25 11:28:03 2018 UTC (4 years, 11 months ago) by maya
Branches: MAIN
CVS tags: HEAD
add release note item draft

don't mention fixed atf bug (thanks joerg)

# NetBSD-8 release notes items #

Below list needs to be expanded about ARM, MPSAFE networking changes.  
Then expanded to be readable by an average technically inclined person.  
Then reordered for most cool things on top.

* W^X memory protection enforced by default on architectures with fine-grained memory protection
* ASLR in some archs, MKPIE default for userland  
XXX list of archs
* SSP/FORTIFY default for userland and packages.  
XXX is SSP / MKPIE new to userland?
* In-kernel audio mixer

* USB system rework. added USB3 support.

The following networking components and drivers have been made MPSAFE:  
XXX long list, TODO.smpnet is a start

* Reproducible build (link to blog)
* Dynamic tracing (DTrace) for kernel code (link to guide/intro)

amd64, i386:

* Meltdown fixes
* amd64 kernel W^X
* EFI bootloader


* kernel modules support


* awin, FDT  
XXX elaborate

* TC-USB, TurboChannel USB support for ...
* mntva, driver for mntmn's VA2000 amiga graphics card

* bta2dpd - new Bluetooth Advanced Audio Distribution Profile daemon
* iwm(4), a driver for Intel Wireless devices (AC7260, AC7265, AC3160...)
* nvme(4), a driver for NVMe hardware, ported from OpenBSD
* nouveau, an open source driver for modern nVidia graphics, ported from linux, available by default.
   (this is at the bottom because we mentioned it in 7.1 too)

# Tips for using analyzers on NetBSD #

## Address Sanitizer (+UBsan) (preliminary) ##

ASan reports memory violations, and detects many off-by-ones. It seems to produce very high quality reports.

It only needs to be compiled on the resulting binary[1]. It cannot compile static objects so requires some fiddling with makefiles to disable those.

I've been running it on netbsd tests in the following manner[2]:

    cd /usr/src/tests/lib/libc
    env USETOOLS=never MK_SSP=no HAVE_SSP=no CFLAGS="-fno-omit-frame-pointer -O0 -g -ggdb -U_FORTIFY_SOURCE -fsanitize=address -fsanitize=undefined" LDFLAGS="-lasan -lubsan" make -j20

    env ASAN_OPTIONS=alloc_dealloc_mismatch=0 LD_PRELOAD="/usr/lib/ /usr/lib/" atf-run # [3]

    sysctl -w security.pax.aslr.enabled=0 # [4]

1. Seems like this is a cause of worse reports, as in-library functions
are not intercepted.

2. Not even close to canonical commands, should probably be improved.

3. To workaround "Shadow memory range interleaves with an existing memory mapping. ASan cannot proceed correctly". An alternative is to LD_PRELOAD and LD_LIBRARY_PATH an entirely separate libc, ld.elf_so, etc.

4. ASan can be wrong about which function is faulting, if we're talking about functions internal to the library. Running it on a separate file or in GDB can be helpful. Worth trying if the failure doesn't make sense.

**Important note: ASan should not be run on production systems. [It can pose a security risk](**

## Coverity ##

Coverity is a static analyzer.

You can see a part of its output in coverity-updates@, and a lot more
if you go to the website (sign up with your netbsd email or poke someone
for access).

A lot of the reports are about strncpy/strcpy or in code that belongs
to GCC (in the case of userland), you can tackle this by limiting
results to a particular directory (click the folder icon). You can
also sort by issue.

Some suggestions for things to focus on, as there are many defects

- Setuid programs
- Anything kernel
- Stuff that runs as root
- Library or other code you know well already
- Drivers for hardware you actually own and can test

## Future ideas: ##

- GCC could be told to add ASan flags for all shared objects, making it easier to build world with those flags
- We could run all of NetBSD with ASan for some real world tests.
- ASan for kernel? (subr_kmem.c has some flags which do some of the work, could it do more?)
- Fuzzers are cool.

CVSweb for NetBSD wikisrc <> software: FreeBSD-CVSweb