From: Paolo Bonzini <pbonzini@redhat.com>
To: Sean Christopherson <seanjc@google.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
Will Deacon <will@kernel.org>, Marc Zyngier <maz@kernel.org>,
Peter Gonda <pgonda@google.com>
Subject: Re: [PATCH for-5.18] KVM: fix bad user ABI for KVM_EXIT_SYSTEM_EVENT
Date: Fri, 29 Apr 2022 16:05:52 +0200 [thread overview]
Message-ID: <bbf38496-658a-d6ca-b76c-d3642609b8fb@redhat.com> (raw)
In-Reply-To: <YmvwK0MeKpsQkZN4@google.com>
On 4/29/22 16:03, Sean Christopherson wrote:
> On Fri, Apr 22, 2022, Paolo Bonzini wrote:
>> For compatibility with userspace that was using the flags field,
>> a union overlaps flags with data[0].
>
> I think "compatibility" is slightly misleading, e.g. the offset of the field is
> changing for 32-bit userspace.
Well, the only such userspace AFAIK is crosvm on ARM and there's no
compat ABI for ARM. But yeah, your wording below sounds good.
> To avoid breaking compilation of userspace that was using the flags
> field, provide a userspace-only union to overlap flags with data[0].
>
>> diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
>> index 91a6fe4e02c0..f903ab0c8d7a 100644
>> --- a/include/uapi/linux/kvm.h
>> +++ b/include/uapi/linux/kvm.h
>> @@ -445,7 +445,11 @@ struct kvm_run {
>> #define KVM_SYSTEM_EVENT_RESET 2
>> #define KVM_SYSTEM_EVENT_CRASH 3
>> __u32 type;
>> - __u64 flags;
>> + __u32 ndata;
>> + union {
>> + __u64 flags;
>
> As alluded to above, what about wrapping flags in
>
> #ifndef __KERNEL__
> __u64 flags;
> #endif
>
> so that KVM doesn't try to use flags?
Interesting idea. I'll apply it and push the patch.
Thanks for the review!
Paolo
>> + __u64 data[16];
>> + };
>> } system_event;
>> /* KVM_EXIT_S390_STSI */
>> struct {
>
prev parent reply other threads:[~2022-04-29 14:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-22 10:30 Paolo Bonzini
2022-04-22 19:57 ` kernel test robot
2022-04-29 4:38 ` Oliver Upton
2022-04-29 13:52 ` Paolo Bonzini
2022-04-29 14:03 ` Sean Christopherson
2022-04-29 14:05 ` Paolo Bonzini [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=bbf38496-658a-d6ca-b76c-d3642609b8fb@redhat.com \
--to=pbonzini@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=pgonda@google.com \
--cc=seanjc@google.com \
--cc=will@kernel.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 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®