Re: [PATCH] block: Clear kernel memory before copying to user

2018-11-08 Thread Keith Busch
On Thu, Nov 08, 2018 at 07:10:58PM +0800, Ming Lei wrote: > I guess the issue may depend on specific QEMU version, just tried the test > over > virtio-scsi/sata/usb-storage emulated via qemu-2.10.2-1.fc27, not observed > this problem. I actually didn't use virtio-scsi, but it really doesn't

Re: [PATCH] block: Clear kernel memory before copying to user

2018-11-08 Thread Ming Lei
On Thu, Nov 8, 2018 at 6:07 PM Johannes Thumshirn wrote: > > On 08/11/2018 02:22, Keith Busch wrote: > > $ ./sg-test /dev/sda | grep -v 0 > > 40733f4019db8001244019db4065244019db0094244019db > >

Re: [PATCH] block: Clear kernel memory before copying to user

2018-11-08 Thread Johannes Thumshirn
On 08/11/2018 02:22, Keith Busch wrote: > $ ./sg-test /dev/sda | grep -v 0 > 40733f4019db8001244019db4065244019db0094244019db > c025244019dbc0e43a4019db40973a4019dbc0623a4019db >

Re: [PATCH] block: Clear kernel memory before copying to user

2018-11-07 Thread Jens Axboe
On 11/7/18 6:12 PM, Ming Lei wrote: > On Thu, Nov 8, 2018 at 12:12 AM Keith Busch wrote: >> >> On Thu, Nov 08, 2018 at 12:03:41AM +0800, Ming Lei wrote: >>> On Wed, Nov 7, 2018 at 11:47 PM Keith Busch wrote: On Wed, Nov 07, 2018 at 11:44:59PM +0800, Ming Lei wrote: >

Re: [PATCH] block: Clear kernel memory before copying to user

2018-11-07 Thread Keith Busch
On Thu, Nov 08, 2018 at 09:12:59AM +0800, Ming Lei wrote: > Is it NVMe specific issue or common problem in other storage hardware? SCSI > does call blk_update_request() and handles partial completion. Not specific to NVMe. An example using SG_IO dumping 2MB of unsanitized kernel memory:

Re: [PATCH] block: Clear kernel memory before copying to user

2018-11-07 Thread Jens Axboe
On 11/7/18 7:37 AM, Keith Busch wrote: > If the kernel allocates a bounce buffer for user read data, this memory > needs to be cleared before copying it to the user, otherwise it may leak > kernel memory to user space. Applied, thanks. -- Jens Axboe

Re: [PATCH] block: Clear kernel memory before copying to user

2018-11-07 Thread Keith Busch
On Thu, Nov 08, 2018 at 12:03:41AM +0800, Ming Lei wrote: > On Wed, Nov 7, 2018 at 11:47 PM Keith Busch wrote: > > > > On Wed, Nov 07, 2018 at 11:44:59PM +0800, Ming Lei wrote: > > > blk_update_request() may tell us how much progress made, :-) > > > > Except when it doesn't, which is 100% of the

Re: [PATCH] block: Clear kernel memory before copying to user

2018-11-07 Thread Ming Lei
On Wed, Nov 7, 2018 at 11:47 PM Keith Busch wrote: > > On Wed, Nov 07, 2018 at 11:44:59PM +0800, Ming Lei wrote: > > blk_update_request() may tell us how much progress made, :-) > > Except when it doesn't, which is 100% of the time for many block > drivers, including nvme. Please look at

Re: [PATCH] block: Clear kernel memory before copying to user

2018-11-07 Thread Keith Busch
On Wed, Nov 07, 2018 at 11:44:59PM +0800, Ming Lei wrote: > blk_update_request() may tell us how much progress made, :-) Except when it doesn't, which is 100% of the time for many block drivers, including nvme.

Re: [PATCH] block: Clear kernel memory before copying to user

2018-11-07 Thread Ming Lei
On Wed, Nov 7, 2018 at 11:19 PM Keith Busch wrote: > > On Wed, Nov 07, 2018 at 11:09:27PM +0800, Ming Lei wrote: > > On Wed, Nov 7, 2018 at 10:42 PM Keith Busch wrote: > > > > > > If the kernel allocates a bounce buffer for user read data, this memory > > > needs to be cleared before copying it

Re: [PATCH] block: Clear kernel memory before copying to user

2018-11-07 Thread Keith Busch
On Wed, Nov 07, 2018 at 11:09:27PM +0800, Ming Lei wrote: > On Wed, Nov 7, 2018 at 10:42 PM Keith Busch wrote: > > > > If the kernel allocates a bounce buffer for user read data, this memory > > needs to be cleared before copying it to the user, otherwise it may leak > > kernel memory to user

Re: [PATCH] block: Clear kernel memory before copying to user

2018-11-07 Thread Ming Lei
On Wed, Nov 7, 2018 at 10:42 PM Keith Busch wrote: > > If the kernel allocates a bounce buffer for user read data, this memory > needs to be cleared before copying it to the user, otherwise it may leak > kernel memory to user space. > > Signed-off-by: Keith Busch > --- > block/bio.c | 1 + > 1

Re: [PATCH] block: Clear kernel memory before copying to user

2018-11-07 Thread Laurence Oberman
On Wed, 2018-11-07 at 07:37 -0700, Keith Busch wrote: > If the kernel allocates a bounce buffer for user read data, this > memory > needs to be cleared before copying it to the user, otherwise it may > leak > kernel memory to user space. > > Signed-off-by: Keith Busch > --- >  block/bio.c | 1 +