Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5202854imm; Tue, 21 Aug 2018 07:55:42 -0700 (PDT) X-Google-Smtp-Source: AA+uWPywSJWNPsMYM2X7Rf+sdUiRGfORxO6JizL7Bulj1q+S+EAH1LfTj92dHc7DavTvzi3yLNQy X-Received: by 2002:a62:234d:: with SMTP id j74-v6mr53070233pfj.106.1534863342030; Tue, 21 Aug 2018 07:55:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534863342; cv=none; d=google.com; s=arc-20160816; b=FrW2mOYiGS6jOIerUY0tTzryYJANiCTsS34mBWPhufYw5VMhYXGEQjWMDq8kJ+aQ+K dil7Pus3XjMKKqOcuGYCvD+xrHxOQ4M8d2Cka/SHFL1kNSaejOLGJn13sTjPck4gf+oV yIZYh0UJEDuX6CcPD84wv7ZjxoK8HpADbQwSWtMaZLhTpY6fjLL359dV0mewggnWmZ8R YHW3HC59xymeZHE0mPJU8onKfjPTmcvbx0sn2D+5qN6ddACDgbVPKnm5r4hTAZ4f5I1U N7kYsPV9VNnD4Jb4NIFxkzL60a5PgkfbBIb4PehFkXLg7BZghvT3EePUNYGx+2XloXt0 pCjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature:arc-authentication-results; bh=AbLM+E9uBjBmkmY7LluPRzefXtFH0UwLaYf0oD/4swA=; b=cAz7bdEOkJQYY3CxRCRpEjcefkGXnBDG10FOXyyaXG1eq5x0tap9FdALK1/E6ujDiW oGnGQLHk78QzoZ915/fn/Rml3TgmggXVSJWZqKKJ7Fy8oy89eln7kstUn+pdbAZ+qjMd ly94tA7H6g93ZwMV9BDW9qPsEFrFgdBnZACEZzMnb7zABzPFgIxKuSRql7HMflXIYIMK uROsZ22+H0mv5M/g3mmBs2LXjU+GL54xkC4m0yJwMxHpfssj3T1kH7H9CYlH2iscAjw+ EeypReO1V5XUDHk+JlxAh0HhufR4eHaxGQ0sdePCC+rdltDwUME2NN1sQiXH/v5FlMw9 xdAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=EyZKamCW; dkim=fail header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=FYIQRvjl; 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=NONE sp=NONE dis=NONE) header.from=fb.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t4-v6si13093565plb.498.2018.08.21.07.55.26; Tue, 21 Aug 2018 07:55:42 -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=@fb.com header.s=facebook header.b=EyZKamCW; dkim=fail header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=FYIQRvjl; 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=NONE sp=NONE dis=NONE) header.from=fb.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727613AbeHUSOO (ORCPT + 99 others); Tue, 21 Aug 2018 14:14:14 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:33062 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726590AbeHUSON (ORCPT ); Tue, 21 Aug 2018 14:14:13 -0400 Received: from pps.filterd (m0148461.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w7LEqoBb016656; Tue, 21 Aug 2018 07:53:38 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=facebook; bh=AbLM+E9uBjBmkmY7LluPRzefXtFH0UwLaYf0oD/4swA=; b=EyZKamCWPvgfv8meMSm2nkuuOEybfenai87b2oYc+mBHSdtTuhS3+BnFXgGDQMb+fHYK CrcHjmBDVc2fPrTseHLafl2YbFlFGUuI0LHTiuS469WVC+j5qZn7nAAEgMDh26DP0LG1 jdIBrxuwImY2PzKsspsM1v24gTqMiSD3P+E= Received: from maileast.thefacebook.com ([199.201.65.23]) by mx0a-00082601.pphosted.com with ESMTP id 2m0jqqgbds-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 21 Aug 2018 07:53:38 -0700 Received: from NAM03-BY2-obe.outbound.protection.outlook.com (192.168.183.28) by o365-in.thefacebook.com (192.168.177.28) with Microsoft SMTP Server (TLS) id 14.3.361.1; Tue, 21 Aug 2018 10:53:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.onmicrosoft.com; s=selector1-fb-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AbLM+E9uBjBmkmY7LluPRzefXtFH0UwLaYf0oD/4swA=; b=FYIQRvjlpTtDBNZ4oKRkOT1n4bPyP55+AlW5p2IwOrUWgPizBoye+FwpczC0aOBjjDMLpYUHxa0Kw7YSb1FPbZU20ylBiQWRSQModz7UxB1LZKCqPKIfd9mu6rX6mwhaahkuqJMcFce99+Ynf7PUE9ir1mMIHuJHoy+bb6xYTS0= Received: from doronrk-mbp (2620:10d:c090:180::1:f84e) by BY2PR15MB0471.namprd15.prod.outlook.com (2a01:111:e400:52da::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1059.19; Tue, 21 Aug 2018 14:53:32 +0000 Date: Tue, 21 Aug 2018 07:53:21 -0700 From: Doron Roberts-Kedes To: Dominique Martinet CC: Tom Herbert , Dave Watson , "David S. Miller" , , Subject: Re: [PATCH] strparser: remove any offset before parsing messages Message-ID: <20180821145321.GA44710@doronrk-mbp> References: <1533854411-28184-1-git-send-email-asmadeus@codewreck.org> <1534855906-22870-1-git-send-email-asmadeus@codewreck.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1534855906-22870-1-git-send-email-asmadeus@codewreck.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Originating-IP: [2620:10d:c090:180::1:f84e] X-ClientProxiedBy: MWHPR20CA0012.namprd20.prod.outlook.com (2603:10b6:300:13d::22) To BY2PR15MB0471.namprd15.prod.outlook.com (2a01:111:e400:52da::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f22e07a1-0ad6-4e65-457d-08d60775de4d X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:BY2PR15MB0471; X-Microsoft-Exchange-Diagnostics: 1;BY2PR15MB0471;3:M+rdx1ohdJ3n8jjGHeo5zCFmrBe3inLf56L2gSySt+AqfHMwQQWQ//EmELofVNadxglyBz/vmtlnPXxcEI07Pqc/CfItKKWJzrw/Dr1NCD68gOnnlthrfd4OM1EF4grrzMDOq7GVJVAlnceubT0MZT+8O5Uy3FcMR517VVIOeX6gDz0fN+kLmSMRGQ281Yf5WukrgDZCFZJFy8lDlDSoQU1j5vbkNl1JIhS1qJgm3nnvryPdYRI83uaK/RVbloLU;25:dBXAp8Fg3kv2XYSakwY0F0LRlbYpgHi4JSFvgyxFM/7S4aAQS8z5mTz2S7o4Q3iwF3Fm6QDn+fMfV+8qs4dezY8SfbauFhmzKAxA2niTDVEaEFev/k70CgBcMdQJSLIhslYoZukkhnQC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07RuhZaM8p1gXKE+Z/3rOqQ8nQydOErHZETu25x7CR9PXtknde8I5kBt8mNkmpVNYEw4P3ral/IxbpNrxncfDmLdHk2yVepJpb7Z9xOYtonbGOrcqskjs6eEPwD8SiGptMBbMIaHrGid9f9wqga7iNcUei8cHqog5Wxa+OFYmK9A2ZuE64N7GXe92kWdTMfKio8yA1Fs9MAlJc0tAgWp1tBvC+g== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(3231311)(11241501184)(944501410)(52105095)(149027)(150027)(6041310)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(201708071742011)(7699016);SRVR:BY2PR15MB0471;BCL:0;PCL:0;RULEID:;SRVR:BY2PR15MB0471; X-Forefront-PRVS: 0771670921 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(346002)(39860400002)(136003)(366004)(376002)(396003)(189003)(199004)(6916009)(386003)(81156014)(97736004)(6116002)(8676002)(68736007)(53936002)(23726003)(33656002)(8936002)(46003)(2906002)(86362001)(5660300001)(106356001)(6666003)(105586002)(478600001)(1076002)(81166006)(54906003)(50466002)(316002)(58126008)(16586007)(25786009)(305945005)(486006)(52116002)(6246003)(446003)(476003)(76176011)(52396003)(55016002)(6496006)(47776003)(16526019)(11346002)(33716001)(9686003)(4326008)(33896004)(7736002)(229853002)(186003)(15650500001)(18370500001);DIR:OUT;SFP:1102;SCL:1;SRVR:BY2PR15MB0471;H:doronrk-mbp;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: fb.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BY2PR15MB0471;23:Vgnl+Uj9M5cDSryDKGH8dsSYOCYoui+3gUEwMdS7d?= =?us-ascii?Q?tzux96moPpQRTUxi7qHewHKz5z2G9ix5ogwkXL51yoXdTojhr5hy+9NtJGWB?= =?us-ascii?Q?hw9MBMXKnXCmSHOkt6xetk48MRMpYXzYPodkfXhO7pdNfsv1y382/NMijzix?= =?us-ascii?Q?VLa8k8KbzZdDxOThRWd6zmkqSs8a6BwW7CkEnSaW+CQUcY5q0BD05falwECS?= =?us-ascii?Q?mHTez5+ER7N3Ljlj2Y16A33nUrAJrQJwDU585xlbW4Ey0ZX5ZQL0DORsWTGk?= =?us-ascii?Q?ar4j6LstSVf/mf76ycuJRjECEizlFuGpXZjfc2kuPPq9pU+pU0uZVxife9Vw?= =?us-ascii?Q?gM7atshKqTp4kDPIbEi7b1uJeX+IkarhtvKzkRXFymn4xGCA78xvZDIHIQ4v?= =?us-ascii?Q?q7yH/WCvgEzsPm8IBS0lR0NOZJv+iyQRitK1h/c/gFByA5l2wC49jXhgB9k9?= =?us-ascii?Q?bqrmsDq+j6o9rCH0ediNDWp1QZaQKWzbxgCNFf7P12REcbLpCGE/4q5euIeP?= =?us-ascii?Q?2WvP558zYa9SNcuXW1XKcNP6SX8F8Ot7dZpvSFg1ktczv7EPdA4635CiG1FJ?= =?us-ascii?Q?FRhYpDxO48yknUS0nAyUjkwS3INkFA3Ffdei6ENnEO6fxYerxGCRDd38UUWe?= =?us-ascii?Q?5EEj3nVDQB1Ti+WM999v4KpTYhQy0aY3ItK/wcgJikmq0pCqcL3NRks0+jsQ?= =?us-ascii?Q?kiqnPSo/+Ac6/d6AFxYiGOk5HLt7aktaIvYijvwnIZkRjKsQfNMXvcyZq/rV?= =?us-ascii?Q?pfS7n66axydFsBNIzdPRIxiUX3VHtmozaBdYoNUymj37vb7KfTievcjqVTvb?= =?us-ascii?Q?4lB6vi04pNbXHXvFXs0yhzyGfCgqzBvLf97g2+DdiC39ipoSuQrQ+Vq5UDSQ?= =?us-ascii?Q?twRi1+41F0QPkbh191Kr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o/uG1crarh2eKkxkIyUpAC+ozmlPu/tRuV3J2AYqJbDASGEFZ6YxBt5OazCwff0u6yfcDGtns7t5BYs70hAi7tt/OlRCzcIaBHyz7XeVNJ/DFooRzsDBjejg1MYdV7A63xCFdeXR1QPRe0SQJg9gFbt6ZNtWuY89/6IW2vjCu8JAuRXCZNQH3gygvgWba7WoktiCaggxRP7nnlZ/2l04emxo5Wj18cqEVWGz7v2D3lKHsJJJvaou3ayRb5D8l5HXAJxeOhShvWVmH3iKm9prg==;5:LLjQAlx9AbamG/KyvcFf3sOIDjjg0439G3N5B70G7j+9pvD6SiRJT9q6KZnX6Zk1tjv6SzGrINstTONn7vOw+95kQHbz55UjpKtNP+Yu2rg3tQ0RNEg5Megiieg4A2rXExARVQT1rGg7f1vzlkfjogclParFCDSXme4Mym7JGdk=;7:dsoZP31HNE4/rUlOy2Uidvl1Koct/88MsJupWIC45BQOCjuYL7+MrkrrLaeTrbgnrDtdCSwJ/rA8zRPEvFi2X2rQ7owQ6LYL7SiWeHsQxsrIuP5JZx0P2oGA59lK++KBsZcqMblfqAvMo6kqPMJcZL9hH4SvujXi9ih60YoiB8sH8cf4PPgS8sHCbdeEAZyOJ+xxb5jouj/dv34JAdPlGt66R4Qp41vMYKviXITNUlam40cnCGbWDPGoGBTA2z5l SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BY2PR15MB0471;20:IJb2umAaGYQbRfNnZuV+3FfipKt/PoOwx5f/lI41oTTDWW/2g1qQMDX2+JSOlrG0ll8NcIB91B6S9z+GLzbhyoAXynaUugT9vBsY5iYQeL15tp8eH5p8jW/WEY60la33WL2MNsoh7VHPYGcvmZiJndEoR9inZsJ7ybxanYTPwM0= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2018 14:53:32.4293 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f22e07a1-0ad6-4e65-457d-08d60775de4d X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR15MB0471 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-08-21_08:,, signatures=0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 21, 2018 at 02:51:46PM +0200, Dominique Martinet wrote: > Offset is not well handled by strparser users right now. > > Out of the current strparser users, we have: > - tls, that handles offset properly in parse and rcv callbacks > - kcm, that handles offset in rcv but not in parse > - bpf sockmap, that does not seem to handle offset anywhere > > Calling pskb_pull() on new skb ensures that the offset will be 0 > everywhere in practice, and in particular for the parse function, > unless the user modifies it themselves like tls does. > > This fixes a bug which can be exhibited by implementing a simple kcm > parser that looks for the packet size in the first word of the packet, > and sending two such packets in a single write() call on the other side: > the second message will be cut at the length of the first message. > Since this is a stream protocol, all the following messages will also > be corrupt since it will start looking for the next offset at a wrong > position. > > Signed-off-by: Dominique Martinet > --- There are a few issues with this patch. First, it seems like you're trying to fix bugs in users of strparser by changing an implementation detail of strparser. Second, this implementation change can add malloc's and copies where there were none before. If strparser users do not handle non-zero offset properly, then that doesn't motivate changing the implementation of strparser to copy around data to accomodate those buggy users. Why not submit a patch that handles offset properly in the code you pointed out?