lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <bbf38496-658a-d6ca-b76c-d3642609b8fb@redhat.com>
Date:   Fri, 29 Apr 2022 16:05:52 +0200
From:   Paolo Bonzini <pbonzini@...hat.com>
To:     Sean Christopherson <seanjc@...gle.com>
Cc:     linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
        Will Deacon <will@...nel.org>, Marc Zyngier <maz@...nel.org>,
        Peter Gonda <pgonda@...gle.com>
Subject: Re: [PATCH for-5.18] KVM: fix bad user ABI for KVM_EXIT_SYSTEM_EVENT

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 {
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