qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@gnu.org>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: thuth@redhat.com, qemu-devel@nongnu.org, dbuono@linux.vnet.ibm.com
Subject: Re: [RFC PATCH 4/4] net: slirp: allow CFI with libslirp >= 4.7
Date: Wed, 27 Apr 2022 01:19:47 +0200	[thread overview]
Message-ID: <20220426231947.xcm3dwvygypyu2as@begin> (raw)
In-Reply-To: <20220412121337.207203-5-pbonzini@redhat.com>

Paolo Bonzini, le mar. 12 avril 2022 14:13:37 +0200, a ecrit:
> slirp 4.7 introduces a new CFI-friendly timer callback that does
> not pass function pointers within libslirp as callbacks for timers.
> Check the version number and, if it is new enough, allow using CFI
> even with a system libslirp.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

> ---
>  meson.build | 24 ++++++++++++------------
>  1 file changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/meson.build b/meson.build
> index 861de93c4f..92a83580a3 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -2485,21 +2485,21 @@ if have_system
>      slirp = declare_dependency(link_with: libslirp,
>                                 dependencies: slirp_deps,
>                                 include_directories: slirp_inc)
> +  else
> +    # slirp <4.7 is incompatible with CFI support in QEMU.  This is because
> +    # it passes function pointers within libslirp as callbacks for timers.
> +    # When using a system-wide shared libslirp, the type information for the
> +    # callback is missing and the timer call produces a false positive with CFI.
> +    #
> +    # Now that slirp_opt has been defined, check if the selected slirp is compatible
> +    # with control-flow integrity.
> +    if get_option('cfi') and slirp.found() and slirp.version().version_compare('<4.7')
> +      error('Control-Flow Integrity is not compatible with system-wide slirp.' \
> +             + ' Please configure with --enable-slirp=git or upgrade to libslirp 4.7')
> +    endif
>    endif
>  endif
>  
> -# For CFI, we need to compile slirp as a static library together with qemu.
> -# This is because we register slirp functions as callbacks for QEMU Timers.
> -# When using a system-wide shared libslirp, the type information for the
> -# callback is missing and the timer call produces a false positive with CFI.
> -#
> -# Now that slirp_opt has been defined, check if the selected slirp is compatible
> -# with control-flow integrity.
> -if get_option('cfi') and slirp_opt == 'system'
> -  error('Control-Flow Integrity is not compatible with system-wide slirp.' \
> -         + ' Please configure with --enable-slirp=git')
> -endif
> -
>  fdt = not_found
>  if have_system
>    fdt_opt = get_option('fdt')
> -- 
> 2.35.1
> 

-- 
Samuel
---
Pour une évaluation indépendante, transparente et rigoureuse !
Je soutiens la Commission d'Évaluation de l'Inria.


      reply	other threads:[~2022-04-26 23:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-12 12:13 [RFC PATCH 0/4] net: support for CFI with libslirp >= 4.7 Paolo Bonzini
2022-04-12 12:13 ` [RFC PATCH 1/4] net: slirp: introduce a wrapper struct for QemuTimer Paolo Bonzini
2022-04-26 23:11   ` Samuel Thibault
2022-04-12 12:13 ` [RFC PATCH 2/4] net: slirp: switch to slirp_new Paolo Bonzini
2022-04-26 23:12   ` Samuel Thibault
2022-04-12 12:13 ` [RFC PATCH 3/4] net: slirp: add support for CFI-friendly timer API Paolo Bonzini
2022-04-26 23:15   ` Samuel Thibault
2022-04-12 12:13 ` [RFC PATCH 4/4] net: slirp: allow CFI with libslirp >= 4.7 Paolo Bonzini
2022-04-26 23:19   ` Samuel Thibault [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=20220426231947.xcm3dwvygypyu2as@begin \
    --to=samuel.thibault@gnu.org \
    --cc=dbuono@linux.vnet.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /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;
as well as URLs for NNTP newsgroup(s).