diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-02-01 23:20:53 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-02-01 23:20:53 +0300 |
commit | 8e44e6600caa7b96a5b71ae36c8829db753c2d70 (patch) | |
tree | b6cc9e2f7f703e2869a3d1f4e18b4e47b3c2cb21 /fs/dcache.c | |
parent | 562f36ed28e6faa4245ea2ca1392d90ab98ebbe8 (diff) | |
parent | babcbbc7c4e2fa7fa76417ece7c57083bee971f1 (diff) | |
download | linux-8e44e6600caa7b96a5b71ae36c8829db753c2d70.tar.xz |
Merge branch 'KASAN-read_word_at_a_time'
Merge KASAN word-at-a-time fixups from Andrey Ryabinin.
The word-at-a-time optimizations have caused headaches for KASAN, since
the whole point is that we access byte streams in bigger chunks, and
KASAN can be unhappy about the potential extra access at the end of the
string.
We used to have a horrible hack in dcache, and then people got
complaints from the strscpy() case. This fixes it all up properly, by
adding an explicit helper for the "access byte stream one word at a
time" case.
* emailed patches from Andrey Ryabinin <aryabinin@virtuozzo.com>:
fs: dcache: Revert "manually unpoison dname after allocation to shut up kasan's reports"
fs/dcache: Use read_word_at_a_time() in dentry_string_cmp()
lib/strscpy: Shut up KASAN false-positives in strscpy()
compiler.h: Add read_word_at_a_time() function.
compiler.h, kasan: Avoid duplicating __read_once_size_nocheck()
Diffstat (limited to 'fs/dcache.c')
-rw-r--r-- | fs/dcache.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/fs/dcache.c b/fs/dcache.c index d93872d425d6..5b207e0de459 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -37,8 +37,6 @@ #include <linux/prefetch.h> #include <linux/ratelimit.h> #include <linux/list_lru.h> -#include <linux/kasan.h> - #include "internal.h" #include "mount.h" @@ -193,7 +191,7 @@ static inline int dentry_string_cmp(const unsigned char *cs, const unsigned char unsigned long a,b,mask; for (;;) { - a = *(unsigned long *)cs; + a = read_word_at_a_time(cs); b = load_unaligned_zeropad(ct); if (tcount < sizeof(unsigned long)) break; @@ -1628,9 +1626,6 @@ struct dentry *__d_alloc(struct super_block *sb, const struct qstr *name) } atomic_set(&p->u.count, 1); dname = p->name; - if (IS_ENABLED(CONFIG_DCACHE_WORD_ACCESS)) - kasan_unpoison_shadow(dname, - round_up(name->len + 1, sizeof(unsigned long))); } else { dname = dentry->d_iname; } |