[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wgL7sh-+6mPk7FGCFtjuh36fhOLNRTT0_4g3yd380P0+w@mail.gmail.com>
Date:   Sun, 23 Oct 2022 15:15:08 -0700
From:   Linus Torvalds <torvalds@...ux-foundation.org>
To:     Paolo Bonzini <pbonzini@...hat.com>,
        Alexander Graf <graf@...zon.com>
Cc:     linux-kernel@...r.kernel.org, kvm@...r.kernel.org
Subject: Re: [GIT PULL] KVM patches for Linux 6.1-rc2
On Sun, Oct 23, 2022 at 10:43 AM Paolo Bonzini <pbonzini@...hat.com> wrote:
>
> x86:
>
> - add compat implementation for KVM_X86_SET_MSR_FILTER ioctl
Side note: this should probably have used
        compat_uptr_t bitmap;
        ...
        .bitmap = compat_ptr(cr->bitmap),
instead of doing that
        __u32 bitmap;
        ...
       .bitmap = (__u8 *)(ulong)cr->bitmap,
because not only are those casts really ugly, using that
'compat_uptr_t" and "compat_ptr()" helper also really explains what is
going on.
compat_ptr() also happens to get the address space right (ie it
returns a "void __user *" pointer). But since the non-compat 'struct
kvm_msr_filter_range' bitmap member doesn't get that right either
(because it uses the same type for kernel pointers as for user
pointers - ugly uglt), that isn't such a big deal. The kvm code
clearly doesn't do proper user pointer typing, and just uses random
casts instead.
                         Linus
Powered by blists - more mailing lists