Re: [PATCH v10 0/7] Introduce sendpage_ok() to detect misused sendpage in network related drivers

2020-10-03 Thread Coly Li
On 2020/10/3 06:28, David Miller wrote: > From: Coly Li > Date: Fri, 2 Oct 2020 16:27:27 +0800 > >> As Sagi Grimberg suggested, the original fix is refind to a more common >> inline routine: >> static inline bool sendpage_ok(struct page *page) >> { &

...

2020-10-03 Thread Coly Li
On 2020/10/3 06:28, David Miller wrote: > From: Coly Li > Date: Fri, 2 Oct 2020 16:27:27 +0800 > >> As Sagi Grimberg suggested, the original fix is refind to a more common >> inline routine: >> static inline bool sendpage_ok(struct page *page) >> { &

Re: [PATCH v9 0/7] Introduce sendpage_ok() to detect misused sendpage in network related drivers

2020-10-02 Thread Coly Li
ll patches are the latest version. Sorry for the inconvenience and thank you in advance for taking this set. Coly Li -- You received this message because you are subscribed to the Google Groups "open-iscsi" group. To unsubscribe from this group and stop receiving emails fr

[PATCH v10 6/7] scsi: libiscsi: use sendpage_ok() in iscsi_tcp_segment_map()

2020-10-02 Thread Coly Li
" part is to make sure the page can be sent to network layer's zero copy path. This part is exactly what sendpage_ok() does. This patch uses use sendpage_ok() in iscsi_tcp_segment_map() to replace the original open coded checks. Signed-off-by: Coly Li Reviewed-by: Lee Duncan Acked-by: M

[PATCH v10 5/7] drbd: code cleanup by using sendpage_ok() to check page for kernel_sendpage()

2020-10-02 Thread Coly Li
cro sendpage_ok() does, which is introduced into include/linux/net.h to solve a similar send page issue in nvme-tcp code. This patch uses macro sendpage_ok() to replace the open coded checks to page type and refcount in _drbd_send_page(), as a code cleanup. Signed-off-by: Coly Li Cc: Philipp Reisner

[PATCH v10 7/7] libceph: use sendpage_ok() in ceph_tcp_sendpage()

2020-10-02 Thread Coly Li
) as a code cleanup. Signed-off-by: Coly Li Acked-by: Jeff Layton Cc: Ilya Dryomov --- net/ceph/messenger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index bdfd66ba3843..d4d7a0e52491 100644 --- a/net/ceph/messenger.c +++

[PATCH v10 4/7] tcp: use sendpage_ok() to detect misused .sendpage

2020-10-02 Thread Coly Li
cts") Suggested-by: Eric Dumazet Signed-off-by: Coly Li Cc: Vasily Averin Cc: David S. Miller Cc: sta...@vger.kernel.org --- net/ipv4/tcp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 31f3b858db81..2135ee7c806d 100644 --- a/

[PATCH v10 2/7] net: add WARN_ONCE in kernel_sendpage() for improper zero-copy send

2020-10-02 Thread Coly Li
existing kernel_sendpage() behavior for the improper page zero-copy send, it just provides hint warning message for following potential panic due the kernel memory heap corruption. Signed-off-by: Coly Li Cc: Cong Wang Cc: Christoph Hellwig Cc: David S. Miller Cc: Sridhar Samudrala --- net

[PATCH v10 3/7] nvme-tcp: check page by sendpage_ok() before calling kernel_sendpage()

2020-10-02 Thread Coly Li
sock_no_sendpage to handle this page. Signed-off-by: Coly Li Cc: Chaitanya Kulkarni Cc: Christoph Hellwig Cc: Hannes Reinecke Cc: Jan Kara Cc: Jens Axboe Cc: Mikhail Skorzhinskii Cc: Philipp Reisner Cc: Sagi Grimberg Cc: Vlastimil Babka Cc: sta...@vger.kernel.org --- drivers/nvme/host

[PATCH v10 1/7] net: introduce helper sendpage_ok() in include/linux/net.h

2020-10-02 Thread Coly Li
to send page to remote end by kernel_sendpage() may use this helper to check whether the page is OK. If the helper does not return true, the driver should try other non sendpage method (e.g. sock_no_sendpage()) to handle the page. Signed-off-by: Coly Li Cc: Chaitanya Kulkarni Cc: Christoph

[PATCH v10 0/7] Introduce sendpage_ok() to detect misused sendpage in network related drivers

2020-10-02 Thread Coly Li
el_sendpage(). - The 3rd patch fixes the page checking issue in nvme-over-tcp driver. - The 4th patch adds page_count check by using sendpage_ok() in do_tcp_sendpages() as Eric Dumazet suggested. - The 5th and 6th patches just replace existing open coded checks with the inline sendpage_ok() routine.

[PATCH v9 6/7] scsi: libiscsi: use sendpage_ok() in iscsi_tcp_segment_map()

2020-10-01 Thread Coly Li
" part is to make sure the page can be sent to network layer's zero copy path. This part is exactly what sendpage_ok() does. This patch uses use sendpage_ok() in iscsi_tcp_segment_map() to replace the original open coded checks. Signed-off-by: Coly Li Acked-by: Martin K. Petersen Cc

[PATCH v9 4/7] tcp: use sendpage_ok() to detect misused .sendpage

2020-10-01 Thread Coly Li
cts") Suggested-by: Eric Dumazet Signed-off-by: Coly Li Cc: Vasily Averin Cc: David S. Miller Cc: sta...@vger.kernel.org --- net/ipv4/tcp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 31f3b858db81..2135ee7c806d 100644 --- a/

[PATCH v9 5/7] drbd: code cleanup by using sendpage_ok() to check page for kernel_sendpage()

2020-10-01 Thread Coly Li
cro sendpage_ok() does, which is introduced into include/linux/net.h to solve a similar send page issue in nvme-tcp code. This patch uses macro sendpage_ok() to replace the open coded checks to page type and refcount in _drbd_send_page(), as a code cleanup. Signed-off-by: Coly Li Cc: Philipp Reisner

[PATCH v9 7/7] libceph: use sendpage_ok() in ceph_tcp_sendpage()

2020-10-01 Thread Coly Li
) as a code cleanup. Signed-off-by: Coly Li Acked-by: Jeff Layton Cc: Ilya Dryomov --- net/ceph/messenger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index bdfd66ba3843..d4d7a0e52491 100644 --- a/net/ceph/messenger.c +++

