Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1302648imm; Tue, 2 Oct 2018 06:14:01 -0700 (PDT) X-Google-Smtp-Source: ACcGV61zE9bB0XRHu0QljCQ1q42Uzg3ZfrzQ5KVfR0lgQ7g+WNNoCPY2IzMLZWEm/2fI00aVg6JE X-Received: by 2002:a17:902:566:: with SMTP id 93-v6mr17042945plf.184.1538486041312; Tue, 02 Oct 2018 06:14:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538486041; cv=none; d=google.com; s=arc-20160816; b=0kMUa6LEn37E/9ndiW2Tdxc/ILBrYgcAT4Wri90IyNqBpB0YSxdbQNCI3IAkh/W7HQ tRRzpRYP+icLuAddbIfd8x7zricv5PF9GzKOQ2mxdF7XOF1KB+K5//NiMOsy2v2AbnVa F3XJIeKLkUbqscFtoVhyzg9+sKW0En6k4jHQZPOYG+xERFN4AXz8QK5V0IOzLzPfBgt6 OkI0z2TuDgyufWxLaV+3PXTR2jnq7NR7fy8oz+DM+IFxQ5YWSfWKw6rsQm8DP7xaK6Qf HVGu319f5RP7ki4AQJE6tHxmvUF2cXvTmzOoSeUivXs2YrHkX79QfQ2BjfOT/b+iIJbz BPJg== 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=M+fzLalqRaXGFiw1By6nH8QQrYEhVoORFRhjy/6ZtCk=; b=YBmEVw3U/yYisU6nJjX17QpckydC4qjuJ+H6O94HmL+UQg4lEL1lLN/Jw3puyMV5Pb 0VecCFZ9FQcLZhE9y165Z24T0zrE4wQ4YVpd41y12Zx/qamrTNcEuu3NUJczd705VwJU 31ogE8CUv059F9Xi2smHujTPcJiA+ifbQKF/RhyHDpTi42NaUg8LWK45SNDvpMD8EeTb JA7Nrz0TpRj5iqILaKId7LvqpsZrEzFJF3jBfvm2b76L4ha73bcisu/BpL86jtaDsPLV Ls2UtRXwZwn4PQOT/DmDjCi83g7hvv33zRzts3E35GA+4JzOdDB11eX1F0x8zSDgAjlZ CcPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="g/5+TE8q"; 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 e17-v6si13502320pgv.54.2018.10.02.06.13.45; Tue, 02 Oct 2018 06:14:01 -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="g/5+TE8q"; 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 S1728095AbeJBT4N (ORCPT + 99 others); Tue, 2 Oct 2018 15:56:13 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:39417 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728025AbeJBT4K (ORCPT ); Tue, 2 Oct 2018 15:56:10 -0400 Received: by mail-wr1-f67.google.com with SMTP id 61-v6so1428748wrb.6 for ; Tue, 02 Oct 2018 06:12:52 -0700 (PDT) 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=M+fzLalqRaXGFiw1By6nH8QQrYEhVoORFRhjy/6ZtCk=; b=g/5+TE8qrM0S966GF0ehpYeatmN6rBIDeIbCUA440M2nraTgJHSOOqRefWma3H2QFk db/TLUMgW+3DdtgV6yDyHfsewvdoZ7XQ0S1jqS57d41YAflXkP1pp9HlkbzYwNkS0JIY pRVdhsSySSV0TihlxSpRvVQSVaJywiekWjskRHndBNzF7BevnT1qmGTO4DaIhzYUXxry LRsUaYPgQ3TIeOamcd3WNyixCIR5UKwYktsOiGG1HrBcYgd/3s9nCOH/IZLWx8A6pH7v c1a8+L2HtBSCHGIVd4jnex5QRuAgpohMaN8a5DeTpNqK4l46AuDUGWCyxe5giES9UqQY RTdg== 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=M+fzLalqRaXGFiw1By6nH8QQrYEhVoORFRhjy/6ZtCk=; b=fGSZr+nMaygE4waBNHGRu4oR63bplQr5GMR2mo0nhY4flBgygBaaGACGCkKoR6uwGx sz7VrRMsqu1fe0O0OLnN/qEfpYaLUDI/EPMAB/3hJ8LoqSxTRLfJAIVxcPNKO/vpaCcJ /vDToF5mMNXhZRsH/grdUJ5JzZTKp0ecucd9kQQ6yx1M4p/LnNoXUGBS6N8giBGeGWXR rhqqBQoVX+LV3mz6YaBHAfMBR4G99kuNV4WDVdAAwrxe2bpYVSNUMY3xLkRn6qWfLPwB 0AgxOnY508s6HRE8Hnt2yEVb3ekypMf8wnsQUFm3vVt4CtUizq7vTl+UE5HqwF3KRyB/ BVXA== X-Gm-Message-State: ABuFfoiboO3WTgjJypoRCK2NlB2t98G/ezS7mPyVYGHDDkOepz485iOU YpqNtshwyohDw+1jmpMyVFRkxg== X-Received: by 2002:adf:8022:: with SMTP id 31-v6mr8356555wrk.16.1538485971887; Tue, 02 Oct 2018 06:12:51 -0700 (PDT) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:84be:a42a:826d:c530]) by smtp.gmail.com with ESMTPSA id v10-v6sm17458681wrp.0.2018.10.02.06.12.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Oct 2018 06:12:50 -0700 (PDT) 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 , 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 , Andrey Konovalov Subject: [PATCH v7 4/8] mm, arm64: untag user addresses in mm/gup.c Date: Tue, 2 Oct 2018 15:12:39 +0200 Message-Id: <405ee9e84a83178e762d8bac97dd1b36ea09074e.1538485901.git.andreyknvl@google.com> X-Mailer: git-send-email 2.19.0.605.g01d371f741-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 mm/gup.c provides a kernel interface that accepts user addresses and manipulates user pages directly (for example get_user_pages, that is used by the futex syscall). Since a user can provided tagged addresses, we need to handle such case. Add untagging to gup.c functions that use user addresses for vma lookup. Signed-off-by: Andrey Konovalov --- mm/gup.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mm/gup.c b/mm/gup.c index 1abc8b4afff6..6f09132c654e 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -666,6 +666,8 @@ static long __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, if (!nr_pages) return 0; + start = untagged_addr(start); + VM_BUG_ON(!!pages != !!(gup_flags & FOLL_GET)); /* @@ -820,6 +822,8 @@ int fixup_user_fault(struct task_struct *tsk, struct mm_struct *mm, struct vm_area_struct *vma; vm_fault_t ret, major = 0; + address = untagged_addr(address); + if (unlocked) fault_flags |= FAULT_FLAG_ALLOW_RETRY; -- 2.19.0.605.g01d371f741-goog