Received: by 10.192.165.148 with SMTP id m20csp721407imm; Wed, 25 Apr 2018 06:44:40 -0700 (PDT) X-Google-Smtp-Source: AIpwx49s/qC6Ea0umWwxpmKzjP9UngXT2LRhWQMcjh59oo1x//fWqxAAGEKtT9OGrqP7wfYRWYW9 X-Received: by 10.98.103.154 with SMTP id t26mr28382088pfj.24.1524663880472; Wed, 25 Apr 2018 06:44:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524663880; cv=none; d=google.com; s=arc-20160816; b=Pd2V+4K6X9dKbr2bIrWLc6CJgBbAzuBVmGc4wRkCM1OB6EWRKzzk9fcacSD6KlDcnb 0jy4ut521insZS5LisNBzh4fomiZ2/iZulR2o5LTAmYysxsJwE0skJcVs8w2hzdxJCym CweKXENwijjeTAh5j5czAKND5nWO3hM5/iG0HFkt5MCAOcCdwa+kOSEY0p04yBBa3omZ ZNkCG+TgCiTByQObYyBJU2LXqmJjMDI+PUJEyccMrDB4f8LUip3K2mZEFsEUn4UfZirq yOS2Ma2wUtPv2G7cE9tBcg06A8F/+QlgPM9190YIG4V+eEzeAQVMuEU2shcbKDO8DmH6 ktig== 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:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=PcO5y2I7UOLdwVWWoWMldwaWGe6ZM3QZu5glR0xHR4w=; b=zr8KOkpWs42VkWdKsb60BEa0NbRcwsWPeARKPD0rsOux+a2Lhs7TzEgyvzTbYdWDgi HWXNC3/Zuv8RrNJfgvr3QOdgxKtb2C7VabByGQjdOvQgTJKpdLoAPN5nQZ/5tSiUP57e hAu6cs4X6c37N+e6PmWMejYrPtTLGqvbQxWJcwK5Uf/8Ssa4rNw+DiTgafZr/V9D2bTR 9HdsH62IB2dcq6tDk3UDoFNe2F4GwQRFVMN6GucK+LMn3uCZ1mkm8ZNVcu4Ou8+ub+KK zsceZFb3LKpr6DKkMuWRK9v3d1Krb/pDmSym9h1eS2Sl5p5RpAZYKYNnBLHqfwTRZsTv GHfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IeSFpoHj; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d14si14417707pfl.122.2018.04.25.06.44.25; Wed, 25 Apr 2018 06:44:40 -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=@gmail.com header.s=20161025 header.b=IeSFpoHj; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754436AbeDYNmv (ORCPT + 99 others); Wed, 25 Apr 2018 09:42:51 -0400 Received: from mail-pf0-f173.google.com ([209.85.192.173]:39683 "EHLO mail-pf0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754390AbeDYNmr (ORCPT ); Wed, 25 Apr 2018 09:42:47 -0400 Received: by mail-pf0-f173.google.com with SMTP id z9so15269285pfe.6; Wed, 25 Apr 2018 06:42:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=PcO5y2I7UOLdwVWWoWMldwaWGe6ZM3QZu5glR0xHR4w=; b=IeSFpoHj8zO2dXLAJDUwbT2wWpBzSFLBvgFfrm5zTNTrRdzKLej9OWGk+AlSGtqsuE XnTdtMF4AxJJW4T+5Wc+jwZuPboSjY0+MWrHbu1rE8JoliJWmR/PtSvIo5FR0wC75MoZ t3UuxuH420Bdq53Rq39cIdM0ZHwcoYKeB7NLk/jrXnnPlzEa3b/t25NCtKzeBQ8rNzU0 gULQsVIHv9cllX6sHcenJxhH3j3TDuO0iGvhCPzlnMN3Nr3jxV7Shsis+ywCVh9Y7IFs xlKalQeJVsVeMCe+lBONkyGaW/rNzicBnuHUXs/+dEUdgOu11/S1X+BRPSGlT/s+1Ec9 1/Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=PcO5y2I7UOLdwVWWoWMldwaWGe6ZM3QZu5glR0xHR4w=; b=CQ5CfYn9WDYUhkojWyojarVxM0PWLQ9ypKbui46Hl94fGhy1UTG4ebK8Bb29mIH8zT bQQbwDYyyRcDQfLOsnrOAAMTyJXXoid0uMcNBS4V+p1FYX7DB93627QuDzzGA0BFao2k /utR6ZZDwd2cPnX1W3zo7/3yMVF11HB3/0uSGpE48FSWtR8HJXw9m0zl9+u/V5MsZVCy XPMvJL21iCmfEy4dSOg1px4++7lr1jJ4u52Kf5rLbNpcdSEe0ibQztrZGIKfmmGWBmOv S+d9z1Kepi9NqmBZvGnKWO6+9bdELmr659p2QIJlmjDRkI1H8UxcdU+SxC0pzLoTj59u yMRg== X-Gm-Message-State: ALQs6tC8gqZxC8LdaGRucEBPZ9/CLsLikIrPn2ZWi7pLElI5XEgWQ+Vy a6y13SvtV2T0pBKNWzrklwM= X-Received: by 2002:a17:902:8606:: with SMTP id f6-v6mr29305629plo.258.1524663766551; Wed, 25 Apr 2018 06:42:46 -0700 (PDT) Received: from [192.168.86.235] (c-67-180-167-114.hsd1.ca.comcast.net. [67.180.167.114]) by smtp.gmail.com with ESMTPSA id 76sm6210719pfm.178.2018.04.25.06.42.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Apr 2018 06:42:45 -0700 (PDT) Subject: Re: [PATCH 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 , Soheil Hassas Yeganeh , Eric Dumazet References: <20180425052722.73022-1-edumazet@google.com> <20180425052722.73022-2-edumazet@google.com> From: Eric Dumazet Message-ID: <111ba92b-ea48-93a8-a86c-0c7ca54eabaa@gmail.com> Date: Wed, 25 Apr 2018 06:42:43 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180425052722.73022-2-edumazet@google.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/24/2018 10:27 PM, 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. > + ... > + down_read(¤t->mm->mmap_sem); > + > + ret = -EINVAL; > + vma = find_vma(current->mm, address); > + if (!vma || vma->vm_start > address || vma->vm_ops != &tcp_vm_ops) > goto out; > - } > + zc->length = min_t(unsigned long, zc->length, vma->vm_end - address); > + > tp = tcp_sk(sk); > seq = tp->copied_seq; > - /* Abort if urgent data is in the area */ > - if (unlikely(tp->urg_data)) { > - u32 urg_offset = tp->urg_seq - seq; > + zc->length = min_t(u32, zc->length, tcp_inq(sk)); > > I might have to make sure zc->length is page aligned before calling zap_page_range() ? zc->length &= ~(PAGE_SIZE - 1); + zap_page_range(vma, address, zc->length);