diff options
author | Brian Johannesmeyer <bjohannesmeyer@gmail.com> | 2024-05-23 23:50:29 +0200 |
---|---|---|
committer | Borislav Petkov (AMD) <bp@alien8.de> | 2024-06-25 11:37:21 +0200 |
commit | bf6ab33d8487f5e2a0998ce75286eae65bb0a6d6 (patch) | |
tree | d47c533a5f33d91e367ba1660b687551ef161051 /fs/nls/nls_utf8.c | |
parent | 7821fa101eab529521aa4b724bf708149d70820c (diff) |
x86/kmsan: Fix hook for unaligned accesses
When called with a 'from' that is not 4-byte-aligned, string_memcpy_fromio()
calls the movs() macro to copy the first few bytes, so that 'from' becomes
4-byte-aligned before calling rep_movs(). This movs() macro modifies 'to', and
the subsequent line modifies 'n'.
As a result, on unaligned accesses, kmsan_unpoison_memory() uses the updated
(aligned) values of 'to' and 'n'. Hence, it does not unpoison the entire
region.
Save the original values of 'to' and 'n', and pass those to
kmsan_unpoison_memory(), so that the entire region is unpoisoned.
Signed-off-by: Brian Johannesmeyer <bjohannesmeyer@gmail.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Alexander Potapenko <glider@google.com>
Link: https://lore.kernel.org/r/20240523215029.4160518-1-bjohannesmeyer@gmail.com
Diffstat (limited to 'fs/nls/nls_utf8.c')
0 files changed, 0 insertions, 0 deletions