瀏覽代碼

[POWERPC] spufs: avoid accessing kernel memory through mmapped /mem node

I found an exploit in current kernel.
Currently, there is no range check about mmapping "/mem" node in
spufs. Thus, an application can access privilege memory region.

In case this kernel already worked on a public server, I send this
information only here.
If there are such servers in somewhere, please replace it, ASAP.

Signed-off-by: Masato Noguchi <Masato.Noguchi@jp.sony.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Masato Noguchi 18 年之前
父節點
當前提交
128b8546a8
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      arch/powerpc/platforms/cell/spufs/file.c

+ 3 - 0
arch/powerpc/platforms/cell/spufs/file.c

@@ -103,6 +103,9 @@ static unsigned long spufs_mem_mmap_nopfn(struct vm_area_struct *vma,
 
 
 	offset += vma->vm_pgoff << PAGE_SHIFT;
 	offset += vma->vm_pgoff << PAGE_SHIFT;
 
 
+	if (offset >= LS_SIZE)
+		return NOPFN_SIGBUS;
+
 	spu_acquire(ctx);
 	spu_acquire(ctx);
 
 
 	if (ctx->state == SPU_STATE_SAVED) {
 	if (ctx->state == SPU_STATE_SAVED) {