The NetBSD Project

CVS log for src/sys/arch/amd64/include/msan.h

[BACK] Up to [cvs.NetBSD.org] / src / sys / arch / amd64 / include

Request diff between arbitrary revisions


Keyword substitution: kv
Default branch: MAIN


Revision 1.8: download - view: text, markup, annotated - select for diffs
Tue Sep 13 09:39:49 2022 UTC (2 years, 2 months ago) by riastradh
Branches: MAIN
CVS tags: thorpej-ifq-base, thorpej-ifq, thorpej-altq-separation-base, thorpej-altq-separation, perseant-exfatfs-base-20240630, perseant-exfatfs-base, perseant-exfatfs, netbsd-10-base, netbsd-10-0-RELEASE, netbsd-10-0-RC6, netbsd-10-0-RC5, netbsd-10-0-RC4, netbsd-10-0-RC3, netbsd-10-0-RC2, netbsd-10-0-RC1, netbsd-10, bouyer-sunxi-drm-base, bouyer-sunxi-drm, HEAD
Diff to: previous 1.7: preferred, colored
Changes since revision 1.7: +6 -1 lines
amd64/asan.h, amd64/msan.h: Add include guards.

Revision 1.7: download - view: text, markup, annotated - select for diffs
Mon Aug 22 13:21:47 2022 UTC (2 years, 3 months ago) by riastradh
Branches: MAIN
Diff to: previous 1.6: preferred, colored
Changes since revision 1.6: +7 -3 lines
amd64/msan.h: Fix includes for private pmap.

Revision 1.5.2.1: download - view: text, markup, annotated - select for diffs
Mon Dec 14 14:37:46 2020 UTC (3 years, 11 months ago) by thorpej
Branches: thorpej-futex
Diff to: previous 1.5: preferred, colored; next MAIN 1.6: preferred, colored
Changes since revision 1.5: +3 -1 lines
Sync w/ HEAD.

Revision 1.6: download - view: text, markup, annotated - select for diffs
Wed Nov 18 16:13:34 2020 UTC (4 years ago) by hannken
Branches: MAIN
CVS tags: thorpej-i2c-spi-conf2-base, thorpej-i2c-spi-conf2, thorpej-i2c-spi-conf-base, thorpej-i2c-spi-conf, thorpej-futex2-base, thorpej-futex2, thorpej-futex-base, thorpej-cfargs2-base, thorpej-cfargs2, thorpej-cfargs-base, thorpej-cfargs, cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x
Diff to: previous 1.5: preferred, colored
Changes since revision 1.5: +3 -1 lines
Make this at least compile.
Looks like a missing part from "Round of uvm.h cleanup (2020-09-05 18:30)".

Revision 1.5: download - view: text, markup, annotated - select for diffs
Wed Sep 9 16:29:59 2020 UTC (4 years, 3 months ago) by maxv
Branches: MAIN
Branch point for: thorpej-futex
Diff to: previous 1.4: preferred, colored
Changes since revision 1.4: +14 -15 lines
kmsan: update the copyright notices

Revision 1.4: download - view: text, markup, annotated - select for diffs
Sun Jun 7 23:15:51 2020 UTC (4 years, 6 months ago) by christos
Branches: MAIN
Diff to: previous 1.3: preferred, colored
Changes since revision 1.3: +2 -2 lines
make this compile.

Revision 1.3: download - view: text, markup, annotated - select for diffs
Sat Apr 25 15:26:16 2020 UTC (4 years, 7 months ago) by bouyer
Branches: MAIN
Diff to: previous 1.2: preferred, colored
Changes since revision 1.2: +1 -1 lines
Merge the bouyer-xenpvh branch, bringing in Xen PV drivers support under HVM
guests in GENERIC.
Xen support can be disabled at runtime with
boot -c
disable hypervisor

Revision 1.1.8.3: download - view: text, markup, annotated - select for diffs
Tue Apr 21 18:42:03 2020 UTC (4 years, 7 months ago) by martin
Branches: phil-wifi
Diff to: previous 1.1.8.2: preferred, colored; branchpoint 1.1: preferred, colored; next MAIN 1.2: preferred, colored
Changes since revision 1.1.8.2: +35 -4 lines
Sync with HEAD

