Message ID | 7e756a298d514c4482f52aea6151db34818d395d.1546540962.git.andreyknvl@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9A4146C5 for <patchwork-linux-mm@patchwork.kernel.org>; Thu, 3 Jan 2019 18:45:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8ED9A28D06 for <patchwork-linux-mm@patchwork.kernel.org>; Thu, 3 Jan 2019 18:45:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 81EC828D12; Thu, 3 Jan 2019 18:45:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 294F028D06 for <patchwork-linux-mm@patchwork.kernel.org>; Thu, 3 Jan 2019 18:45:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3CBFD8E0097; Thu, 3 Jan 2019 13:45:31 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 37D628E0002; Thu, 3 Jan 2019 13:45:31 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1F5688E0097; Thu, 3 Jan 2019 13:45:31 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by kanga.kvack.org (Postfix) with ESMTP id B785D8E0002 for <linux-mm@kvack.org>; Thu, 3 Jan 2019 13:45:30 -0500 (EST) Received: by mail-wr1-f72.google.com with SMTP id 49so16328397wra.14 for <linux-mm@kvack.org>; Thu, 03 Jan 2019 10:45:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=wqfuZcAjUCBtOLKWkS6SRZq/hte3EYpV7rEPQw3hkz8=; b=UAXmDlYeUCZWTfcJp+sqKDMbBD6Fx6CkmIenp06jmNtmLm20JlEMdgepWp43jYY484 lhkXmAwxA5r081vpJD0KaSaNTiNjD7nhNGEvdXAprgSxT593ADibXguVYGi4Q585l4US X6zfOkKWn+YYPnK3mHiZKEWWbD3DHJdFN0OS8MIXjk7zGQOgTbEvU6XbmTIP34dNaFFv EAu+Wr5QweJRH4010jBa8LoNplzvEvjo+ps19bdS5PwAGkpRAw6P0yC5xbvHHA8kAh2W PO95R4Ndu12BedTysGN9vQzjhciFw++PXEla+r1+VUWY+otDzoE65Z4Pt2oWW1lT4mwl hbhw== X-Gm-Message-State: AJcUukeTZF1gSLzgueZMWquRfOUAYetTYPN+3FcE+bJw+mtLFRhoaEU5 aIbT6nnx1K6vvfuhPP5ANoavoNRTk9jU2YLtlbgk0y+xrt+dJH/aJqXi5zsQjaviXtdeTw6rtBZ 5Uk1oJRpUux3Ngx4Cr9B0QeHLf77n9WrJ7dKJx2rijQ37OpP8wXhNHDnTepMx3uejNoYdi5+gxk G5SrL0gW/lSpKQ3thptOlwhnrfniFyl1T2GcAukPUoekcIrdEOyHjFqISIpaEypvMjcJCeSpAMb ErM+8BdVMwBcYPXBBdj7qUQIDxW2ds6Wb/KZjYPo2jYa37vifB+zIuFtKgwIeEkOXISJ0TiGA8A rf3B7elkcmyTKAPTzTfTyldrxUIoJ50uVPS0BeDSJqOllQHDRazwpig8CMMA+DGzoJWSUj3tAG/ o X-Received: by 2002:a1c:1593:: with SMTP id 141mr38330825wmv.85.1546541130266; Thu, 03 Jan 2019 10:45:30 -0800 (PST) X-Received: by 2002:a1c:1593:: with SMTP id 141mr38330791wmv.85.1546541129422; Thu, 03 Jan 2019 10:45:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546541129; cv=none; d=google.com; s=arc-20160816; b=txii0hPgYlZshGfpZ4yesLJXs7x7D+VTQIFJQaOy0oIiZKSdDyAmtGPLwT8oggoKml zyp1fdHp5OHGoEMFDBJpH1bDeakq/Bigc4rejjy+SHewuSMIlLzHwz1KsmNEt9J2zRCy VK/5X1DIxOZO+wu3z392Q0x9q4JHaPTkkbM/FG4XqetkyU2tVLd30VOOmVDLMUB6c00/ gZNGp77OrPGy5GaTMwkdqCJpfnRZvNhNce7QxrIdiASTvJdOtqIQ5IBlSPs4mjuNSUk/ f1DlDnodBsQIqoyWTbz0wGBc53TkgXZcFhJuqv1hLVgIkgJPOuQzawayRw78uMKZ2OEh t9CA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=wqfuZcAjUCBtOLKWkS6SRZq/hte3EYpV7rEPQw3hkz8=; b=KUiA9bo/ymQqkLYlgkO+SWMu0Y77MVm+iyM4LBb1pRZZama+hNTYNOZfPt69nA37aq lcrXHauz/UOOICJfXa+Z7IUnstYh84w2gVtdLAvOSpLUE7p2AHtZK8WHmyPY/bExy1k4 +J53pBFI5mRVH6gnj9P2qQ9fhOc1HuJTkYRj4Dsf4IIAZPhnw7P3KvQ2aYgJto/MRcw9 Q/CZ90OpEwu44v6UK5teg7N0x6CDRhARpNtDyfFp5uxqT5Ykn8xUcJ+8JIU76hIBu246 6FaCx0oGwWItfEKxDYHG3j6yAb/31023AYY6/EntUv5bEmS+OwyR0++VL2CxO9+ULKEj DH9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Ba8p1LN6; spf=pass (google.com: domain of andreyknvl@google.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=andreyknvl@google.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id k3sor28929112wre.42.2019.01.03.10.45.29 for <linux-mm@kvack.org> (Google Transport Security); Thu, 03 Jan 2019 10:45:29 -0800 (PST) Received-SPF: pass (google.com: domain of andreyknvl@google.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Ba8p1LN6; spf=pass (google.com: domain of andreyknvl@google.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=andreyknvl@google.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com 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=wqfuZcAjUCBtOLKWkS6SRZq/hte3EYpV7rEPQw3hkz8=; b=Ba8p1LN6oK3Pi0Fl7zZMXYDUR1uRcqSUKMdpT1Q7mAQ6syoy5qLvkHGMUj6j/vGuB2 mPO5FuGEoA96YcXVqzSpSwHEKELmv7R+EvR+inn+PIduuMt4TwXWHgaGeZc0ky7vvm86 yH9L4u9oYTTxmMJbx5HQX1aqZm017enJlCtGAbNGdHs15wOBu7Y61tXbAM6zeVySF49T mmuEIvLHrEZb5taS7g9ooF90sN5EBjH7gGfduXn1VTHmhUOpSR2P22jZqk1x1eBZqFiP sH2YY6VeZEfqquy8gfHxRd99KsANe2ythZVkjVH7ZxaZekAiskkZhF+Vg3IKqAONrIV4 HEZg== X-Google-Smtp-Source: ALg8bN4LFcO01Vv4WTRKcuv5YTd1wsOefh/eH/jXvbvXe+jy9rGwknH3ImOWsoQ1UvdKBEe2ffL9iQ== X-Received: by 2002:a05:6000:f:: with SMTP id h15mr40972842wrx.248.1546541128878; Thu, 03 Jan 2019 10:45:28 -0800 (PST) Received: from andreyknvl0.muc.corp.google.com ([2a00:79e0:15:13:8ce:d7fa:9f4c:492]) by smtp.gmail.com with ESMTPSA id t12sm52236944wrr.65.2019.01.03.10.45.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Jan 2019 10:45:27 -0800 (PST) From: Andrey Konovalov <andreyknvl@google.com> To: Andrey Ryabinin <aryabinin@virtuozzo.com>, Alexander Potapenko <glider@google.com>, Dmitry Vyukov <dvyukov@google.com>, Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will.deacon@arm.com>, Christoph Lameter <cl@linux.com>, Andrew Morton <akpm@linux-foundation.org>, Mark Rutland <mark.rutland@arm.com>, Nick Desaulniers <ndesaulniers@google.com>, Marc Zyngier <marc.zyngier@arm.com>, Dave Martin <dave.martin@arm.com>, Ard Biesheuvel <ard.biesheuvel@linaro.org>, "Eric W . Biederman" <ebiederm@xmission.com>, Ingo Molnar <mingo@kernel.org>, Paul Lawrence <paullawrence@google.com>, Geert Uytterhoeven <geert@linux-m68k.org>, Arnd Bergmann <arnd@arndb.de>, "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Kate Stewart <kstewart@linuxfoundation.org>, Mike Rapoport <rppt@linux.vnet.ibm.com>, Vincenzo Frascino <vincenzo.frascino@arm.com>, kasan-dev@googlegroups.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sparse@vger.kernel.org, linux-mm@kvack.org, linux-kbuild@vger.kernel.org Cc: Kostya Serebryany <kcc@google.com>, Evgeniy Stepanov <eugenis@google.com>, Lee Smith <Lee.Smith@arm.com>, Ramana Radhakrishnan <Ramana.Radhakrishnan@arm.com>, Jacob Bramley <Jacob.Bramley@arm.com>, Ruben Ayrapetyan <Ruben.Ayrapetyan@arm.com>, Jann Horn <jannh@google.com>, Mark Brand <markbrand@google.com>, Chintan Pandya <cpandya@codeaurora.org>, Vishwath Mohan <vishwath@google.com>, Andrey Konovalov <andreyknvl@google.com> Subject: [PATCH v3 2/3] kasan: make tag based mode work with CONFIG_HARDENED_USERCOPY Date: Thu, 3 Jan 2019 19:45:20 +0100 Message-Id: <7e756a298d514c4482f52aea6151db34818d395d.1546540962.git.andreyknvl@google.com> X-Mailer: git-send-email 2.20.1.415.g653613c723-goog In-Reply-To: <cover.1546540962.git.andreyknvl@google.com> References: <cover.1546540962.git.andreyknvl@google.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> X-Virus-Scanned: ClamAV using ClamSMTP |
Series |
kasan: tag-based mode fixes
|
expand
|
diff --git a/mm/slub.c b/mm/slub.c index 36c0befeebd8..1e3d0ec4e200 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -3846,6 +3846,8 @@ void __check_heap_object(const void *ptr, unsigned long n, struct page *page, unsigned int offset; size_t object_size; + ptr = kasan_reset_tag(ptr); + /* Find object and usable object size. */ s = page->slab_cache;
With CONFIG_HARDENED_USERCOPY enabled __check_heap_object() compares and then subtracts a potentially tagged pointer with a non-tagged address of the page that this pointer belongs to, which leads to unexpected behavior. Untag the pointer in __check_heap_object() before doing any of these operations. Signed-off-by: Andrey Konovalov <andreyknvl@google.com> --- mm/slub.c | 2 ++ 1 file changed, 2 insertions(+)