Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp1497487imp; Fri, 22 Feb 2019 04:55:03 -0800 (PST) X-Google-Smtp-Source: AHgI3IYKOorl1r052q+kD9DiNNpqMnbpHUs9VeRFucYpeu6PBzOsgiRrM+xSXV3gJVgebFxdXdy0 X-Received: by 2002:a17:902:748b:: with SMTP id h11mr4022003pll.334.1550840103316; Fri, 22 Feb 2019 04:55:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550840103; cv=none; d=google.com; s=arc-20160816; b=HBayHrLK9dCrMpt+AD6Bkv91toc2HEBl+XeXQFzEL5+OdJDX6OUHj6FuGYvqcknuNB k+JZZhfWyjxii6CTl/fsTy4mKmXYhHB2blq7LaBZUyZU8KiTgYtHGlWtvgLnmLfXNfnk jZknIxlSJYkqCw2Kc4b3PwMpfv9RA39M58gC3p2NnVCiU00UXauOIt7ySvO2+anh/J1V j01HXWlCSVFxktM75pShK6K2E0CYaIAk5Du1g6RYMYCo/ZyiZ87/Ecz8IDXdIeS4/Qsr Ax2ChjaeOSJFOlEQkDNMJktzxxjKsoXMP39fQGZySXRYyGu9QbKOEHVWI9okfm210MLk Uenw== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2tCXxaQ0AcT215cB6TyMBJl5HSukg9TNH5t025IrNLw=; b=fUDEsX2V9DearogdsmhBjuDo9F6qNZhVupyaAQy/gOzRQYGE22G7LKc9EPGT46gsvU ypCjFSkelLg4qE2qqXu2nqc3L5mUhSClHY8mlHEn9WlNnt7TpUiz9rPOxxWmcGpVQUB+ esooEDTQOwC76lSdTvr4UrWHLCp/PfsFCEMdF3bI8yp6IbSAV9fFIbO4sa0ZOvSVlzol V20iarUJ3bKuPrphTOhm+n2S4trVj6nYb6v73139CzQtiQQkUip9vMmH492m4rTyWwc5 ZlwiUpZT7jC+jF1PWuKgGj4DxdqdfDj3irYG6JGVU+rdkMsLg9pf7IxHf8g1BranA2VU 0sqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=B3gwK58H; 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 f24si1338143pgb.588.2019.02.22.04.54.47; Fri, 22 Feb 2019 04:55:03 -0800 (PST) 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=B3gwK58H; 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 S1727325AbfBVMxw (ORCPT + 99 others); Fri, 22 Feb 2019 07:53:52 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:41000 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727280AbfBVMxt (ORCPT ); Fri, 22 Feb 2019 07:53:49 -0500 Received: by mail-wr1-f66.google.com with SMTP id n2so2247479wrw.8 for ; Fri, 22 Feb 2019 04:53:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2tCXxaQ0AcT215cB6TyMBJl5HSukg9TNH5t025IrNLw=; b=B3gwK58HnJ85CmTL2efZvH+J/Nm20KCnydLNY0dw7gbtvGIUGcldP8npiWTUpDXgKz /u11H7eQqGQOsrUx9Bjjx9CGJcxvqjtgzrsVE+c4Cnr2aH4wSMA3cBw28f4m5dvZcDtW dE9QsCl+18tkcm6KtqrSMoS1/n9nvYZMf6UFWkly4U8pHmTr2bgB/2tzCG5OvgHPbq1p LygIpIzOhXUWhS3SS/cArJu5XyCYKaSFAA2Xlb21EPCN/ry2nFAF1xMDOUEnala+awoK ndjVy074STqch02YUSBKRqql7aX75kVTJAVZrchuqsIoYuA52Cu849nBt6+cAxrGpU8H 43FQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2tCXxaQ0AcT215cB6TyMBJl5HSukg9TNH5t025IrNLw=; b=ho2mu4b2veAXrjvyfb8UnxgkdVPBDZhYPYrtgC7KExHQgbeOMLbqkb9l8ky2V458kH HZ2F90kwj094pao/zBbYAM5uQvsYQQVlbMpXcoY+c4P7qWf89YRafJtUzJ1JLVCD+8lR tD2BIVzTqkrQiF/88jk/lvqdTx8B5zTfUT/1zwLZfZV87bclsStQ5ueoVf+s8ckAIJnD 4JA7+biT3c00z6wRYkIDcn9uLoPAz1cPUF78jngVOMUH0KVIhEh2M93Koxpdxo86VL8w ia3i8rfrVcf9yCe7IAO7P585JzeYHofrNFCt2OsePlYRFyo6gr3bLcgQUGqkeLT+mZQf EShg== X-Gm-Message-State: AHQUAuYpSioiesQEHYIzBNoPcjSbSxd9dIA963xX9GQ1GbTBxS4LWMUR j6n9LndEzfSi2Ofim0QzYJh7uw== X-Received: by 2002:adf:ed0f:: with SMTP id a15mr2881069wro.249.1550840027447; Fri, 22 Feb 2019 04:53:47 -0800 (PST) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:13:8ce:d7fa:9f4c:492]) by smtp.gmail.com with ESMTPSA id o14sm808209wrp.34.2019.02.22.04.53.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Feb 2019 04:53:46 -0800 (PST) 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 , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@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 Subject: [PATCH v10 09/12] kernel, arm64: untag user pointers in prctl_set_mm* Date: Fri, 22 Feb 2019 13:53:21 +0100 Message-Id: X-Mailer: git-send-email 2.21.0.rc0.258.g878e2cd30e-goog In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 f7eb62eceb24..12910be94b7f 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -1992,6 +1992,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; @@ -2105,6 +2117,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.rc0.258.g878e2cd30e-goog