Received: by 2002:ac0:a874:0:0:0:0:0 with SMTP id c49csp734312ima; Fri, 15 Mar 2019 12:55:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqzQFkSvXQ11r55Nh5Ba1LlorZGAcRiIBvZpHzmWVHMnHp5ZurSvf94HlNL0MYhNaEDORI1E X-Received: by 2002:a62:ed08:: with SMTP id u8mr5830358pfh.200.1552679743240; Fri, 15 Mar 2019 12:55:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552679743; cv=none; d=google.com; s=arc-20160816; b=BQojVnW5dll4ySPLmv58LGQVUyn7dj/Mqj3hyI8STTnLNtEpk1kYupRC+BZnYpD9I5 ftmO/Wqr4Hklk5c3z6iLkJWzgSpMacwdWakiwKk+YiQkOAtvHHpgL8I2kSlpPA3VJgpl epScx0G3MYOCDLRDBJjjy+WRS4h5D1bbfgF19dW1pii6SoZMAX626VZ6+vEMYlnuNYOr vOQOegtOwDwaWL2MlnjxWKGfNKYoXU5KRyZv9ov8HSKHC1RdISNIpO9GpRhSOe6Gdby7 6gze+XLNV8Hiax2umQp3neiI06+LhehxxrO/ixNQ+cIRwco61SSeTc28EdGQ/uFfRkCW VZuA== 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=qCZblj86ukutCUgaNEezPPnSo6jFx7c0S/27D3+g5SQ=; b=sqk05KV/Zz2aFCXklGdR+6aI5oxJMjXlEIRkR8jXJ7/4EVV8rg57lWx8btbSwjzXq5 /8QJdvjuImeE6mFXVtE+6X70ztMdm3MH07/BtbPQECgOAZFf6wVPj0fQ/limSeB+54gE K5Ukb0cEsM/aTxVsSxPQS5o92sN0hNZA9hAyYwg37FtQDr4dg+9Yjq6La5VihMq9227g QJZBpB0BDA2ZFTk97dzJIjeYYNW6lgvuXNdYxKD5aSABMifuvvpFGCEJvzv+8zc/4Ybu bjIHaHFts2lEpGO+jWCGYFvCV2b/3lDAgNorhlBUcblDqkA4nhNHZAv0ZymKN3xeVCl4 IhjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=RV+qphgR; 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 k17si1300588pfa.181.2019.03.15.12.55.28; Fri, 15 Mar 2019 12:55:43 -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=RV+qphgR; 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 S1727684AbfCOTxM (ORCPT + 99 others); Fri, 15 Mar 2019 15:53:12 -0400 Received: from mail-it1-f201.google.com ([209.85.166.201]:39436 "EHLO mail-it1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727472AbfCOTwN (ORCPT ); Fri, 15 Mar 2019 15:52:13 -0400 Received: by mail-it1-f201.google.com with SMTP id h3so8722142itb.4 for ; Fri, 15 Mar 2019 12:52:13 -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=qCZblj86ukutCUgaNEezPPnSo6jFx7c0S/27D3+g5SQ=; b=RV+qphgRwIM0BlYxCZg0JlfEjDx5G2b5L8ZyFpBg6xhggSYfsl1Fqr2nkYw/1uo2gs 3X2mnJn0InykZb95Oc3LklEnd5abQO0mxyfCWv4ktefYvvvkA3igSCrt3kfSvFnDcJd2 yiTPCyZxoNT8Y3VZrTwxne1jWphT3yMFgfIrreIXZfWc85uza+QqmGRI+KRoFp3SruIJ AoO+ZWZNEwD/TFL+4c5NovYe7UTZj9KfYqP4IK256g8ihlekEEHLF6pJB9120lvwCNGI YKyN4okwCGSEeBvRd5Hm2UUrZHroN4fPZmCKFLzy7try938Sv18vPjuWwinYuq9JIjNh YyTA== 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=qCZblj86ukutCUgaNEezPPnSo6jFx7c0S/27D3+g5SQ=; b=qtZ+PKVQHgmneTmGpQu95Z0iNfF5RB1q6yGEEYbsIv8/3B93t6ngAe9ceo/JU0PuBw 22ixwctmHW8BMKfrBX/Lq6/ldOs6Vhi2qwnHieO3a5gwt0d+pbhDq7FJDY2NinWSLugi MzOXVIQ7QYOZGYa1DhE92Xy/EGCAcHsfrigLytPNmAK/GlcENccbKrtxoph9RlCP27nj R42+6j22HLrAYZsBvHswQkXCSGSnhrtSFJsQ7C1wP/JD3/gGI/IKXvTrqmeJh5gJoHxh x2rOni3XszPhUTVpnOAlHnzgoq8a+sK59dqs9XRx55bbkpyRPhKv2EM06VHrZTcAHaz7 n9JA== X-Gm-Message-State: APjAAAWpnVE0xs08okDONgQapS+gq3eO9SGnirT8Bc/No+95VBtuxWgA B2w1sRfmsEm6SqT3mI7FQGAqTCxKvvdN10Sy X-Received: by 2002:a24:508e:: with SMTP id m136mr2945070itb.34.1552679532548; Fri, 15 Mar 2019 12:52:12 -0700 (PDT) Date: Fri, 15 Mar 2019 20:51:33 +0100 In-Reply-To: Message-Id: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.21.0.360.g471c308f928-goog Subject: [PATCH v11 09/14] kernel, arm64: untag user pointers in prctl_set_mm* 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. prctl_set_mm() and prctl_set_mm_map() use provided user pointers for vma lookups, which can only by done with untagged pointers. Untag user pointers in these functions. Signed-off-by: Andrey Konovalov --- kernel/sys.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/kernel/sys.c b/kernel/sys.c index 12df0e5434b8..8e56d87cc6db 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -1993,6 +1993,18 @@ static int prctl_set_mm_map(int opt, const void __user *addr, unsigned long data if (copy_from_user(&prctl_map, addr, sizeof(prctl_map))) return -EFAULT; + prctl_map->start_code = untagged_addr(prctl_map.start_code); + prctl_map->end_code = untagged_addr(prctl_map.end_code); + prctl_map->start_data = untagged_addr(prctl_map.start_data); + prctl_map->end_data = untagged_addr(prctl_map.end_data); + prctl_map->start_brk = untagged_addr(prctl_map.start_brk); + prctl_map->brk = untagged_addr(prctl_map.brk); + prctl_map->start_stack = untagged_addr(prctl_map.start_stack); + prctl_map->arg_start = untagged_addr(prctl_map.arg_start); + prctl_map->arg_end = untagged_addr(prctl_map.arg_end); + prctl_map->env_start = untagged_addr(prctl_map.env_start); + prctl_map->env_end = untagged_addr(prctl_map.env_end); + error = validate_prctl_map(&prctl_map); if (error) return error; @@ -2106,6 +2118,8 @@ static int prctl_set_mm(int opt, unsigned long addr, opt != PR_SET_MM_MAP_SIZE))) return -EINVAL; + addr = untagged_addr(addr); + #ifdef CONFIG_CHECKPOINT_RESTORE if (opt == PR_SET_MM_MAP || opt == PR_SET_MM_MAP_SIZE) return prctl_set_mm_map(opt, (const void __user *)addr, arg4); -- 2.21.0.360.g471c308f928-goog