RE: [PATCH v3 2/4] x86/microcode: Fix __user annotations around generic_load_microcode()

2019-04-02 Thread David Laight
From: Borislav Petkov > Sent: 02 April 2019 11:02 > > On Mon, Apr 01, 2019 at 07:53:46PM +0200, Jann Horn wrote: > > Hm. request_microcode_fw() gets that buffer from > > request_firmware_direct(), which does this: > > > > __module_get(THIS_MODULE); > > ret = _request_firmware(firmw

Re: [PATCH v3 2/4] x86/microcode: Fix __user annotations around generic_load_microcode()

2019-04-02 Thread Borislav Petkov
On Mon, Apr 01, 2019 at 07:53:46PM +0200, Jann Horn wrote: > Hm. request_microcode_fw() gets that buffer from > request_firmware_direct(), which does this: > > __module_get(THIS_MODULE); > ret = _request_firmware(firmware_p, name, device, NULL, 0, >

RE: [PATCH v3 2/4] x86/microcode: Fix __user annotations around generic_load_microcode()

2019-04-02 Thread David Laight
From: Jann Horn > Sent: 01 April 2019 18:54 ... > > This ->get_ucode_data() BIOS-code-like contraption has always bugged me > > for being too ugly to live. > > > > How about we vmalloc() a properly sized buffer - both > > generic_load_microcode() callers have the size - and then hand that > > buffe

Re: [PATCH v3 2/4] x86/microcode: Fix __user annotations around generic_load_microcode()

2019-04-01 Thread Jann Horn
On Mon, Apr 1, 2019 at 7:30 PM Borislav Petkov wrote: > > On Fri, Mar 29, 2019 at 10:46:50PM +0100, Jann Horn wrote: > > generic_load_microcode() deals with a pointer that can be either a kernel > > pointer or a user pointer. Pass it around as a __user pointer so that it > > can't be dereferenced

Re: [PATCH v3 2/4] x86/microcode: Fix __user annotations around generic_load_microcode()

2019-04-01 Thread Borislav Petkov
On Fri, Mar 29, 2019 at 10:46:50PM +0100, Jann Horn wrote: > generic_load_microcode() deals with a pointer that can be either a kernel > pointer or a user pointer. Pass it around as a __user pointer so that it > can't be dereferenced accidentally while its address space is unknown. > Use explicit c

[PATCH v3 2/4] x86/microcode: Fix __user annotations around generic_load_microcode()

2019-03-29 Thread Jann Horn
generic_load_microcode() deals with a pointer that can be either a kernel pointer or a user pointer. Pass it around as a __user pointer so that it can't be dereferenced accidentally while its address space is unknown. Use explicit casts to convert between __user and __kernel to inform the checker t