Received: by 10.192.165.156 with SMTP id m28csp2741920imm; Sun, 15 Apr 2018 08:03:47 -0700 (PDT) X-Google-Smtp-Source: AIpwx490JopwMRIVBU4FyykJx6i9WEc13MOZCqJXTyWjRpQGtZjvDmZqtyLfC0Bxbv02zJKcUBOx X-Received: by 2002:a17:902:284b:: with SMTP id e69-v6mr622035plb.240.1523804626958; Sun, 15 Apr 2018 08:03:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523804626; cv=none; d=google.com; s=arc-20160816; b=occDvFfSUhkBxzh96nK0SDqUv9NySv315wwQPKefYLgu5Ta8u9ugX7Wa6qYXlbXeej JpCdWjIi/wiApN2mGQa68ULbhrf1R/fmvtprzLIU40qwB7YUud16MkVUGDKm1tk2GLid A6V1X5u/2i+liXilgdVFH8s6BlIac/eFRWmoHVVL3b9ecVgphjc8xaeVg/xjxNlzMlrF NSjOBlrRaeS7QBApPerqu0k85lbt8oSvtsfZ4eeJC98e3SfyO3eF1DaH3iTU1IpEn+El byfZu1exyQlnShmYVTPNbx99AFOjG1gfkzzDz11/SxhslgHq5qlyJCMWnq0mbGJImoEd JFRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-id:spamdiagnosticmetadata:spamdiagnosticoutput :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=Vx3xrZZIpEOLGlwWTn1kqbv1PCdxz0fyvOXPzdkC8CY=; b=pmQCTATRdmzBpi6B35Sm2zQ/bUB+mrREnq2ATZ64cElkWvZx3AJPHkydHY6xUh2JZ+ Q2WnQypSfgDmz7e/4/oI1p0tGt8K6b2KIJN4CPfe0hetK0TKsrEwigxwt1jVyKWJBHTv knkJsZ3J+f2q4r0QS8MUfuPBjkHLPm689Ab+Ytw67b0/gj5PGd545WKSgJKdUU+lipHd VW4OPYBkzHJGaf1dFMYu5ryZzWhn728KEPhZsyDh0qZFr1UuBAj+RPxwwyvfcO+XuZpd r+mbXui/f7HKRqtCcBqmgh9QiWMKIw5QGEWXojD9lR+uGRl7vybFI2MRpMr6IfzjF5ss HUpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=SwkWe7LT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t16si7803338pgu.82.2018.04.15.08.03.18; Sun, 15 Apr 2018 08:03:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=SwkWe7LT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753105AbeDOPBw (ORCPT + 99 others); Sun, 15 Apr 2018 11:01:52 -0400 Received: from mail-cys01nam02on0100.outbound.protection.outlook.com ([104.47.37.100]:45280 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752557AbeDOPBs (ORCPT ); Sun, 15 Apr 2018 11:01:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Vx3xrZZIpEOLGlwWTn1kqbv1PCdxz0fyvOXPzdkC8CY=; b=SwkWe7LTHVoliU02tEaK5EzwAY4vhRXbb2ny3cDu4pCuXxqeyT04UYGv9Ll5RVsyXD3uFSxqxCUrc/hxP8f15P5ehkTx0MedGtqBicKwxdWtarxoHlo+667N0ffgo3Uhk+edBg+7XYcwkwsXMsq0LNfOIOGH02NYNEgabRxDcP0= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1015.namprd21.prod.outlook.com (52.132.133.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Sun, 15 Apr 2018 15:01:46 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0715.004; Sun, 15 Apr 2018 15:01:46 +0000 From: Sasha Levin To: Chenbo Feng CC: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "David S . Miller" Subject: Re: [PATCH AUTOSEL for 4.4 065/162] tcp: Add a tcp_filter hook before handle ack packet Thread-Topic: [PATCH AUTOSEL for 4.4 065/162] tcp: Add a tcp_filter hook before handle ack packet Thread-Index: AQHTz5muPOAMHA8h+kOm3imPN1eGhKP4ufsAgAk8I4A= Date: Sun, 15 Apr 2018 15:01:43 +0000 Message-ID: <20180415150141.GS2341@sasha-vm> References: <20180409002738.163941-1-alexander.levin@microsoft.com> <20180409002738.163941-65-alexander.levin@microsoft.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1015;7:7kooey025m70dgy8lsLyb8KJ4Tg+Y3ODADZtR/IH9dz8+aMRlnqTUnjJcx5tPNelHsKfxqN2seInjp6QsI6bDycfFfl+11J7VZfeltylrIXhZD+AWVy7crkzKqQtmuxmfLcYdcfR5VkEDM4esWhckZYvdQKN0hhaVu5orQ19qv/Osty5uFrhNhbdQL9/SBbRmSONZCWBOgFrA5TGpu6CrM2gkJSSDO4LUIYq1xOcOFyeNkgF8XFsY1rTiTriZVQ4;20:fdm66Hw73yTcfOo0BtP8tY8U5E+Wg+RcgwIYxk3zcNZcYfNoJa010pp9pa+tIPHUPuq1J84ynAIkSS5azv0n7X9XFKBUzTgVhnBouomx9FJ8kJRV+XKGXu05Y3QMXeiRJknzHNpxT1pkIWom8hk38CdI6FpLPmHBZRTrmqvl1O0= x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1015; x-ms-traffictypediagnostic: DM5PR2101MB1015: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(211936372134217)(153496737603132)(17755550239193); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231232)(944501347)(52105095)(10201501046)(3002001)(6055026)(61426038)(61427038)(6041310)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:DM5PR2101MB1015;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1015; x-forefront-prvs: 0643BDA83C x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(7916004)(366004)(396003)(376002)(39860400002)(346002)(39380400002)(199004)(189003)(76176011)(59450400001)(10290500003)(446003)(25786009)(8936002)(6486002)(33896004)(575784001)(26005)(305945005)(86362001)(3280700002)(3660700001)(186003)(478600001)(14454004)(72206003)(2906002)(5660300001)(6246003)(99286004)(33656002)(54906003)(102836004)(53936002)(7736002)(2900100001)(6506007)(105586002)(229853002)(10090500001)(1076002)(9686003)(6512007)(3846002)(6116002)(81166006)(81156014)(22452003)(4326008)(5250100002)(476003)(8676002)(6436002)(6916009)(86612001)(68736007)(97736004)(33716001)(66066001)(6666003)(11346002)(106356001)(316002)(486006)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1015;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: HycyPSudbgSsSV248reFiAhvjUxyHNm0p9ai/4h1c4T2dm/FeoFdPSpjj5Ig5Iq6karRCY+P6gKeK6iOshtg/DI5//BunYzd0HlnO/kYfELTXcRJ3gwpsNhlg3OVeI7uq3dZ3UO0UvvcDZ3ebTF5dAojLnXOrb6nXE9ikDGKtSby4klv73QE+Ce07qAjUdkN spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-ID: <45A1F765E1F7C3449053F95647BCE45B@namprd21.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 07e9e247-5644-4dbd-f08f-08d5a2e1ced3 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 07e9e247-5644-4dbd-f08f-08d5a2e1ced3 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Apr 2018 15:01:43.1056 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1015 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 09, 2018 at 11:00:06AM -0700, Chenbo Feng wrote: >On Sun, Apr 8, 2018 at 5:28 PM, Sasha Levin > wrote: >> From: Chenbo Feng >> >> [ Upstream commit 8fac365f63c866a00015fa13932d8ffc584518b8 ] >> >> Currently in both ipv4 and ipv6 code path, the ack packet received when >> sk at TCP_NEW_SYN_RECV state is not filtered by socket filter or cgroup >> filter since it is handled from tcp_child_process and never reaches the >> tcp_filter inside tcp_v4_rcv or tcp_v6_rcv. Adding a tcp_filter hooks >> here can make sure all the ingress tcp packet can be correctly filtered. >> >> Signed-off-by: Chenbo Feng >> Signed-off-by: David S. Miller >> Signed-off-by: Sasha Levin >> --- >> net/ipv4/tcp_ipv4.c | 2 ++ >> net/ipv6/tcp_ipv6.c | 2 ++ >> 2 files changed, 4 insertions(+) >> >> diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c >> index 61c93a93f228..2eb9a1747f25 100644 >> --- a/net/ipv4/tcp_ipv4.c >> +++ b/net/ipv4/tcp_ipv4.c >> @@ -1639,6 +1639,8 @@ process: >> } >> if (nsk =3D=3D sk) { >> reqsk_put(req); >> + } else if (tcp_filter(sk, skb)) { >> + goto discard_and_relse; >> } else if (tcp_child_process(sk, nsk, skb)) { >> tcp_v4_send_reset(nsk, skb); >> goto discard_and_relse; >> diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c >> index 74cbcc4b399c..7d7f0999a919 100644 >> --- a/net/ipv6/tcp_ipv6.c >> +++ b/net/ipv6/tcp_ipv6.c >> @@ -1428,6 +1428,8 @@ process: >> if (nsk =3D=3D sk) { >> reqsk_put(req); >> tcp_v6_restore_cb(skb); >> + } else if (tcp_filter(sk, skb)) { >> + goto discard_and_relse; >> } else if (tcp_child_process(sk, nsk, skb)) { >> tcp_v6_send_reset(nsk, skb); >> goto discard_and_relse; >> -- >> 2.15.1 >There is a bug fix for this patch upstream: >"d624d276d1ddacbcb12ad96832ce0c7b82cd25db tcp: fix possible deadlock >in TCP stack vs BPF filter", Please make you include that as well if >you want to add this patch to stable. That commit had quite a few conflicts, so I dropped this commit instead. Thanks!=