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-prev] [day] [month] [year] [list]
Message-ID: <20180121234828.fro77k4pr2b364y6@linux-n805>
Date:   Sun, 21 Jan 2018 15:48:28 -0800
From:   Davidlohr Bueso <dave@...olabs.net>
To:     Al Viro <viro@...IV.linux.org.uk>
Cc:     starvik@...s.com, jesper.nilsson@...s.com,
        akpm@...ux-foundation.org, linux-cris-kernel@...s.com,
        linux-kernel@...r.kernel.org, Davidlohr Bueso <dbueso@...e.de>
Subject: Re: [PATCH] arch/cris: use get_user_pages_fast()

On Sun, 21 Jan 2018, Al Viro wrote:

>On Sun, Jan 21, 2018 at 02:59:29PM -0800, Davidlohr Bueso wrote:
>> Since we currently hold mmap_sem across both gup calls (and
>> nothing more), we can substitute it with two _fast()
>> alternatives and possibly avoid grabbing the lock.
>>
>> This was found while adding mmap_sem wrappers, and was also
>> previously reported by Al: https://lkml.org/lkml/2017/11/17/777
>
>See commit 9a949e8ff92246c0753b2805c2a001cb991fffe5
>Author: Al Viro <viro@...iv.linux.org.uk>
>Date:   Sat Nov 18 14:37:46 2017 -0500
>
>    cris: switch to get_user_pages_fast()
>
>    no point holding ->mmap_sem over both calls.
>
>    Signed-off-by: Al Viro <viro@...iv.linux.org.uk>

Serves me for developing on Linus' tree, cool.

Now, regarding the other two which are technically bugs (not
holding mmap_sem under gup), you mention I don't see those in
next, so I'm assuming you didn't get to them.

- mthca_map_user_db(): I came to the same conclusion and tempted
  to send out the same idea of unlocking the mutex for gup_fast()
  so we can take mmap_sem if needed.

- ia64's store_virtual_to_phys() is a sysfs attribute and
  holds no (other) locks. How about we just convert it as well?

diff --git a/arch/ia64/kernel/err_inject.c b/arch/ia64/kernel/err_inject.c
index 85bba43e7d5d..658a8e06a69b 100644
--- a/arch/ia64/kernel/err_inject.c
+++ b/arch/ia64/kernel/err_inject.c
@@ -142,7 +142,7 @@ store_virtual_to_phys(struct device *dev, struct device_attribute *attr,
 	u64 virt_addr=simple_strtoull(buf, NULL, 16);
 	int ret;
 
-	ret = get_user_pages(virt_addr, 1, FOLL_WRITE, NULL, NULL);
+	ret = get_user_pages_fast(virt_addr, 1, FOLL_WRITE, NULL);
 	if (ret<=0) {
 #ifdef ERR_INJ_DEBUG
 		printk("Virtual address %lx is not existing.\n",virt_addr);


Thanks,
Davidlohr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