lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 29 Oct 2013 09:44:24 +0100
From:	Paolo Minazzi <Paolo.Minazzi@...rol.it>
To:	linux-kernel@...r.kernel.org
Subject: bug in generic_access_phys (mm/memory.c) ?

Hi to all,
I think the function "generic_access_phys" in mm/memory.c has got a 
small bug.
THe ioremap_prot is called with the parameter size=PAGE_SIZE.
But it can happen that we need more than one page, and this will produce 
a kernel fault.

int generic_access_phys(struct vm_area_struct *vma, unsigned long addr,
                         void *buf, int len, int write)
{
         resource_size_t phys_addr;
         unsigned long prot = 0;
         void __iomem *maddr;
         int offset = addr & (PAGE_SIZE-1);

         if (follow_phys(vma, addr, write, &prot, &phys_addr))
                 return -EINVAL;

====>   maddr = ioremap_prot(phys_addr, PAGE_SIZE);

         if (write)
                 memcpy_toio(maddr + offset, buf, len);
         else
                 memcpy_fromio(buf, maddr + offset, len);
         iounmap(maddr);

         return len;
}


I think that the ioremap_prot should be changed with

maddr = ioremap_prot(phys_addr, ((phys_addr + offset + len - 1) & 
~(PAGE_SIZE-1)) -
                                 phys_addr + PAGE_SIZE);

Thanks,
Paolo Minazzi



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