10 Commits

Author SHA1 Message Date
Cathy Zhang
e13f0aee33 fix kernel mode crashing in Ubuntu 22.04
While build nanoBench kernel module in Ubuntu 22.04, gcc is with
-mfunction-return=thunk-extern as default option. According to chapter
6.1.1 JMP2RET in the following reference:
https://www.amd.com/system/files/documents/\
technical-guidance-for-mitigating-branch-type-confusion.pdf
all 'ret' instructions are consolidated into a single piece of code.
Instead of functions ending with a 'ret' instruction, they instead end
with "jump __x86_return_thunk".

Since a 'jmp' instruction is provided instead of 'ret' at the end of
each function, it cause functions like create_runtime_code() copy much
more assembler code into runtime_code memory than it should during
runtime. Memory protection fault happens finally while running.

To address the above issue, option -mfunction-return=keep is provided
for kernel mode to overwrite the gcc default behavior in Ubuntu 22.04.
This can ensure function has 'ret' instruction generated.

Signed-off-by: Cathy Zhang <cathy.zhang@intel.com>
2022-12-06 21:48:56 -08:00
Andreas Abel
3e48d9d667 support for Alder Lake 2021-12-22 20:59:08 +01:00
Andreas Abel
f09bd19032 compatibility with kernel 5.16 2021-12-08 23:36:28 +01:00
Andreas Abel
7a76d0e82d fix warnings 2021-11-26 02:10:05 +01:00
Andreas Abel
4971d6c23a added -df option 2021-03-03 15:47:23 +01:00
Andreas Abel
f3b31d391c starting/stopping counters 2019-09-24 14:31:47 +02:00
Andreas Abel
894826e214 fixing Makefile 2019-08-14 16:20:38 +02:00
Andreas Abel
de6f3606c3 support for huge pages 2019-03-28 21:33:27 +01:00
Anthony Wharton
0c4e6b351e Add check for linux-header in kernel Makefile 2019-02-21 15:48:11 +00:00
Andreas Abel
a01b9742c7 Initial commit 2019-02-20 14:57:43 +01:00