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] [thread-next>] [day] [month] [year] [list]
Message-ID: <bab433300707300739s283bf15fp9d00235cf39fa08b@mail.gmail.com>
Date:	Mon, 30 Jul 2007 20:09:53 +0530
From:	pravin <pravin.shelar@...il.com>
To:	"David Miller" <davem@...emloft.net>
Cc:	shannon.nelson@...el.com, netdev@...r.kernel.org,
	viro@....linux.org.uk, christopher.leech@...el.com,
	andy.grover@...il.com
Subject: Re: [PATCH] NET_DMA: remove unused dma_memcpy_to_kernel_iovec

On 7/26/07, David Miller <davem@...emloft.net> wrote:
> From: Shannon Nelson <shannon.nelson@...el.com>
> Date: Tue, 24 Jul 2007 17:36:06 -0700
>
> > (repost - original eaten by vger?)
> >
> > Al Viro pointed out that dma_memcpy_to_kernel_iovec() really was
> > unreachable and thus unused.  The code originally was there to support
> > in-kernel dma needs, but since it remains unused, we'll pull it out.
> >
> > Signed-off-by: Shannon Nelson <shannon.nelson@...el.com>
>
> Applied, thanks Shannon.

NET_DMA on kernel buffer is pretty useful in ndb, iSCSI target and
initiators which uses kernel buffer to receive data. Are there any
other issues with dma-memcpy on kernel buffers, if not then following
patch makes dma_memcpy_to_kernel_iovec() reachable from tcp_recvmsg.
I tested this patch and it work fine with unh iSCSI target.


comments?

--pravin.

Index: linux-2.6.23-rc1/net/ipv4/tcp.c
===================================================================
--- linux-2.6.23-rc1.orig/net/ipv4/tcp.c	2007-07-23 02:11:00.000000000 +0530
+++ linux-2.6.23-rc1/net/ipv4/tcp.c	2007-07-30 17:43:51.000000000 +0530
@@ -1115,7 +1115,7 @@
 	int target;		/* Read at least this many bytes */
  	long timeo;
  	struct task_struct *user_recv = NULL;
-	int copied_early = 0;
+	int copied_early = 0, kernel_dma = 0;
  	struct sk_buff *skb;

  	lock_sock(sk);
@@ -1154,6 +1154,9 @@
 		    !sysctl_tcp_low_latency &&
 		    __get_cpu_var(softnet_data).net_dma) {
 			preempt_enable_no_resched();
+			if (segment_eq(get_fs(), KERNEL_DS))
+				kernel_dma = 1;
+			else
  			tp->ucopy.pinned_list =
  					dma_pin_iovec_pages(msg->msg_iov, len);
 		} else {
@@ -1362,7 +1365,7 @@

 		if (!(flags & MSG_TRUNC)) {
  #ifdef CONFIG_NET_DMA
-			if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list)
+			if (!tp->ucopy.dma_chan  && (kernel_dma || tp->ucopy.pinned_list))
  				tp->ucopy.dma_chan = get_softnet_dma();

  			if (tp->ucopy.dma_chan) {



> -
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