[PATCH v9 3/7] nvme-tcp: check page by sendpage_ok() before calling kernel_sendpage()

2020-10-01 Thread Coly Li
sock_no_sendpage to handle this page. Signed-off-by: Coly Li Cc: Chaitanya Kulkarni Cc: Christoph Hellwig Cc: Hannes Reinecke Cc: Jan Kara Cc: Jens Axboe Cc: Mikhail Skorzhinskii Cc: Philipp Reisner Cc: Sagi Grimberg Cc: Vlastimil Babka Cc: sta...@vger.kernel.org --- drivers/nvme/host

[PATCH v9 1/7] net: introduce helper sendpage_ok() in include/linux/net.h

2020-10-01 Thread Coly Li
to send page to remote end by kernel_sendpage() may use this helper to check whether the page is OK. If the helper does not return true, the driver should try other non sendpage method (e.g. sock_no_sendpage()) to handle the page. Signed-off-by: Coly Li Cc: Chaitanya Kulkarni Cc: Christoph

[PATCH v9 2/7] net: add WARN_ONCE in kernel_sendpage() for improper zero-copy send

2020-10-01 Thread Coly Li
existing kernel_sendpage() behavior for the improper page zero-copy send, it just provides hint warning message for following potential panic due the kernel memory heap corruption. Signed-off-by: Coly Li Cc: Cong Wang Cc: Christoph Hellwig Cc: David S. Miller Cc: Sridhar Samudrala --- net

[PATCH v9 0/7] Introduce sendpage_ok() to detect misused sendpage in network related drivers

