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>] [day] [month] [year] [list]
Date:   Mon,  9 Apr 2018 22:31:43 +0800
From:   Jia-Ju Bai <baijiaju1990@...il.com>
To:     ccaulfie@...hat.com, teigland@...hat.com
Cc:     cluster-devel@...hat.com, linux-kernel@...r.kernel.org,
        Jia-Ju Bai <baijiaju1990@...il.com>
Subject: [PATCH] fs: dls: lowcomms: Replace GFP_ATOMIC with GFP_KERNEL in receive_from_sock

receive_from_sock() is never called in atomic context.

The call chain ending up at receive_from_sock() is:
[1] receive_from_sock() <- process_recv_sockets()
process_recv_sockets() is only set as a parameter of INIT_WORK()
And receive_from_sock() also calls mutex_lock(), which indicates
this function is not called in atomic context.

Despite never getting called from atomic context,
receive_from_sock() calls alloc_page() with GFP_ATOMIC,
which waits busily for allocation.
GFP_ATOMIC is not necessary and can be replaced with GFP_KERNEL,
to avoid busy waiting and improve the possibility of sucessful allocation.

This is found by a static analysis tool named DCNS written by myself.
And I also manually check it.

Signed-off-by: Jia-Ju Bai <baijiaju1990@...il.com>
---
 fs/dlm/lowcomms.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index 4813d0e..2d4e230 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -633,7 +633,7 @@ static int receive_from_sock(struct connection *con)
 		 * This doesn't need to be atomic, but I think it should
 		 * improve performance if it is.
 		 */
-		con->rx_page = alloc_page(GFP_ATOMIC);
+		con->rx_page = alloc_page(GFP_KERNEL);
 		if (con->rx_page == NULL)
 			goto out_resched;
 		cbuf_init(&con->cb, PAGE_SIZE);
-- 
1.9.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