Received: by 10.192.165.148 with SMTP id m20csp2143257imm; Thu, 26 Apr 2018 06:41:59 -0700 (PDT) X-Google-Smtp-Source: AIpwx48q5JS+gJJ8c8/oHT6lhq0k+qHlcW3nREyD4QRgsnc5tgZKasqpLodXfHecKBHxSEHG25N0 X-Received: by 2002:a17:902:2805:: with SMTP id e5-v6mr32528990plb.55.1524750119589; Thu, 26 Apr 2018 06:41:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524750119; cv=none; d=google.com; s=arc-20160816; b=d63GReMnDCxbhwENWjw81r3MtwfK9v7rfO+Ut2Be+kb98JjSGeN6JvsYZpapwFh+J8 2p5rP6VduRy38QnfqvwszDvHhcA/9A1dWSJd8xvlo9uLL1rbtTb1Lx+iRTypVXI4gqHk eA+l313XYlFYIRtymQ2MPsmoDfCN0swgfxN2IUOu3qqBnYNMi0wbmUVvdVWgLmR8bQP0 wO8m0rE7uVwF5G7NupW5ri350DTd/a4LmMefHZSblOSt7fIra48pcIettnMGqSdyYHlO ZeuxpqFnNYTJMF6nfPhF8krKFaW6m85T01NI3gx1gZ2AS5HUP1/WJa9bdprrnmb7SJIf /DAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject :dkim-signature:arc-authentication-results; bh=1gPPCOZSS5Rh+S3ia0lW+Sjgqi1l08LhexfM8fXEjqI=; b=Y/B+Sp9R/lSfDZpwsJzWNte8xGGLN+2M7olDJa+1DuzTQwK4y12oDI0WDtjeQxXYLD l45mtsLCgSRcNQ0RbUQKq2gfn5fewSBVi5D/zZrug3pnKHeTZop0GJ/AN/Cg6C1QZDrp Yhn1eoLX84nrTKjlfh9lIcO5R+9KXoFZS/9ZNxEfYrPNwSkRuifNFG+eJnvL70/3NwvU vNWvHauR+M0cp5bO4mlKdkoxBParonjrb0UK5wPMvAcozl3ssI/evHlqLWECSgPuwq02 SdnPrGCtNG+c4KwNvMFWtEEUw41ZqFeKmaOBDQaZ9AHNeEkcyO6n6zRTnDbT+7CXnnTo ZYYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=rideSMno; 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=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k62si11470895pgc.170.2018.04.26.06.41.44; Thu, 26 Apr 2018 06:41:59 -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=@oracle.com header.s=corp-2017-10-26 header.b=rideSMno; 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=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755928AbeDZNkf (ORCPT + 99 others); Thu, 26 Apr 2018 09:40:35 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:45964 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751713AbeDZNkd (ORCPT ); Thu, 26 Apr 2018 09:40:33 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w3QDa4il001946; Thu, 26 Apr 2018 13:40:25 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2017-10-26; bh=1gPPCOZSS5Rh+S3ia0lW+Sjgqi1l08LhexfM8fXEjqI=; b=rideSMnoiOiztLz4JuZ3Ns58OjH7QQC8M0kbwHpaThaQvqOispbiurke1vvH2yHg1PvC H+716qZyCr47wKmBTUqdVoGeYZySxo9kPNfSasrmaVwzlvk6JnwAXcrTM3Br3QCTjuIn f64TVfypeEe00ADlMiX3y/5JUoQydJ1BYx9osJXI4kxsKEq/NxsXLU8IpkfqX8Ng8m2y uIFn2HkTl0CojWgK2TxmS1/Z7D82IXJSf/X6acI+b+AGCmmIKiraqRT0JNeZ01c+Pxi9 Yypvptp9gKxmtrePvo6ioebIFkVhPlmqg0pZ+/I0sXGLqyFO3LrqqnUkpwSZa5044UYT Ng== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2120.oracle.com with ESMTP id 2hfwy9u8b2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 26 Apr 2018 13:40:25 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w3QDeOPp031047 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 26 Apr 2018 13:40:24 GMT Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w3QDeOV6019587; Thu, 26 Apr 2018 13:40:24 GMT Received: from [10.159.211.29] (/10.159.211.29) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 26 Apr 2018 06:40:24 -0700 Subject: Re: [PATCH v2 net-next 1/2] tcp: add TCP_ZEROCOPY_RECEIVE support for zerocopy receive To: Eric Dumazet , "David S . Miller" Cc: netdev , Andy Lutomirski , linux-kernel , linux-mm , Eric Dumazet , Soheil Hassas Yeganeh References: <20180425214307.159264-1-edumazet@google.com> <20180425214307.159264-2-edumazet@google.com> From: Ka-Cheong Poon Organization: Oracle Corporation Message-ID: Date: Thu, 26 Apr 2018 21:40:14 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180425214307.159264-2-edumazet@google.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8874 signatures=668698 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=813 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1804260130 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/26/2018 05:43 AM, Eric Dumazet wrote: > When adding tcp mmap() implementation, I forgot that socket lock > had to be taken before current->mm->mmap_sem. syzbot eventually caught > the bug. > > Since we can not lock the socket in tcp mmap() handler we have to > split the operation in two phases. > > 1) mmap() on a tcp socket simply reserves VMA space, and nothing else. > This operation does not involve any TCP locking. > > 2) setsockopt(fd, IPPROTO_TCP, TCP_ZEROCOPY_RECEIVE, ...) implements > the transfert of pages from skbs to one VMA. > This operation only uses down_read(¤t->mm->mmap_sem) after > holding TCP lock, thus solving the lockdep issue. A quick question. Is it a normal practice to return a result in setsockopt() given that the optval parameter is supposed to be a const void *? -- K. Poon ka-cheong.poon@oracle.com