Re: [PATCH] dma-direct: fix DMA_ATTR_NO_KERNEL_MAPPING

2021-11-02 Thread Walter Wu
Hi Christoph, I am sorry, fix my typo. Walter On Tue, 2021-11-02 at 07:41 +0100, Christoph Hellwig wrote: > As others pointed out, DMA_ATTR_NO_KERNEL_MAPPING just means the > caller can't rely on a kernel mapping. So the "fix" here is > wrong. That being said for cases where we can easily

Re: [PATCH] dma-direct: fix DMA_ATTR_NO_KERNEL_MAPPING

2021-11-02 Thread Walter Wu
Hi Cristoph, On Tue, 2021-11-02 at 07:41 +0100, Christoph Hellwig wrote: > As others pointed out, DMA_ATTR_NO_KERNEL_MAPPING just means the > caller can't rely on a kernel mapping. So the "fix" here is > wrong. That being said for cases where we can easily remove a page > from the kernel

Re: [PATCH] dma-direct: fix DMA_ATTR_NO_KERNEL_MAPPING

2021-11-02 Thread Christoph Hellwig
On Tue, Nov 02, 2021 at 11:21:16AM +0800, Walter Wu wrote: > Our platform is arch64. We need a dynamic allocated buffer from CMA is > not to read by CPU peculative execution, so we need to remove its > kernel mapping. If your CPU speculates into unused kernel direct mappings your have a worse

Re: [PATCH] dma-direct: fix DMA_ATTR_NO_KERNEL_MAPPING

2021-11-02 Thread Christoph Hellwig
As others pointed out, DMA_ATTR_NO_KERNEL_MAPPING just means the caller can't rely on a kernel mapping. So the "fix" here is wrong. That being said for cases where we can easily remove a page from the kernel mapping it would be nice to do to: a) improve security b) as a debug check to see

Re: [PATCH] dma-direct: fix DMA_ATTR_NO_KERNEL_MAPPING

2021-11-01 Thread Walter Wu
On Mon, 2021-11-01 at 15:17 +0100, Ard Biesheuvel wrote: > On Mon, 1 Nov 2021 at 13:21, Walter Wu > wrote: > > > > Hi Ard, > > > > On Mon, 2021-11-01 at 09:34 +0100, Ard Biesheuvel wrote: > > > On Mon, 1 Nov 2021 at 04:17, Walter Wu > > > > > > wrote: > > > > > > > >

Re: [PATCH] dma-direct: fix DMA_ATTR_NO_KERNEL_MAPPING

2021-11-01 Thread Ard Biesheuvel
On Mon, 1 Nov 2021 at 13:21, Walter Wu wrote: > > Hi Ard, > > On Mon, 2021-11-01 at 09:34 +0100, Ard Biesheuvel wrote: > > On Mon, 1 Nov 2021 at 04:17, Walter Wu > > wrote: > > > > > > DMA_ATTR_NO_KERNEL_MAPPING is to avoid creating a kernel mapping > > > for the allocated buffer, but current

Re: [PATCH] dma-direct: fix DMA_ATTR_NO_KERNEL_MAPPING

2021-11-01 Thread Walter Wu
Hi Ard, On Mon, 2021-11-01 at 09:34 +0100, Ard Biesheuvel wrote: > On Mon, 1 Nov 2021 at 04:17, Walter Wu > wrote: > > > > DMA_ATTR_NO_KERNEL_MAPPING is to avoid creating a kernel mapping > > for the allocated buffer, but current implementation is that > > PTE of allocated buffer in kernel page

Re: [PATCH] dma-direct: fix DMA_ATTR_NO_KERNEL_MAPPING

2021-11-01 Thread Walter Wu
Hi Robin, On Mon, 2021-11-01 at 10:29 +, Robin Murphy wrote: > On 2021-11-01 03:15, Walter Wu wrote: > > DMA_ATTR_NO_KERNEL_MAPPING is to avoid creating a kernel mapping > > for the allocated buffer, but current implementation is that > > PTE of allocated buffer in kernel page table is valid.

Re: [PATCH] dma-direct: fix DMA_ATTR_NO_KERNEL_MAPPING

2021-11-01 Thread Robin Murphy
On 2021-11-01 03:15, Walter Wu wrote: DMA_ATTR_NO_KERNEL_MAPPING is to avoid creating a kernel mapping for the allocated buffer, but current implementation is that PTE of allocated buffer in kernel page table is valid. So we should set invalid for PTE of allocate buffer so that there are no

Re: [PATCH] dma-direct: fix DMA_ATTR_NO_KERNEL_MAPPING

2021-11-01 Thread Ard Biesheuvel
On Mon, 1 Nov 2021 at 04:17, Walter Wu wrote: > > DMA_ATTR_NO_KERNEL_MAPPING is to avoid creating a kernel mapping > for the allocated buffer, but current implementation is that > PTE of allocated buffer in kernel page table is valid. So we > should set invalid for PTE of allocate buffer so that

Re: [PATCH] dma-direct: fix DMA_ATTR_NO_KERNEL_MAPPING

2021-11-01 Thread kernel test robot
Hi Walter, Thank you for the patch! Yet something to improve: [auto build test ERROR on linux/master] [also build test ERROR on linus/master v5.15 next-20211029] [cannot apply to hch-configfs/for-next] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting