All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH 4/8] qapi: drop CompatPolicySecurity and use CompatPolicyInput
Date: Thu, 29 Oct 2026 10:48:59 +0000	[thread overview]
Message-ID: <auMkm9PvgJbi-r5F@redhat.com> (raw)
In-Reply-To: <875wylghh1.fsf@pond.sub.org>

On Thu, Oct 29, 2026 at 07:15:38AM +0100, Markus Armbruster wrote:
> Daniel P. Berrangé <berrange@redhat.com> writes:
> 
> > With CompatPolicyInput gaining a "warn" option, the CompatPolicySecurity
> > type is redundant.
> >
> > Note the error message for insecure-input changes from
> >
> >    Type 'rtl8139' does not provide a security boundary
> >    to protect against untrusted data or actions
> >
> > To
> >
> >    Insecure QOM type rtl8139 disabled by policy
> 
> This loses a bit of information.  Do we care?  I show a way to retain it
> below.
> 
> >
> > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> > ---
> >  qapi/compat.json | 18 +-----------------
> >  qapi/qapi-util.c | 21 ++++-----------------
> >  2 files changed, 5 insertions(+), 34 deletions(-)
> >
> > diff --git a/qapi/compat.json b/qapi/compat.json
> > index f28c24149c8..7790a7896a8 100644
> > --- a/qapi/compat.json
> > +++ b/qapi/compat.json
> > @@ -37,22 +37,6 @@
> >  { 'enum': 'CompatPolicyOutput',
> >    'data': [ 'accept', 'hide' ] }
> >  
> > -##
> > -# @CompatPolicySecurity:
> > -#     Policy for handling any devices or backends which do not provide
> > -#     a security boundary to protect against untrusted environments
> > -#
> > -# @accept: Allow any usage
> > -#
> > -# @reject: Reject with an error reported
> > -#
> > -# @warn: Allow any usage, with a warning reported
> > -#
> > -# Since: 11.2
> > -##
> > -{ 'enum': 'CompatPolicySecurity',
> > -  'data': [ 'accept', 'reject', 'warn' ] }
> > -
> >  ##
> >  # @CompatPolicy:
> >  #     Policy for handling deprecated management interfaces.
> > @@ -87,4 +71,4 @@
> >              '*deprecated-output': 'CompatPolicyOutput',
> >              '*unstable-input': 'CompatPolicyInput',
> >              '*unstable-output': 'CompatPolicyOutput',
> > -            '*insecure-input': 'CompatPolicySecurity' } }
> > +            '*insecure-input': 'CompatPolicyInput' } }
> 
> This adds policy value "crash", doesn't it?  The commit message should
> mention it.

Ok

> 
> > diff --git a/qapi/qapi-util.c b/qapi/qapi-util.c
> > index e6f3006b16c..36926b5003d 100644
> > --- a/qapi/qapi-util.c
> > +++ b/qapi/qapi-util.c
> > @@ -72,23 +72,10 @@ bool compat_policy_check_security(const CompatPolicy *policy,
> >          return true;
> >      }
> >  
> > -    switch (policy->insecure_input) {
> > -    case COMPAT_POLICY_SECURITY_ACCEPT:
> > -        return true;
> > -
> > -    case COMPAT_POLICY_SECURITY_REJECT:
> > -        error_setg(errp, "Type '%s' does not provide a security boundary "
> > -                   "to protect against untrusted data or actions", typename);
> > -        return false;
> > -
> > -    case COMPAT_POLICY_SECURITY_WARN:
> > -        warn_report("Type '%s' does not provide a security boundary "
> > -                    "to protect against untrusted data or actions", typename);
> > -        return true;
> > -
> > -    default:
> > -        g_assert_not_reached();
> > -    }
> > +    return compat_policy_input_ok1(policy->insecure_input,
> > +                                   "Insecure",
> > +                                   ERROR_CLASS_GENERIC_ERROR,
> > +                                   "QOM type", typename, errp);
> >  }
> 
> ... then try something like this:
> 
>        if (!compat_policy_input_ok1(...) {
>            error_append_hint(errp, ...);
>        }
> 
> Don't forget ERRP_GUARD() then, error_append_hint() needs it.

Yep, that's a nice idea.

With regards,
Daniel
-- 
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|



  reply	other threads:[~2026-10-29 10:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-28 13:35 [PATCH 0/8] qapi: last minute improvements/changes to -compat insecure-types Daniel P. Berrangé
2026-10-28 13:35 ` [PATCH 1/8] qapi: make 'CompatPolicy' the first arg in compat_policy_input_ok Daniel P. Berrangé
2026-10-28 13:35 ` [PATCH 2/8] qapi: add 'warn' option to CompatPolicyInput Daniel P. Berrangé
2026-10-29  6:56   ` Markus Armbruster
2026-10-29 10:48     ` Daniel P. Berrangé
2026-10-28 13:35 ` [PATCH 3/8] qapi: rename 'insecure-types' to 'insecure-input' Daniel P. Berrangé
2026-10-28 13:35 ` [PATCH 4/8] qapi: drop CompatPolicySecurity and use CompatPolicyInput Daniel P. Berrangé
2026-10-29  6:15   ` Markus Armbruster
2026-10-29 10:48     ` Daniel P. Berrangé [this message]
2026-10-28 13:36 ` [PATCH 5/8] qapi: rename compat_policy_check_security method Daniel P. Berrangé
2026-10-28 13:36 ` [PATCH 6/8] qapi: reverse arg order in compat_policy_security_ok Daniel P. Berrangé
2026-10-28 13:36 ` [PATCH 7/8] qemu-options: document -compat insecure-input parameter Daniel P. Berrangé
2026-10-29  6:52   ` Markus Armbruster
2026-10-29 10:56     ` Daniel P. Berrangé
2026-10-28 13:36 ` [PATCH 8/8] qapi: print a message before aborting for -compat violations 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=auMkm9PvgJbi-r5F@redhat.com \
    --to=berrange@redhat.com \
    --cc=armbru@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.