2020-10-01 Thread Coly Li
-tcp driver. - The 4th patch adds page_count check by using sendpage_ok() in do_tcp_sendpages() as Eric Dumazet suggested. - The 5th and 6th patches just replace existing open coded checks with the inline sendpage_ok() routine. Coly Li Cc: Chaitanya Kulkarni Cc: Chris Leech Cc: Christoph Hellwi

Re: [PATCH v8 1/7] net: introduce helper sendpage_ok() in include/linux/net.h

2020-09-26 Thread Coly Li
On 2020/9/25 23:18, Greg KH wrote: > On Fri, Sep 25, 2020 at 11:01:13PM +0800, Coly Li wrote: >> The original problem was from nvme-over-tcp code, who mistakenly uses >> kernel_sendpage() to send pages allocated by __get_free_pages() without >> __GFP_COMP flag. Such page

[PATCH v8 4/7] tcp: use sendpage_ok() to detect misused .sendpage

2020-09-25 Thread Coly Li
cts") Suggested-by: Eric Dumazet Signed-off-by: Coly Li Cc: Vasily Averin Cc: David S. Miller Cc: sta...@vger.kernel.org --- net/ipv4/tcp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 31f3b858db81..2135ee7c806d 100644 --- a/

[PATCH v8 7/7] libceph: use sendpage_ok() in ceph_tcp_sendpage()

2020-09-25 Thread Coly Li
) as a code cleanup. Signed-off-by: Coly Li Cc: Ilya Dryomov Cc: Jeff Layton --- net/ceph/messenger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index bdfd66ba3843..d4d7a0e52491 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/

[PATCH v8 3/7] nvme-tcp: check page by sendpage_ok() before calling kernel_sendpage()

2020-09-25 Thread Coly Li
sock_no_sendpage to handle this page. Signed-off-by: Coly Li Cc: Chaitanya Kulkarni Cc: Christoph Hellwig Cc: Hannes Reinecke Cc: Jan Kara Cc: Jens Axboe Cc: Mikhail Skorzhinskii Cc: Philipp Reisner Cc: Sagi Grimberg Cc: Vlastimil Babka Cc: sta...@vger.kernel.org --- drivers/nvme/host

[PATCH v8 1/7] net: introduce helper sendpage_ok() in include/linux/net.h

2020-09-25 Thread Coly Li
to send page to remote end by kernel_sendpage() may use this helper to check whether the page is OK. If the helper does not return true, the driver should try other non sendpage method (e.g. sock_no_sendpage()) to handle the page. Signed-off-by: Coly Li Cc: Chaitanya Kulkarni Cc: Christoph

[PATCH v8 2/7] net: add WARN_ONCE in kernel_sendpage() for improper zero-copy send

2020-09-25 Thread Coly Li
existing kernel_sendpage() behavior for the improper page zero-copy send, it just provides hint warning message for following potential panic due the kernel memory heap corruption. Signed-off-by: Coly Li Cc: Cong Wang Cc: Christoph Hellwig Cc: David S. Miller Cc: Sridhar Samudrala --- net

[PATCH v8 5/7] drbd: code cleanup by using sendpage_ok() to check page for kernel_sendpage()

2020-09-25 Thread Coly Li
cro sendpage_ok() does, which is introduced into include/linux/net.h to solve a similar send page issue in nvme-tcp code. This patch uses macro sendpage_ok() to replace the open coded checks to page type and refcount in _drbd_send_page(), as a code cleanup. Signed-off-by: Coly Li Cc: Philipp Reisner

[PATCH v8 6/7] scsi: libiscsi: use sendpage_ok() in iscsi_tcp_segment_map()

2020-09-25 Thread Coly Li
" part is to make sure the page can be sent to network layer's zero copy path. This part is exactly what sendpage_ok() does. This patch uses use sendpage_ok() in iscsi_tcp_segment_map() to replace the original open coded checks. Signed-off-by: Coly Li Cc: Vasily Averin Cc: Cong Wang Cc:

[PATCH v8 0/7] Introduce sendpage_ok() to detect misused sendpage in network related drivers

