From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Daniele Buono <dbuono@linux.vnet.ibm.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [PATCH v2 0/2] gitlab-ci.yml: Add jobs to test CFI
Date: Tue, 2 Mar 2021 15:38:23 +0000 [thread overview]
Message-ID: <YD5b74uynDvWUySy@redhat.com> (raw)
In-Reply-To: <50a8e650-841f-cac4-8a14-8c659ef274ca@linux.vnet.ibm.com>
On Tue, Mar 02, 2021 at 08:18:03AM -0500, Daniele Buono wrote:
> On 3/2/2021 5:30 AM, Daniel P. Berrangé wrote:
> > On Mon, Mar 01, 2021 at 03:39:42PM -0500, Daniele Buono wrote:
> > > Hi Daniel,
> > >
> > > On 3/1/2021 10:08 AM, Daniel P. Berrangé wrote:
> > > > What are the unique failure scenarios for CFI that these jobs are
> > > > likely to expose ? Is it likely that we'll have cases where
> > > > CFI succeeds in say, x86_64 target, but fails in aarch64 target ?
> > > For CFI to fail (even if it shouldn't) you'll need code that is calling a
> > > function pointer that was not well defined at compile time. Although
> > > unlikely, that could happen everywhere in the code.
> > What does "was not well defined" mean here ?
> >
>
> At high level, the compiler creates metadata for every function. Before
> jumping to a function pointer, it makes sure that the pointer and the
> pointee have matching types.
> Not well defined means one of these two cases:
> 1. The function has a different type than the pointer -> Most likely an
> error
How strictly is this checked ? With GLib function prototype mismatch
is not uncommon. For example GLib might need to invoke a callback with
a signature:
int foo(int somearg, void *opaque);
The API though will often declare the callback signature to be
generic
void (*GCallback) (void);
The caller will implement a callback with
int foo(int somearg, mytype *mydata);
and will use G_CALLBACK() to do an intentional bad cast to GCallback
Before it invokes the callback, GLib would cast from GCallback back
to int foo(int somearg, void *opaque);
Notice this last arg doesn't match the type of the actual implemented
callback.
Is this scenario going to upset CFI, or is it happy that 'void *'
is compatible with 'mytype *', and ok with the intermediate casts
to/from GCallback ?
> 2. The function was not available at compile time so the compiler could
> not create the related metadata -> Most likely a false positive.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2021-03-02 15:39 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-26 15:21 [PATCH v2 0/2] gitlab-ci.yml: Add jobs to test CFI Daniele Buono
2021-02-26 15:21 ` [PATCH v2 1/2] gitlab-ci.yml: Allow custom # of parallel linkers Daniele Buono
2021-02-26 15:21 ` [PATCH v2 2/2] gitlab-ci.yml: Add jobs to test CFI flags Daniele Buono
2021-03-01 10:06 ` [PATCH v2 0/2] gitlab-ci.yml: Add jobs to test CFI Daniel P. Berrangé
2021-03-01 14:59 ` Daniele Buono
2021-03-01 15:08 ` Daniel P. Berrangé
2021-03-01 20:39 ` Daniele Buono
2021-03-02 10:30 ` Daniel P. Berrangé
2021-03-02 13:18 ` Daniele Buono
2021-03-02 15:38 ` Daniel P. Berrangé [this message]
2021-03-02 16:31 ` Daniele Buono
2021-03-02 16:40 ` Daniel P. Berrangé
2021-03-02 21:01 ` Daniele Buono
2021-03-03 10:04 ` Daniel P. Berrangé
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=YD5b74uynDvWUySy@redhat.com \
--to=berrange@redhat.com \
--cc=dbuono@linux.vnet.ibm.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.