Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp511200imm; Thu, 30 Aug 2018 04:43:30 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZq9GgFjwBHVidks0kLHa59J+G1PJlzzTsKeZqrl5K0jffCTVYYMNM/7VMeo8FptsA7vSqb X-Received: by 2002:aa7:831b:: with SMTP id t27-v6mr10115528pfm.81.1535629410622; Thu, 30 Aug 2018 04:43:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535629410; cv=none; d=google.com; s=arc-20160816; b=SrvP+cwDY2JruGvDN0GtbkTlEPP5hTQu5f7vn8l8hgKGi4UZAFgAna+gIAd592JP2o TfdGB+UTRmCKQ7GkmUKQTEFw8nzrUWv2qUDE6U7HoEpbbNNvbQ+TsOGHlUJWMGJpcLuM wZ1QBmOtUnVEg75UOZY6RfCqH21HD5gqQoHA6AjwQ8BLQ10vseDBQZCxFDdl2yZQKOca IaGi9CGEY80a7YYCC4fPF2K4Jlo74iTtw0CooH0HV9NTd9dqejqjERApWqovnZpFzT3G ewGbUm/8o8JaibkZ6lTJZHpytANcjW8TPe5co6xNzP4D0mZ/mB75NJnZd+FSyNZiu0wp fWgw== 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:arc-authentication-results; bh=ppVHi2qDpVAko4oywEUyVH03nYNtDWMaAZh6pkh+TAI=; b=sFsHlihoj2o6r6oIB8KXk6r/e1NROBa2WC2kFi2H9slPwjPVP7mizCEaJD0qmNQbUc XbX3d+3q6sVjzOBzAxGxtUeFgG4nJOXI7KJvONWtWX9RPT5a7OzXWb+n0jHy+7QTd2Zp VqFGu5u0SuKSeDv/lvGjoCUpOWRo2c74Pnok7vADDH+X40R6ilvjJ+8aAWCTzRiZ9gde bo8CeEfP83fgYHWkdq/GKfGJAsWFVVoIdBCWc916YC+VUSGDcXFw00BMdxfXwf9+60hl XCqIhwy7j1LnnGImjY/JFZk/jJuh/6hXS0HayQ0+n+Q7XLtP5ulbQVwozS9zqVDpoXmp OGoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=vM2W1vbB; 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 j1-v6si6605088pgh.160.2018.08.30.04.43.16; Thu, 30 Aug 2018 04:43:30 -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=vM2W1vbB; 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 S1728642AbeH3PnQ (ORCPT + 99 others); Thu, 30 Aug 2018 11:43:16 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:53288 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728227AbeH3PnP (ORCPT ); Thu, 30 Aug 2018 11:43:15 -0400 Received: by mail-wm0-f67.google.com with SMTP id b19-v6so1651117wme.3 for ; Thu, 30 Aug 2018 04:41:31 -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=ppVHi2qDpVAko4oywEUyVH03nYNtDWMaAZh6pkh+TAI=; b=vM2W1vbB7o60flHuNJ/bgTQROh+Zt2m1p0PT33/imyxEkZK1/Esv7iYw9LpWqbIh3m hobo1vU1c+v0Sblwfgp+dimNnJPZy/F0NvOautf7atu0tq8HTohJpgdmmMrdl4AYk151 y1FKxABUZJiw/FShkiF4Vjx+avpapwRzC5R32XJn5fMZrR+LCeV7OWD7REcGraJpxEGx pZQS5IbOZ+yijKZDr2ka3/sxT/vVG5mZpKvFVey/NkAxEkpyZY7MDNEqyN0Dv5ql+VJW 4UYj6K8/zcqE3BRWKLrn8aXymf+gcl3zDhnzQaYNb/VkQUlbBIQ8Zyx56geVgZccD9MO FSxw== 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=ppVHi2qDpVAko4oywEUyVH03nYNtDWMaAZh6pkh+TAI=; b=dTCpw5tVDRMISpKipPNVFR8bnpmR9nEKmA6/0czqW4RVvkwxTgCS+pkjagrNATsYe5 YPwjUFP63XKdencFgIkGoq9vyXsbW69TvbXw++Ugf6zDemY1vmY/+B8un788Dfxw5LP1 XY8Zp8Q3CMiUMlqct6iTrLhkrDPYz7l9hnJ8Ec3xLIo3Qmr59uWP0m2cfI7BuUK/kMc8 09vst6pvd/M0gwX98MDV8V8RVXqAsqQty+FVqPMwItOxJaTdfCFKqtjTXOgPPhIbKRFC 3k9nErOaYNcJl543nNVVbLoliqzSkXTtd4vxHWfA0QL9fHhiqawSNDOxkCnY/wEsfjbZ pfuQ== X-Gm-Message-State: APzg51CghfEVaILkveqtVHysBeU42DcZsro8PXvyHfwDh4fDjfIsiIMS UsIhNXclbyNRc9ysu44QR79qCA== X-Received: by 2002:a1c:4c0c:: with SMTP id z12-v6mr1615687wmf.57.1535629291034; Thu, 30 Aug 2018 04:41:31 -0700 (PDT) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:10:84be:a42a:826d:c530]) by smtp.gmail.com with ESMTPSA id z184-v6sm2175218wmz.0.2018.08.30.04.41.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 04:41:30 -0700 (PDT) From: Andrey Konovalov To: Catalin Marinas , Will Deacon , Mark Rutland , Robin Murphy , Al Viro , Andrey Konovalov , 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 Subject: [PATCH v6 07/11] fs, arm64: untag user address in copy_mount_options Date: Thu, 30 Aug 2018 13:41:12 +0200 Message-Id: <89806bc1c1f85fa97c62887075cc2d46b8bdeee2.1535629099.git.andreyknvl@google.com> X-Mailer: git-send-email 2.19.0.rc0.228.g281dcd1b4d0-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 In copy_mount_options a user address is being subtracted from TASK_SIZE. If the address is lower than TASK_SIZE, the size is calculated to not allow the exact_copy_from_user() call to cross TASK_SIZE boundary. However if the address is tagged, then the size will be calculated incorrectly. Untag the address before subtracting. Signed-off-by: Andrey Konovalov --- fs/namespace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/namespace.c b/fs/namespace.c index 99186556f8d3..51f763fb9430 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -2672,7 +2672,7 @@ void *copy_mount_options(const void __user * data) * the remainder of the page. */ /* copy_from_user cannot cross TASK_SIZE ! */ - size = TASK_SIZE - (unsigned long)data; + size = TASK_SIZE - (unsigned long)untagged_addr(data); if (size > PAGE_SIZE) size = PAGE_SIZE; -- 2.19.0.rc0.228.g281dcd1b4d0-goog