2020-09-25 Thread Coly Li
patch adds page_count check by using sendpage_ok() in do_tcp_sendpages() as Eric Dumazet suggested. - The 5th and 6th patches just replace existing open coded checks with the inline sendpage_ok() routine. Coly Li Cc: Chaitanya Kulkarni Cc: Chris Leech Cc: Christoph Hellwig Cc: Cong Wang Cc: Davi

Re: [PATCH v7 1/6] net: introduce helper sendpage_ok() in include/linux/net.h

2020-09-23 Thread Coly Li
On 2020/9/23 16:43, Christoph Hellwig wrote: > On Wed, Aug 19, 2020 at 12:22:05PM +0800, Coly Li wrote: >> On 2020/8/19 03:49, Christoph Hellwig wrote: >>> On Wed, Aug 19, 2020 at 12:33:37AM +0800, Coly Li wrote: >>>> On 2020/8/19 00:24, Christoph Hellwig wro

Re: [PATCH v7 1/6] net: introduce helper sendpage_ok() in include/linux/net.h

2020-08-18 Thread Coly Li
On 2020/8/19 03:49, Christoph Hellwig wrote: > On Wed, Aug 19, 2020 at 12:33:37AM +0800, Coly Li wrote: >> On 2020/8/19 00:24, Christoph Hellwig wrote: >>> I think we should go for something simple like this instead: >> >> This idea is fine to me. Should a warning

[PATCH v6 6/6] libceph: use sendpage_ok() in ceph_tcp_sendpage()

2020-08-18 Thread Coly Li
) as a code cleanup. Signed-off-by: Coly Li Cc: Ilya Dryomov Cc: Jeff Layton --- net/ceph/messenger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 27d6ab11f9ee..6a349da7f013 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/

[PATCH v7 0/6] Introduce sendpage_ok() to detect misused sendpage in network related drivers

2020-08-18 Thread Coly Li
ce existing open coded checks with the inline sendpage_ok() routine. Coly Li Cc: Chaitanya Kulkarni Cc: Chris Leech Cc: Christoph Hellwig Cc: Cong Wang Cc: David S. Miller Cc: Eric Dumazet Cc: Hannes Reinecke Cc: Ilya Dryomov Cc: Jan Kara Cc: Jeff Layton Cc: Jens Axboe Cc: Lee Dunca

[PATCH v7 5/6] scsi: libiscsi: use sendpage_ok() in iscsi_tcp_segment_map()

2020-08-18 Thread Coly Li
" part is to make sure the page can be sent to network layer's zero copy path. This part is exactly what sendpage_ok() does. This patch uses use sendpage_ok() in iscsi_tcp_segment_map() to replace the original open coded checks. Signed-off-by: Coly Li Cc: Vasily Averin Cc: Cong Wang Cc:

[PATCH v6 4/6] drbd: code cleanup by using sendpage_ok() to check page for kernel_sendpage()

2020-08-18 Thread Coly Li
cro sendpage_ok() does, which is introduced into include/linux/net.h to solve a similar send page issue in nvme-tcp code. This patch uses macro sendpage_ok() to replace the open coded checks to page type and refcount in _drbd_send_page(), as a code cleanup. Signed-off-by: Coly Li Cc: Philipp Reisner

[PATCH v7 4/6] drbd: code cleanup by using sendpage_ok() to check page for kernel_sendpage()

2020-08-18 Thread Coly Li
cro sendpage_ok() does, which is introduced into include/linux/net.h to solve a similar send page issue in nvme-tcp code. This patch uses macro sendpage_ok() to replace the open coded checks to page type and refcount in _drbd_send_page(), as a code cleanup. Signed-off-by: Coly Li Cc: Philipp Reisner

[PATCH v7 3/6] tcp: use sendpage_ok() to detect misused .sendpage

2020-08-18 Thread Coly Li
cts") Suggested-by: Eric Dumazet Signed-off-by: Coly Li Cc: Vasily Averin Cc: David S. Miller Cc: sta...@vger.kernel.org --- net/ipv4/tcp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 31f3b858db81..2135ee7c806d 100644 --- a/

[PATCH v6 3/6] tcp: use sendpage_ok() to detect misused .sendpage

