diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2021-07-19 04:56:58 +0300 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2021-07-19 04:56:58 +0300 |
commit | 320424c7d44f54c18df9812fd7c45f6963524002 (patch) | |
tree | 5853aff866a321d476f5e4f2a3de5b5e90408580 /drivers/misc/lkdtm/bugs.c | |
parent | f8f84af5da9ee04ef1d271528656dac42a090d00 (diff) | |
parent | 62fb9874f5da54fdb243003b386128037319b219 (diff) | |
download | linux-320424c7d44f54c18df9812fd7c45f6963524002.tar.xz |
Merge tag 'v5.13' into next
Sync up with the mainline to get the latest parport API.
Diffstat (limited to 'drivers/misc/lkdtm/bugs.c')
-rw-r--r-- | drivers/misc/lkdtm/bugs.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/misc/lkdtm/bugs.c b/drivers/misc/lkdtm/bugs.c index 110f5a8538e9..0e8254d0cf0b 100644 --- a/drivers/misc/lkdtm/bugs.c +++ b/drivers/misc/lkdtm/bugs.c @@ -134,6 +134,23 @@ noinline void lkdtm_CORRUPT_STACK_STRONG(void) __lkdtm_CORRUPT_STACK((void *)&data); } +static pid_t stack_pid; +static unsigned long stack_addr; + +void lkdtm_REPORT_STACK(void) +{ + volatile uintptr_t magic; + pid_t pid = task_pid_nr(current); + + if (pid != stack_pid) { + pr_info("Starting stack offset tracking for pid %d\n", pid); + stack_pid = pid; + stack_addr = (uintptr_t)&magic; + } + + pr_info("Stack offset: %d\n", (int)(stack_addr - (uintptr_t)&magic)); +} + void lkdtm_UNALIGNED_LOAD_STORE_WRITE(void) { static u8 data[5] __attribute__((aligned(4))) = {1, 2, 3, 4, 5}; |