Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Be more informative.
details: https://anonhg.NetBSD.org/src/rev/67fd73330bf1
branches: trunk
changeset: 744376:67fd73330bf1
user: maxv <maxv%NetBSD.org@localhost>
date: Fri Jan 31 08:26:10 2020 +0000
description:
Be more informative.
diffstat:
sys/kern/subr_msan.c | 184 +++++++++++++++++++++++++++-----------------------
1 files changed, 100 insertions(+), 84 deletions(-)
diffs (truncated from 592 to 300 lines):
diff -r bd9b1011e03e -r 67fd73330bf1 sys/kern/subr_msan.c
--- a/sys/kern/subr_msan.c Fri Jan 31 08:21:11 2020 +0000
+++ b/sys/kern/subr_msan.c Fri Jan 31 08:26:10 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_msan.c,v 1.6 2020/01/25 15:55:33 maxv Exp $ */
+/* $NetBSD: subr_msan.c,v 1.7 2020/01/31 08:26:10 maxv Exp $ */
/*
* Copyright (c) 2019-2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_msan.c,v 1.6 2020/01/25 15:55:33 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_msan.c,v 1.7 2020/01/31 08:26:10 maxv Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -163,7 +163,7 @@
orig = (msan_orig_t *)((uintptr_t)orig & ~0x3);
if (*orig == 0) {
- REPORT("MSan: Uninitialized Memory In %s() At Offset "
+ REPORT("MSan: Uninitialized Memory In %s At Offset "
"%zu\n", hook, off);
goto out;
}
@@ -173,13 +173,13 @@
if (kmsan_md_is_pc(ptr)) {
if (ksyms_getname(&mod, &sym, (vaddr_t)ptr, KSYMS_PROC)) {
- REPORT("MSan: Uninitialized %s Memory In %s() "
- "At Offset %zu, IP %p\n", typename, hook, off,
- (void *)ptr);
+ REPORT("MSan: Uninitialized %s Memory In %s "
+ "At Offset %zu/%zu, IP %p\n", typename, hook, off,
+ size, (void *)ptr);
} else {
- REPORT("MSan: Uninitialized %s Memory In %s() "
- "At Offset %zu, From %s()\n", typename, hook, off,
- sym);
+ REPORT("MSan: Uninitialized %s Memory In %s "
+ "At Offset %zu/%zu, From %s()\n", typename, hook,
+ off, size, sym);
}
} else {
var = (char *)ptr + 4;
@@ -187,7 +187,7 @@
var = buf;
fn = __builtin_strchr(buf, '@');
*fn++ = '\0';
- REPORT("MSan: Uninitialized %s Memory In %s() At Offset "
+ REPORT("MSan: Uninitialized %s Memory In %s At Offset "
"%zu, Variable '%s' From %s()\n", typename, hook, off,
var, fn);
}
@@ -513,7 +513,7 @@
struct mbuf *m = buf;
do {
- kmsan_shadow_check(mtod(m, void *), m->m_len, "if_transmit");
+ kmsan_shadow_check(mtod(m, void *), m->m_len, "if_transmit()");
} while ((m = m->m_next) != NULL);
}
@@ -522,7 +522,7 @@
{
buf_t *bp = buf;
- kmsan_shadow_check(bp->b_data, bp->b_bcount, "bwrite");
+ kmsan_shadow_check(bp->b_data, bp->b_bcount, "bwrite()");
}
void
@@ -646,13 +646,14 @@
const uint8_t *_b1 = b1, *_b2 = b2;
size_t i;
- kmsan_check_arg(sizeof(b1) + sizeof(b2) + sizeof(len), "memcmp");
+ kmsan_check_arg(sizeof(b1) + sizeof(b2) + sizeof(len),
+ "memcmp():args");
kmsan_init_ret(sizeof(int));
for (i = 0; i < len; i++) {
if (*_b1 != *_b2) {
- kmsan_shadow_check(b1, i + 1, "memcmp");
- kmsan_shadow_check(b2, i + 1, "memcmp");
+ kmsan_shadow_check(b1, i + 1, "memcmp():arg1");
+ kmsan_shadow_check(b2, i + 1, "memcmp():arg2");
return *_b1 - *_b2;
}
_b1++, _b2++;
@@ -690,7 +691,7 @@
char *_dst = dst;
size_t len = 0;
- kmsan_check_arg(sizeof(dst) + sizeof(src), "strcpy");
+ kmsan_check_arg(sizeof(dst) + sizeof(src), "strcpy():args");
while (1) {
len++;
@@ -700,7 +701,7 @@
src++, dst++;
}
- kmsan_shadow_check(_src, len, "strcpy");
+ kmsan_shadow_check(_src, len, "strcpy():arg2");
kmsan_shadow_fill(_dst, KMSAN_STATE_INITED, len);
kmsan_init_ret(sizeof(char *));
return _dst;
@@ -712,7 +713,7 @@
const char *_s1 = s1, *_s2 = s2;
size_t len = 0;
- kmsan_check_arg(sizeof(s1) + sizeof(s2), "strcmp");
+ kmsan_check_arg(sizeof(s1) + sizeof(s2), "strcmp():args");
kmsan_init_ret(sizeof(int));
while (1) {
@@ -720,15 +721,15 @@
if (*s1 != *s2)
break;
if (*s1 == '\0') {
- kmsan_shadow_check(_s1, len, "strcmp");
- kmsan_shadow_check(_s2, len, "strcmp");
+ kmsan_shadow_check(_s1, len, "strcmp():arg1");
+ kmsan_shadow_check(_s2, len, "strcmp():arg2");
return 0;
}
s1++, s2++;
}
- kmsan_shadow_check(_s1, len, "strcmp");
- kmsan_shadow_check(_s2, len, "strcmp");
+ kmsan_shadow_check(_s1, len, "strcmp():arg1");
+ kmsan_shadow_check(_s2, len, "strcmp():arg2");
return (*(const unsigned char *)s1 - *(const unsigned char *)s2);
}
@@ -738,7 +739,7 @@
{
const char *s;
- kmsan_check_arg(sizeof(str), "strlen");
+ kmsan_check_arg(sizeof(str), "strlen():args");
s = str;
while (1) {
@@ -747,7 +748,7 @@
s++;
}
- kmsan_shadow_check(str, (size_t)(s - str) + 1, "strlen");
+ kmsan_shadow_check(str, (size_t)(s - str) + 1, "strlen():arg1");
kmsan_init_ret(sizeof(size_t));
return (s - str);
}
@@ -758,12 +759,12 @@
size_t ldst, lsrc;
char *ret;
- kmsan_check_arg(sizeof(dst) + sizeof(src), "strcat");
+ kmsan_check_arg(sizeof(dst) + sizeof(src), "strcat():args");
ldst = __builtin_strlen(dst);
lsrc = __builtin_strlen(src);
- kmsan_shadow_check(dst, ldst + 1, "strcat");
- kmsan_shadow_check(src, lsrc + 1, "strcat");
+ kmsan_shadow_check(dst, ldst + 1, "strcat():arg1");
+ kmsan_shadow_check(src, lsrc + 1, "strcat():arg2");
ret = __builtin_strcat(dst, src);
kmsan_shadow_fill(dst, KMSAN_STATE_INITED, ldst + lsrc + 1);
@@ -776,8 +777,8 @@
{
char *ret;
- kmsan_check_arg(sizeof(s) + sizeof(c), "strchr");
- kmsan_shadow_check(s, __builtin_strlen(s), "strchr");
+ kmsan_check_arg(sizeof(s) + sizeof(c), "strchr():args");
+ kmsan_shadow_check(s, __builtin_strlen(s), "strchr():arg1");
ret = __builtin_strchr(s, c);
kmsan_init_ret(sizeof(char *));
@@ -789,8 +790,8 @@
{
char *ret;
- kmsan_check_arg(sizeof(s) + sizeof(c), "strrchr");
- kmsan_shadow_check(s, __builtin_strlen(s), "strrchr");
+ kmsan_check_arg(sizeof(s) + sizeof(c), "strrchr():args");
+ kmsan_shadow_check(s, __builtin_strlen(s), "strrchr():arg1");
ret = __builtin_strrchr(s, c);
kmsan_init_ret(sizeof(char *));
@@ -821,7 +822,8 @@
int
kmsan_kcopy(const void *src, void *dst, size_t len)
{
- kmsan_check_arg(sizeof(src) + sizeof(dst) + sizeof(len), "kcopy");
+ kmsan_check_arg(sizeof(src) + sizeof(dst) + sizeof(len),
+ "kcopy():args");
if (__predict_true(len != 0)) {
kmsan_meta_copy(dst, src, len);
}
@@ -836,7 +838,7 @@
int ret;
kmsan_check_arg(sizeof(kfaddr) + sizeof(kdaddr) +
- sizeof(len) + sizeof(done), "copystr");
+ sizeof(len) + sizeof(done), "copystr():args");
ret = copystr(kfaddr, kdaddr, len, &_done);
if (ret == 0)
kmsan_meta_copy(kdaddr, kfaddr, _done);
@@ -854,7 +856,8 @@
{
int ret;
- kmsan_check_arg(sizeof(uaddr) + sizeof(kaddr) + sizeof(len), "copyin");
+ kmsan_check_arg(sizeof(uaddr) + sizeof(kaddr) + sizeof(len),
+ "copyin():args");
ret = copyin(uaddr, kaddr, len);
if (ret == 0)
kmsan_shadow_fill(kaddr, KMSAN_STATE_INITED, len);
@@ -866,8 +869,9 @@
int
kmsan_copyout(const void *kaddr, void *uaddr, size_t len)
{
- kmsan_check_arg(sizeof(kaddr) + sizeof(uaddr) + sizeof(len), "copyout");
- kmsan_shadow_check(kaddr, len, "copyout");
+ kmsan_check_arg(sizeof(kaddr) + sizeof(uaddr) + sizeof(len),
+ "copyout():args");
+ kmsan_shadow_check(kaddr, len, "copyout():arg1");
kmsan_init_ret(sizeof(int));
return copyout(kaddr, uaddr, len);
}
@@ -879,7 +883,7 @@
int ret;
kmsan_check_arg(sizeof(uaddr) + sizeof(kaddr) +
- sizeof(len) + sizeof(done), "copyinstr");
+ sizeof(len) + sizeof(done), "copyinstr():args");
ret = copyinstr(uaddr, kaddr, len, &_done);
if (ret == 0)
kmsan_shadow_fill(kaddr, KMSAN_STATE_INITED, _done);
@@ -899,9 +903,9 @@
int ret;
kmsan_check_arg(sizeof(kaddr) + sizeof(uaddr) +
- sizeof(len) + sizeof(done), "copyoutstr");
+ sizeof(len) + sizeof(done), "copyoutstr():args");
ret = copyoutstr(kaddr, uaddr, len, &_done);
- kmsan_shadow_check(kaddr, _done, "copyoutstr");
+ kmsan_shadow_check(kaddr, _done, "copyoutstr():arg1");
if (done != NULL) {
*done = _done;
kmsan_shadow_fill(done, KMSAN_STATE_INITED, sizeof(size_t));
@@ -934,7 +938,7 @@
{
int _ret;
kmsan_check_arg(sizeof(uaddr) + sizeof(old) +
- sizeof(new) + sizeof(ret), "ucas_32");
+ sizeof(new) + sizeof(ret), "ucas_32():args");
_ret = _ucas_32(uaddr, old, new, ret);
if (_ret == 0)
kmsan_shadow_fill(ret, KMSAN_STATE_INITED, sizeof(*ret));
@@ -951,7 +955,7 @@
{
int _ret;
kmsan_check_arg(sizeof(uaddr) + sizeof(old) +
- sizeof(new) + sizeof(ret), "ucas_32_mp");
+ sizeof(new) + sizeof(ret), "ucas_32_mp():args");
_ret = _ucas_32_mp(uaddr, old, new, ret);
if (_ret == 0)
kmsan_shadow_fill(ret, KMSAN_STATE_INITED, sizeof(*ret));
@@ -969,7 +973,7 @@
{
int _ret;
kmsan_check_arg(sizeof(uaddr) + sizeof(old) +
- sizeof(new) + sizeof(ret), "ucas_64");
+ sizeof(new) + sizeof(ret), "ucas_64():args");
_ret = _ucas_64(uaddr, old, new, ret);
if (_ret == 0)
kmsan_shadow_fill(ret, KMSAN_STATE_INITED, sizeof(*ret));
@@ -986,7 +990,7 @@
{
int _ret;
kmsan_check_arg(sizeof(uaddr) + sizeof(old) +
- sizeof(new) + sizeof(ret), "ucas_64_mp");
+ sizeof(new) + sizeof(ret), "ucas_64_mp():args");
_ret = _ucas_64_mp(uaddr, old, new, ret);
if (_ret == 0)
kmsan_shadow_fill(ret, KMSAN_STATE_INITED, sizeof(*ret));
@@ -1002,7 +1006,7 @@
kmsan__ufetch_8(const uint8_t *uaddr, uint8_t *valp)
{
int _ret;
- kmsan_check_arg(sizeof(uaddr) + sizeof(valp), "ufetch_8");
+ kmsan_check_arg(sizeof(uaddr) + sizeof(valp), "ufetch_8():args");
_ret = _ufetch_8(uaddr, valp);
Home |
Main Index |
Thread Index |
Old Index