2020-08-18 Thread Coly Li
cts") Suggested-by: Eric Dumazet Signed-off-by: Coly Li Cc: Vasily Averin Cc: David S. Miller Cc: sta...@vger.kernel.org --- net/ipv4/tcp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 31f3b858db81..d96c7549895a 100644 --- a/

[PATCH v7 2/6] nvme-tcp: check page by sendpage_ok() before calling kernel_sendpage()

2020-08-18 Thread Coly Li
sock_no_sendpage to handle this page. Signed-off-by: Coly Li Cc: Chaitanya Kulkarni Cc: Christoph Hellwig Cc: Hannes Reinecke Cc: Jan Kara Cc: Jens Axboe Cc: Mikhail Skorzhinskii Cc: Philipp Reisner Cc: Sagi Grimberg Cc: Vlastimil Babka Cc: sta...@vger.kernel.org --- drivers/nvme/host

[PATCH v6 0/6] Introduce sendpage_ok() to detect misused sendpage in network related drivers

2020-08-18 Thread Coly Li
ce existing open coded checks with the inline sendpage_ok() routine. Coly Li Cc: Chaitanya Kulkarni Cc: Chris Leech Cc: Christoph Hellwig Cc: Cong Wang Cc: David S. Miller Cc: Hannes Reinecke Cc: Ilya Dryomov Cc: Jan Kara Cc: Jeff Layton Cc: Jens Axboe Cc: Lee Duncan Cc: Mike Christie

[PATCH v6 5/6] scsi: libiscsi: use sendpage_ok() in iscsi_tcp_segment_map()

2020-08-18 Thread Coly Li
" part is to make sure the page can be sent to network layer's zero copy path. This part is exactly what sendpage_ok() does. This patch uses use sendpage_ok() in iscsi_tcp_segment_map() to replace the original open coded checks. Signed-off-by: Coly Li Cc: Vasily Averin Cc: Cong Wang Cc:

Re: [PATCH v7 1/6] net: introduce helper sendpage_ok() in include/linux/net.h

2020-08-18 Thread Coly Li
r(s). And maybe the fix in nvme-tcp driver and do_tcp_sendpages() are still necessary. I am not network expert, this is my opinion for reference. Coly Li > --- > From 4867e158ee86ebd801b4c267e8f8a4a762a71343 Mon Sep 17 00:00:00 2001 > From: Christoph Hellwig > Date: Tue, 18 Aug 2020 18:19:23

[PATCH v7 1/6] net: introduce helper sendpage_ok() in include/linux/net.h

2020-08-18 Thread Coly Li
to send page to remote end by kernel_sendpage() may use this helper to check whether the page is OK. If the helper does not return true, the driver should try other non sendpage method (e.g. sock_no_sendpage()) to handle the page. Signed-off-by: Coly Li Cc: Chaitanya Kulkarni Cc: Christoph

[PATCH v6 2/6] nvme-tcp: check page by sendpage_ok() before calling kernel_sendpage()

2020-08-18 Thread Coly Li
sock_no_sendpage to handle this page. Signed-off-by: Coly Li Cc: Chaitanya Kulkarni Cc: Christoph Hellwig Cc: Hannes Reinecke Cc: Jan Kara Cc: Jens Axboe Cc: Mikhail Skorzhinskii Cc: Philipp Reisner Cc: Sagi Grimberg Cc: Vlastimil Babka Cc: sta...@vger.kernel.org --- drivers/nvme/host

[PATCH v6 1/6] net: introduce helper sendpage_ok() in include/linux/net.h

2020-08-18 Thread Coly Li
to send page to remote end by kernel_sendpage() may use this helper to check whether the page is OK. If the helper does not return true, the driver should try other non sendpage method (e.g. sock_no_sendpage()) to handle the page. Signed-off-by: Coly Li Cc: Chaitanya Kulkarni Cc: Christoph

[PATCH v7 6/6] libceph: use sendpage_ok() in ceph_tcp_sendpage()

2020-08-18 Thread Coly Li
) as a code cleanup. Signed-off-by: Coly Li Cc: Ilya Dryomov Cc: Jeff Layton --- net/ceph/messenger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 27d6ab11f9ee..6a349da7f013 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/