Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
c4638ff0
Commit
c4638ff0
authored
Nov 19, 2020
by
Paul E. McKenney
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'kcsan.2020.11.06a' into HEAD
kcsan.2020.11.06a: Kernel concurrency sanitizer (KCSAN) updates.
parents
7fc91fc8
1d094cef
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
9 deletions
+14
-9
kernel/kcsan/encoding.h
kernel/kcsan/encoding.h
+11
-9
kernel/kcsan/selftest.c
kernel/kcsan/selftest.c
+3
-0
No files found.
kernel/kcsan/encoding.h
View file @
c4638ff0
...
...
@@ -37,18 +37,20 @@
*/
#define WATCHPOINT_ADDR_BITS (BITS_PER_LONG-1 - WATCHPOINT_SIZE_BITS)
/*
* Masks to set/retrieve the encoded data.
*/
#define WATCHPOINT_WRITE_MASK BIT(BITS_PER_LONG-1)
#define WATCHPOINT_SIZE_MASK \
GENMASK(BITS_PER_LONG-2, BITS_PER_LONG-2 - WATCHPOINT_SIZE_BITS)
#define WATCHPOINT_ADDR_MASK \
GENMASK(BITS_PER_LONG-3 - WATCHPOINT_SIZE_BITS, 0)
/* Bitmasks for the encoded watchpoint access information. */
#define WATCHPOINT_WRITE_MASK BIT(BITS_PER_LONG-1)
#define WATCHPOINT_SIZE_MASK GENMASK(BITS_PER_LONG-2, WATCHPOINT_ADDR_BITS)
#define WATCHPOINT_ADDR_MASK GENMASK(WATCHPOINT_ADDR_BITS-1, 0)
static_assert
(
WATCHPOINT_ADDR_MASK
==
(
1UL
<<
WATCHPOINT_ADDR_BITS
)
-
1
);
static_assert
((
WATCHPOINT_WRITE_MASK
^
WATCHPOINT_SIZE_MASK
^
WATCHPOINT_ADDR_MASK
)
==
~
0UL
);
static
inline
bool
check_encodable
(
unsigned
long
addr
,
size_t
size
)
{
return
size
<=
MAX_ENCODABLE_SIZE
;
/*
* While we can encode addrs<PAGE_SIZE, avoid crashing with a NULL
* pointer deref inside KCSAN.
*/
return
addr
>=
PAGE_SIZE
&&
size
<=
MAX_ENCODABLE_SIZE
;
}
static
inline
long
...
...
kernel/kcsan/selftest.c
View file @
c4638ff0
...
...
@@ -33,6 +33,9 @@ static bool test_encode_decode(void)
unsigned
long
addr
;
prandom_bytes
(
&
addr
,
sizeof
(
addr
));
if
(
addr
<
PAGE_SIZE
)
addr
=
PAGE_SIZE
;
if
(
WARN_ON
(
!
check_encodable
(
addr
,
size
)))
return
false
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment