Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp618026img; Mon, 18 Mar 2019 10:21:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqzKooQ3oyAIeTnXmsYAjCf3RZKqLhQtL2XA52YN0cpH6CSY3gdjIijusz3fnP4XcQMem2HD X-Received: by 2002:a62:415d:: with SMTP id o90mr14552068pfa.236.1552929697682; Mon, 18 Mar 2019 10:21:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552929697; cv=none; d=google.com; s=arc-20160816; b=P/95yVdqlgukoGeY/8qOyUvvQZ2TgNP8ElfOY5aQH8/9jKSxPbAbQVKsXB5JFAPLcN zXtc0mxMD7S6ZSsP2uMpURZgg0foiS2wb+gNLnIRunmbN1bsiq+0ILhbgEvQs8pRj7sT 0w6SCu2qGAO6QMQMAjac95jHWtZiHF+WknZuI02A0E5ck3Z5MOUOmUXu9GTnQPRJQhZF 3xm/WfSrhlhBReW9xEyojgJFrkrWoZ2cBzzf2V4A9gUgIfIchw/u3h/rhDCCiMGI22yU SIEG08TD2yd57FjXFMiwR8YDetfsPoyxh4EAzOUDSXL4lUgIGQlWVyaAWD0Rkl/Hl9QM VpwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=nIZeb0pZ+Rs1twP/26IxdjvHz5r8ncIzXCkOe4U4COg=; b=cLMtdQ/rUoQTV+gDjPThzo8O4+lFWoveq1/k7bTLMQ7FXx78e1ZXNI5IavjVa29U2u NsXKuGVP2GYFB3eIyIhqy+9XjJFwuKvRFNjDYjGDHM2BQ7QKarhY77ZY9QbdDUtUYlqx EB0d7rFTRsJPYsiqHqKHWzrQgwydlbBLYqV/EhfncNgndld4g/ZagS6P/Dm+K7J06g+k yxE+yTAL/2ZKvUvOTKjaCINTYjdC9UXTpdei1On/8fqjn5MC86N4XaqRtxh73PokWvGU QgK4odXIl1ZyjpciYdxf3qR5sqe+yjEyyWt9MdAWZFuqCDnnXxKbdnyZOkNfXFhmPVeY 8K/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=EXAkqzYX; 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=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 31si9983362pld.6.2019.03.18.10.21.22; Mon, 18 Mar 2019 10:21:37 -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=@google.com header.s=20161025 header.b=EXAkqzYX; 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=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728104AbfCRRTG (ORCPT + 99 others); Mon, 18 Mar 2019 13:19:06 -0400 Received: from mail-qt1-f201.google.com ([209.85.160.201]:34294 "EHLO mail-qt1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727953AbfCRRSO (ORCPT ); Mon, 18 Mar 2019 13:18:14 -0400 Received: by mail-qt1-f201.google.com with SMTP id x58so512153qtc.1 for ; Mon, 18 Mar 2019 10:18:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=nIZeb0pZ+Rs1twP/26IxdjvHz5r8ncIzXCkOe4U4COg=; b=EXAkqzYXquwoZW9zPquYoEc1VixgrJrxtJjurULtOsll9F/x8BSgkuYbNYqPNAK+sc QdGu01FYNxKrm1YnjhDssa3BGmNkam/8XvRG+67blmdUDkqpgD3yiL0tqlkzvcOHlEdD fz/vfMUJKMxApfo9M6ta6ANBN/hBFJ8sHT6IIlVMu94hJTj8vY7Ch6oVS78GY6mduhfg Mfa3G2yUPRZbMrYKuIq4vjmPLT9/Hrg9S0x5wCC0nEBvOOrzKzgwcqVZmA0wCyKJejEO fM02iW8f+3jGAOZtPgjTq3dSiMBluDfCCoyJ/neHAzTlpna8RAP9peqgVYpDqOfBkGtD dYvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=nIZeb0pZ+Rs1twP/26IxdjvHz5r8ncIzXCkOe4U4COg=; b=mBES11+XW5Zz+RYLk11vKLu1zmC9NG4KqgIFbmkkVrwPgwYvmZHLkHvyKSP5OXlQez y68fgFkNTf84duLYc0J1eC1OEpobpJo2ql5SCAHoDIEexzXtCyxzxZP2SpR0QddMAJZD kS+T0yIdyQCXsrDvVd8WLpr4Lchubmu7+y3Ea2mQq1miE+AogDzmJfWVlfLWgkT1UpzX axiI9eIQxTJkLr5IMOxMs1x2QQCrK28ofXgr8LNRhDB+67A27igiUAkS0F50XkKaZ3P4 VzsQgjOBTu4CMajU6HbjTby7LPJ8l8X7X1CQdZ7FzHjiW6dvyjYRC5fXbEaa/MRPnOAN KOmg== X-Gm-Message-State: APjAAAXSmG7QVijwMhqt4YGPF6tfAzB8XGPUvnQMygHrE7RMB8KCcyVA vwa68TouoZOLtyLTcJj5kGAbBla3Jt8xk6n1 X-Received: by 2002:ac8:38b7:: with SMTP id f52mr10498903qtc.7.1552929493810; Mon, 18 Mar 2019 10:18:13 -0700 (PDT) Date: Mon, 18 Mar 2019 18:17:40 +0100 In-Reply-To: Message-Id: <80e79c47dc7c5ee3572034a1d69bb724fbed2ecb.1552929301.git.andreyknvl@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.21.0.225.g810b269d1ac-goog Subject: [PATCH v12 08/13] net, arm64: untag user pointers in tcp_zerocopy_receive From: Andrey Konovalov To: Catalin Marinas , Will Deacon , Mark Rutland , Robin Murphy , Kees Cook , Kate Stewart , Greg Kroah-Hartman , Andrew Morton , Ingo Molnar , "Kirill A . Shutemov" , Shuah Khan , Vincenzo Frascino , Eric Dumazet , "David S. Miller" , Alexei Starovoitov , Daniel Borkmann , Steven Rostedt , Ingo Molnar , Peter Zijlstra , Arnaldo Carvalho de Melo , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Dmitry Vyukov , Kostya Serebryany , Evgeniy Stepanov , Lee Smith , Ramana Radhakrishnan , Jacob Bramley , Ruben Ayrapetyan , Chintan Pandya , Luc Van Oostenryck , Dave Martin , Kevin Brodsky , Szabolcs Nagy , Andrey Konovalov Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch is a part of a series that extends arm64 kernel ABI to allow to pass tagged user pointers (with the top byte set to something else other than 0x00) as syscall arguments. tcp_zerocopy_receive() uses provided user pointers for vma lookups, which can only by done with untagged pointers. Untag user pointers in this function. Signed-off-by: Andrey Konovalov --- net/ipv4/tcp.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 6baa6dc1b13b..e76beb5ff1ff 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -1749,7 +1749,7 @@ EXPORT_SYMBOL(tcp_mmap); static int tcp_zerocopy_receive(struct sock *sk, struct tcp_zerocopy_receive *zc) { - unsigned long address = (unsigned long)zc->address; + unsigned long address; const skb_frag_t *frags = NULL; u32 length = 0, seq, offset; struct vm_area_struct *vma; @@ -1758,7 +1758,12 @@ static int tcp_zerocopy_receive(struct sock *sk, int inq; int ret; - if (address & (PAGE_SIZE - 1) || address != zc->address) + address = (unsigned long)untagged_addr(zc->address); + + /* The second test in this if detects if the u64->unsigned long + * conversion had any truncated bits. + */ + if (address & (PAGE_SIZE - 1) || address != untagged_addr(zc->address)) return -EINVAL; if (sk->sk_state == TCP_LISTEN) -- 2.21.0.225.g810b269d1ac-goog