Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp1498000imp; Fri, 22 Feb 2019 04:55:48 -0800 (PST) X-Google-Smtp-Source: AHgI3IYHpoGTm5EaOc8M5uUbv6RBJCUb2zmHtZx6CNTrNoxkx3A0PIqiBW2VvkrmDsKj7GW+GJTk X-Received: by 2002:aa7:85d1:: with SMTP id z17mr4034841pfn.226.1550840148663; Fri, 22 Feb 2019 04:55:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550840148; cv=none; d=google.com; s=arc-20160816; b=ejQfd2CWz8IdaABW7CU6P4CP716f5ahojmAqOZqcN5f/hFywEP3TVE16K8yQjVfn6+ oKbSnYX9Ls/XvbtniN13coPwIpx55ezKYn9HjQcVHkaH8hT0ko5U7vYl970SomzTrXGh 3NA19DE0+ObKSZZLFwkv37RWOhdJn4BZnF6KLZierga35qQ0BpIBWgJ64kUVf2IfHXJM dDKPn5l9KMt6uCViGFbm1qrU+GbzaaaR8NYOoI1p0K7RFe9m9ntj5OtX4hACIBCybGPO EnJVLtsFSooNdzRtSDqj20f0lQDl6OJv83bKY/xZJYPimBT0V8APOgS1xgADRxInnLwG 2tFg== 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=PKTXMuuFJ0ycWRkeXV5y91b1obeaiELoxpNU31S68XA=; b=yaxL56aIHRjciZXhEcQWnwyflD+zCfaTirsiQjgalKMU91RhLr89oUAbSwJsGYXTP1 ZWleuWI9ej5Dp+N0xNR1tFzeCzIezTbuKeex0u1tji1shfY/H0yuNbk4n4oSWj38GEAI adCFc+jgKPp5iQLruCkwBkKn0JhhsChsdyIytgwbU93dP9IhnqgCRUToy5x30JciMWfk 9XtHGb7Gz81BiYRSVSYK0M2jTjLCZ6NJZOmbzaf/wlQMRgtdtU6IlrK1OCkLn4ftSEOl /1a6PXOa0n/EVABEnLzFW50w7NZxK/lasMBiJbEhR2STtLtk71HltNCGGh4IVNB2OqUG sMUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=FaiH8DNH; 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 y14si1282984plr.78.2019.02.22.04.55.33; Fri, 22 Feb 2019 04:55:48 -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=FaiH8DNH; 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 S1727435AbfBVMyj (ORCPT + 99 others); Fri, 22 Feb 2019 07:54:39 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:39574 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726712AbfBVMxh (ORCPT ); Fri, 22 Feb 2019 07:53:37 -0500 Received: by mail-wm1-f67.google.com with SMTP id z84so1862360wmg.4 for ; Fri, 22 Feb 2019 04:53:36 -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=PKTXMuuFJ0ycWRkeXV5y91b1obeaiELoxpNU31S68XA=; b=FaiH8DNHehCmj69FkdBo6mXbqqulK/U8NyRCwUPqCoCXisYnu5gQCGM5mMgF2o+r5C Q895ILkegF7YVy2vFzwoQsyu3DHKrS7Js60oUmj3EHAuQ3lDC4dMnGfkMJZ62pMapL+k xytmFOkCQHvp0gNluVOkEqXFJhXzhLYBgN2pDRZLIp1yIz0MZnbqLpN529eBLDmuCQ7L aRGgYK5N5Bf8jKNgpzLn0LgSmAlL7MWKlzzgbhspTRp7qG3c5svcptnL3y0tn8I+xiVR fsnSCnDs4Y6Ma8rGFmML1DTnS0qu8iSEQz/qlVoGNtR0rlFccPGC+6s/xVUFiGjh1uzO Tj3A== 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=PKTXMuuFJ0ycWRkeXV5y91b1obeaiELoxpNU31S68XA=; b=C+csNO5pDDBPIHKHRQM1fFXzJg9FyAD1/ysi+ZF+hJqXsmRdJgY+EjLRY3U0o7SGqM /l6ataqleGFWB0LJqjicWy0pzwSqCl06e0b8jhQWHSS6nca+wFeadRJgIDQZhpV8nmC2 TrJlGWA93P8STzC5nFav3NIFitLwJhexJ3h5ZNAf7OTCnkVaV6ZGnZUpGoPXbOmhwK+p 8bCy9Qw5eRKp79v0zK5kbHoaBOapErI2jf02ZEod4nI6ya90frpIOCw+oP0D8PARiNS3 i69e5zOXmQNniyG/f2UCm1WfafhioZiIDoMNtS+kRUeZrjnF/4DAXNG6LipoH2THuxUf qtFA== X-Gm-Message-State: AHQUAuY5VdJ+Ao4MCVLgF/jY/9j0DpRXX12abvk9MnCv/lasHEPbRSdI I0szjuigCUAgEBCztwOSxzqE8g== X-Received: by 2002:a7b:c115:: with SMTP id w21mr2545389wmi.104.1550840015942; Fri, 22 Feb 2019 04:53:35 -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.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Feb 2019 04:53:34 -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 03/12] lib, arm64: untag user pointers in strn*_user Date: Fri, 22 Feb 2019 13:53:15 +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 strncpy_from_user and strnlen_user accept user addresses as arguments, and do not go through the same path as copy_from_user and others, so here we need to handle the case of tagged user addresses separately. Untag user pointers passed to these functions. Signed-off-by: Andrey Konovalov --- lib/strncpy_from_user.c | 2 ++ lib/strnlen_user.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/lib/strncpy_from_user.c b/lib/strncpy_from_user.c index 58eacd41526c..c6adfad39016 100644 --- a/lib/strncpy_from_user.c +++ b/lib/strncpy_from_user.c @@ -106,6 +106,8 @@ long strncpy_from_user(char *dst, const char __user *src, long count) if (unlikely(count <= 0)) return 0; + src = untagged_addr(src); + max_addr = user_addr_max(); src_addr = (unsigned long)src; if (likely(src_addr < max_addr)) { diff --git a/lib/strnlen_user.c b/lib/strnlen_user.c index 1c1a1b0e38a5..26a6a2a1a963 100644 --- a/lib/strnlen_user.c +++ b/lib/strnlen_user.c @@ -108,6 +108,8 @@ long strnlen_user(const char __user *str, long count) if (unlikely(count <= 0)) return 0; + str = untagged_addr(str); + max_addr = user_addr_max(); src_addr = (unsigned long)str; if (likely(src_addr < max_addr)) { -- 2.21.0.rc0.258.g878e2cd30e-goog