mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: "'Preble, Adam C'" <adam.c.preble@intel.com>,
	Pavel Machek <pavel@ucw.cz>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: How do I force an IBT trap in a demo kernel module?
Date: Thu, 1 Jun 2023 08:04:43 +0000	[thread overview]
Message-ID: <8ee1b8453e614b5b930d13c2f3747221@AcuMS.aculab.com> (raw)
In-Reply-To: <BL3PR11MB6507CA789CD5BD5A7A5EA526A9489@BL3PR11MB6507.namprd11.prod.outlook.com>

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)


      reply	other threads:[~2023-06-01  8:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-23 19:28 Preble, Adam C
2023-05-24  8:00 ` David Laight
2023-05-27 22:40   ` Pavel Machek
2023-05-31 23:02     ` Preble, Adam C
2023-06-01  8:04       ` David Laight [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8ee1b8453e614b5b930d13c2f3747221@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=adam.c.preble@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®