Revision 1.1.6.1: download - view: text, markup, annotated - select for diffs
Mon Apr 20 11:28:51 2020 UTC (4 years, 7 months ago) by bouyer
Branches: bouyer-xenpvh
Diff to: previous 1.1: preferred, colored; next MAIN 1.2: preferred, colored
Changes since revision 1.1: +36 -5 lines
Sync with HEAD

Revision 1.2: download - view: text, markup, annotated - select for diffs
Wed Apr 15 16:28:29 2020 UTC (4 years, 7 months ago) by maxv
Branches: MAIN
CVS tags: phil-wifi-20200421, bouyer-xenpvh-base2, bouyer-xenpvh-base1
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +36 -5 lines
Use large pages for the kMSan shadows. This greatly improves performance,
and slightly reduces memory consumption.

Revision 1.1.8.2: download - view: text, markup, annotated - select for diffs
Mon Apr 13 08:03:30 2020 UTC (4 years, 8 months ago) by martin
Branches: phil-wifi
Diff to: previous 1.1.8.1: preferred, colored; branchpoint 1.1: preferred, colored
Changes since revision 1.1.8.1: +241 -0 lines
Mostly merge changes from HEAD upto 20200411

Revision 1.1.8.1
Thu Nov 14 16:23:52 2019 UTC (5 years ago) by martin
Branches: phil-wifi
FILE REMOVED
Changes since revision 1.1: +0 -241 lines
file msan.h was added on branch phil-wifi on 2020-04-13 08:03:30 +0000

Revision 1.1: download - view: text, markup, annotated - select for diffs
Thu Nov 14 16:23:52 2019 UTC (5 years ago) by maxv
Branches: MAIN
CVS tags: phil-wifi-20200411, phil-wifi-20200406, phil-wifi-20191119, is-mlppp-base, is-mlppp, bouyer-xenpvh-base, ad-namecache-base3, ad-namecache-base2, ad-namecache-base1, ad-namecache-base, ad-namecache
Branch point for: phil-wifi, bouyer-xenpvh
Add support for Kernel Memory Sanitizer (kMSan). It detects uninitialized
memory used by the kernel at run time, and just like kASan and kCSan, it
is an excellent feature. It has already detected 38 uninitialized variables
in the kernel during my testing, which I have since discreetly fixed.

We use two shadows:
 - "shad", to track uninitialized memory with a bit granularity (1:1).
   Each bit set to 1 in the shad corresponds to one uninitialized bit of
   real kernel memory.
 - "orig", to track the origin of the memory with a 4-byte granularity
   (1:1). Each uint32_t cell in the orig indicates the origin of the
   associated uint32_t of real kernel memory.

The memory consumption of these shadows is consequent, so at least 4GB of
RAM is recommended to run kMSan.

The compiler inserts calls to specific __msan_* functions on each memory
access, to manage both the shad and the orig and detect uninitialized
memory accesses that change the execution flow (like an "if" on an
uninitialized variable).

We mark as uninit several types of memory buffers (stack, pools, kmem,
malloc, uvm_km), and check each buffer passed to copyout, copyoutstr,
bwrite, if_transmit_lock and DMA operations, to detect uninitialized memory
that leaves the system. This allows us to detect kernel info leaks in a way
that is more efficient and also more user-friendly than KLEAK.

Contrary to kASan, kMSan requires comprehensive coverage, ie we cannot
tolerate having one non-instrumented function, because this could cause
false positives. kMSan cannot instrument ASM functions, so I converted
most of them to __asm__ inlines, which kMSan is able to instrument. Those
that remain receive special treatment.

Contrary to kASan again, kMSan uses a TLS, so we must context-switch this
TLS during interrupts. We use different contexts depending on the interrupt
level.

The orig tracks precisely the origin of a buffer. We use a special encoding
for the orig values, and pack together in each uint32_t cell of the orig:
 - a code designating the type of memory (Stack, Pool, etc), and
 - a compressed pointer, which points either (1) to a string containing
   the name of the variable associated with the cell, or (2) to an area
   in the kernel .text section which we resolve to a symbol name + offset.

This encoding allows us not to consume extra memory for associating
information with each cell, and produces a precise output, that can tell
for example the name of an uninitialized variable on the stack, the
function in which it was pushed on the stack, and the function where we
accessed this uninitialized variable.

kMSan is available with LLVM, but not with GCC.

The code is organized in a way that is similar to kASan and kCSan, so it
means that other architectures than amd64 can be supported.

Diff request

This form allows you to request diffs between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.

Log view options

CVSweb <webmaster@jp.NetBSD.org>