public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2 1/2] NetworkPkg/TcpDxe: Add wnd scale check before shrinking window
  2017-04-20  9:30 [PATCH v2 0/2] Add wnd scale check before shrinking window atepin
  2017-04-20  9:30 ` [PATCH v2 2/2] MdeModulePkg/Tcp4Dxe: " atepin
@ 2017-04-20  9:30 ` atepin
  2017-04-20  9:39 ` [PATCH v2 0/2] " atepin
  2017-05-05  2:43 ` Fu, Siyuan
  3 siblings, 0 replies; 5+ messages in thread
From: atepin @ 2017-04-20  9:30 UTC (permalink / raw)
  To: edk2-devel@lists.01.org

Moving Right window edge to the left on sender side without additional
check can lead to the TCP deadlock, when receiver ACKs proper segment,
while sender discards it for future ACK. To prevent this add check if
usable window (or shrink amount in this case) is bigger then receiver's
window scale factor.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Andrey Tepin <atepin@kraftway.ru>
---
 NetworkPkg/TcpDxe/TcpInput.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/NetworkPkg/TcpDxe/TcpInput.c b/NetworkPkg/TcpDxe/TcpInput.c
index 04c8a82..74ea02b 100644
--- a/NetworkPkg/TcpDxe/TcpInput.c
+++ b/NetworkPkg/TcpDxe/TcpInput.c
@@ -1306,8 +1306,21 @@ TcpInput (
       }
 
       if (TCP_SEQ_LT (Right, Tcb->SndNxt)) {
+        DEBUG (
+          (EFI_D_WARN,
+          "TcpInput: peer advise negative useable window for connected TCB %p\n",
+          Tcb)
+          );
 
-        Tcb->SndNxt = Right;
+        INT32 Usable = Tcb->SndNxt - Right;
+        if ((Usable >> Tcb->SndWndScale) > 0) {
+          DEBUG (
+            (EFI_D_WARN,
+            "TcpInput: SndNxt is out of window by more than window scale for TCB %p\n",
+            Tcb)
+            );
+          Tcb->SndNxt = Right;
+        }
 
         if (Right == Tcb->SndUna) {
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 0/2] Add wnd scale check before shrinking window
@ 2017-04-20  9:30 atepin
  2017-04-20  9:30 ` [PATCH v2 2/2] MdeModulePkg/Tcp4Dxe: " atepin
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: atepin @ 2017-04-20  9:30 UTC (permalink / raw)
  To: edk2-devel@lists.01.org

This is an updated patch. Previous patch can be found in thread named
"Fix unconditional window shrinking" here:
https://lists.01.org/pipermail/edk2-devel/2017-March/009129.html

Andrey Tepin (2):
  NetworkPkg/TcpDxe: Add wnd scale check before shrinking window
  MdeModulePkg/Tcp4Dxe: Add wnd scale check before shrinking window

 MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Input.c | 15 ++++++++++++++-
 NetworkPkg/TcpDxe/TcpInput.c                       | 15 ++++++++++++++-
 2 files changed, 28 insertions(+), 2 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 2/2] MdeModulePkg/Tcp4Dxe: Add wnd scale check before shrinking window
  2017-04-20  9:30 [PATCH v2 0/2] Add wnd scale check before shrinking window atepin
@ 2017-04-20  9:30 ` atepin
  2017-04-20  9:30 ` [PATCH v2 1/2] NetworkPkg/TcpDxe: " atepin
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: atepin @ 2017-04-20  9:30 UTC (permalink / raw)
  To: edk2-devel@lists.01.org

Moving Right window edge to the left on sender side without additional
check can lead to the TCP deadlock, when receiver ACKs proper segment,
while sender discards it for future ACK. To prevent this add check if
usable window (or shrink amount in this case) is bigger then receiver's
window scale factor.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Andrey Tepin <atepin@kraftway.ru>
---
 MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Input.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Input.c b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Input.c
index 1000538..77110d8 100644
--- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Input.c
+++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Input.c
@@ -1187,8 +1187,21 @@ TcpInput (
       }
 
       if (TCP_SEQ_LT (Right, Tcb->SndNxt)) {
+        DEBUG (
+          (EFI_D_WARN,
+          "TcpInput: peer advise negative useable window for connected TCB %p\n",
+          Tcb)
+          );
 
-        Tcb->SndNxt = Right;
+        INT32 Usable = Tcb->SndNxt - Right;
+        if ((Usable >> Tcb->SndWndScale) > 0) {
+          DEBUG (
+            (EFI_D_WARN,
+            "TcpInput: SndNxt is out of window by more than window scale for TCB %p\n",
+            Tcb)
+            );
+          Tcb->SndNxt = Right;
+        }
 
         if (Right == Tcb->SndUna) {
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 0/2] Add wnd scale check before shrinking window
  2017-04-20  9:30 [PATCH v2 0/2] Add wnd scale check before shrinking window atepin
  2017-04-20  9:30 ` [PATCH v2 2/2] MdeModulePkg/Tcp4Dxe: " atepin
  2017-04-20  9:30 ` [PATCH v2 1/2] NetworkPkg/TcpDxe: " atepin
@ 2017-04-20  9:39 ` atepin
  2017-05-05  2:43 ` Fu, Siyuan
  3 siblings, 0 replies; 5+ messages in thread
From: atepin @ 2017-04-20  9:39 UTC (permalink / raw)
  To: edk2-devel@lists.01.org
  Cc: Fu, Siyuan, Ye, Ting, feng.tian@intel.com, Wu, Jiaxin

I'm adding recipients from previous thread.

Regards,
Andrey

On 20.04.2017 12:30, Тёпин Андрей Сергеевич wrote:
> This is an updated patch. Previous patch can be found in thread named
> "Fix unconditional window shrinking" here:
> https://lists.01.org/pipermail/edk2-devel/2017-March/009129.html
>
> Andrey Tepin (2):
>    NetworkPkg/TcpDxe: Add wnd scale check before shrinking window
>    MdeModulePkg/Tcp4Dxe: Add wnd scale check before shrinking window
>
>   MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Input.c | 15 ++++++++++++++-
>   NetworkPkg/TcpDxe/TcpInput.c                       | 15 ++++++++++++++-
>   2 files changed, 28 insertions(+), 2 deletions(-)
>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 0/2] Add wnd scale check before shrinking window
  2017-04-20  9:30 [PATCH v2 0/2] Add wnd scale check before shrinking window atepin
                   ` (2 preceding siblings ...)
  2017-04-20  9:39 ` [PATCH v2 0/2] " atepin
@ 2017-05-05  2:43 ` Fu, Siyuan
  3 siblings, 0 replies; 5+ messages in thread
From: Fu, Siyuan @ 2017-05-05  2:43 UTC (permalink / raw)
  To: atepin@kraftway.ru, edk2-devel@lists.01.org

Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of atepin@kraftway.ru
Sent: 2017年4月20日 17:31
To: edk2-devel@lists.01.org
Subject: [edk2] [PATCH v2 0/2] Add wnd scale check before shrinking window

This is an updated patch. Previous patch can be found in thread named "Fix unconditional window shrinking" here:
https://lists.01.org/pipermail/edk2-devel/2017-March/009129.html

Andrey Tepin (2):
  NetworkPkg/TcpDxe: Add wnd scale check before shrinking window
  MdeModulePkg/Tcp4Dxe: Add wnd scale check before shrinking window

 MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Input.c | 15 ++++++++++++++-
 NetworkPkg/TcpDxe/TcpInput.c                       | 15 ++++++++++++++-
 2 files changed, 28 insertions(+), 2 deletions(-)

--
2.7.4
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-05-05  2:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-20  9:30 [PATCH v2 0/2] Add wnd scale check before shrinking window atepin
2017-04-20  9:30 ` [PATCH v2 2/2] MdeModulePkg/Tcp4Dxe: " atepin
2017-04-20  9:30 ` [PATCH v2 1/2] NetworkPkg/TcpDxe: " atepin
2017-04-20  9:39 ` [PATCH v2 0/2] " atepin
2017-05-05  2:43 ` Fu, Siyuan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox