RE: How do I force an IBT trap in a demo kernel module?

From: David Laight
Date: Thu Jun 01 2023 - 04:04:59 EST


From: Preble, Adam C
> Sent: 01 June 2023 00:02
>
> It looked to me like I was getting the indirect jump just fine with what I already was doing. Sure, I
> made the instruction pointer volatile and static, but nothing changed just from that.

This ought to compile to code that does what you want..

void func(void) {}

void (*func_ptr)(void) = func;

void test(void)
{
void (*ptr)(void) = (void *)func_ptr + 4;

ptr();
}

See https://godbolt.org/z/o8cedv3d4 but that doesn't have the option
that generated the endbra.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)