From: Ian Munsie <hidden> Date: 2015-07-07 05:48:25
From: Ian Munsie <redacted>
It was discovered that if a process mmaped their problem state area they
were able to access one page more than expected, potentially allowing
them to access the problem state area of an unrelated process.
This was due to a simple off by one error in the mmap fault handler
introduced in 0712dc7e73e59d79bcead5d5520acf4e9e917e87 ("cxl: Fix issues
when unmapping contexts"), which is fixed in this patch.
Cc: stable@vger.kernel.org
Fixes: 0712dc7e73e5 ("cxl: Fix issues when unmapping contexts")
Signed-off-by: Ian Munsie <redacted>
---
drivers/misc/cxl/context.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
From: Ian Munsie <hidden> Date: 2015-07-07 05:48:14
From: Ian Munsie <redacted>
This patch makes the mmap call fail outright if the requested region is
larger than the problem state area assigned to the context so the error
is reported immediately rather than waiting for an attempt to access an
address out of bounds.
Although we never expect users to map more than the assigned problem
state area and are not aware of anyone doing this (other than for
testing), this does have the potential to break users if someone has
used a larger range regardless. I'm submitting it for consideration, but
if this change is not considered acceptable the previous patch is
sufficient to prevent access out of bounds without breaking anyone.
Signed-off-by: Ian Munsie <redacted>
---
drivers/misc/cxl/context.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
@@ -145,8 +145,16 @@ static const struct vm_operations_struct cxl_mmap_vmops = {*/intcxl_context_iomap(structcxl_context*ctx,structvm_area_struct*vma){+u64start=vma->vm_pgoff<<PAGE_SHIFT;u64len=vma->vm_end-vma->vm_start;-len=min(len,ctx->psn_size);++if(ctx->afu->current_mode==CXL_MODE_DEDICATED){+if(start+len>ctx->afu->adapter->ps_size)+return-EINVAL;+}else{+if(start+len>ctx->psn_size)+return-EINVAL;+}if(ctx->afu->current_mode!=CXL_MODE_DEDICATED){/* make sure there is a valid per process space for this AFU */
From: Michael Ellerman <mpe@ellerman.id.au> Date: 2015-07-08 10:54:14
On Tue, 2015-07-07 at 05:45:45 UTC, Ian Munsie wrote:
From: Ian Munsie <redacted>
It was discovered that if a process mmaped their problem state area they
were able to access one page more than expected, potentially allowing
them to access the problem state area of an unrelated process.
This was due to a simple off by one error in the mmap fault handler
introduced in 0712dc7e73e59d79bcead5d5520acf4e9e917e87 ("cxl: Fix issues
when unmapping contexts"), which is fixed in this patch.
Cc: stable@vger.kernel.org
Fixes: 0712dc7e73e5 ("cxl: Fix issues when unmapping contexts")
Signed-off-by: Ian Munsie <redacted>
From: Michael Ellerman <mpe@ellerman.id.au> Date: 2015-07-08 10:54:16
On Tue, 2015-07-07 at 05:45:46 UTC, Ian Munsie wrote:
From: Ian Munsie <redacted>
This patch makes the mmap call fail outright if the requested region is
larger than the problem state area assigned to the context so the error
is reported immediately rather than waiting for an attempt to access an
address out of bounds.
Although we never expect users to map more than the assigned problem
state area and are not aware of anyone doing this (other than for
testing), this does have the potential to break users if someone has
used a larger range regardless. I'm submitting it for consideration, but
if this change is not considered acceptable the previous patch is
sufficient to prevent access out of bounds without breaking anyone.
Signed-off-by: Ian Munsie <redacted>