Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp3243470imc; Wed, 13 Mar 2019 12:32:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqy0VLmq0N85znneYV7+fVzOae/h7JFO001aPNHvkM6CK2n5Xl0OB+fxRW2XCVNKvSumCXgq X-Received: by 2002:a65:6148:: with SMTP id o8mr41837636pgv.442.1552505564990; Wed, 13 Mar 2019 12:32:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552505564; cv=none; d=google.com; s=arc-20160816; b=j5DsQcMXnE57MncChf3ULqyyrdBv3Z8+QgMCk1y4lLaj2EDV2K9YACAmbmaQJ4+pAz yBrMwUhBCMKM9XiBnWAMaAoIqW7Qg7oLafuvtdb9+sp8U4uyyPi2FsZ0Jm6poxh4M7lB 80lzhcfGJX+wBOW02cm31/nbgh1UDeiKZL/MhQ7BYt8a+MJUbEOX3gs7X1bcZDfmXLnU heeAkCpCQFTppUhnqxqgvsiBWMreXh6ON4YNtiG/OwS+r2aPRteQxhk4E7aAOCT1M5vg qiI7NHzc/TO1KGYJ2KUnDnsBkkW023+wZsMf/m5agqPAonXOmXucoAuSWZeQyeSbTiv2 bGVg== 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=1CkMolPkO1Q8oEIlqWXm/ypYPiUFq205eIq3aDm0/wc=; b=HVEeGVCiCWPctBXCeSFtDXUOgIj9LYvotz4QLIndmcTslRwlkcfCWjlQA1QI/boy4x rxhoidtVzTI7VvvEWAcKSw5XIbrR5S1Ja2gHQsuHgeyaB6RwR02NOVewV0DBGMr8ftW9 Q76QVgtPBuSHcRwD9Gi2I8rAlfEhZfl8fYxvUZFXxp+v12ZWTfJ9zErivTftIln9bCaA hfWPhKhRbYNWAIhTsQIZJ93eIEzCcuEsyTeyOU5oUhlUUDiw+gczUEiBn2YfbUrG/94G Y+/RymZ3TIUf7Rp54744Kj1Mj9WPXdPAxEdVQuCMdq16M8xCXxIW9qVUDDlh1sHPb4Rx tfjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Y4Q/McMK"; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cm10si12592886plb.295.2019.03.13.12.32.29; Wed, 13 Mar 2019 12:32:44 -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=@kernel.org header.s=default header.b="Y4Q/McMK"; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727707AbfCMTbf (ORCPT + 99 others); Wed, 13 Mar 2019 15:31:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:42440 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727567AbfCMTLr (ORCPT ); Wed, 13 Mar 2019 15:11:47 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4393C21852; Wed, 13 Mar 2019 19:11:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1552504306; bh=hNlX4NqqxVp9sR85/OPqvCCwSo47QbbfEdAOHK+6KN8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y4Q/McMKyeCwApETgo2CJXOPTRK9JufNDdpY/YGIyi5QGJQvSeNJAYh5wcRzRUM0F g75dKDB8dz/fEORAcqdAOyV/xTJDoYavJPIHze9TnIDaQjo/lsr510B5QxOkWEwKLJ qWXDJ3Wrn+F2yT38wovYy2Pn36eM/T0Lfq/4iM1c= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Andrey Konovalov , Alexander Potapenko , Andrey Ryabinin , Catalin Marinas , Dmitry Vyukov , Evgeniy Stepanov , Kostya Serebryany , Vincenzo Frascino , Andrew Morton , Linus Torvalds , Sasha Levin , linux-mm@kvack.org Subject: [PATCH AUTOSEL 4.20 38/60] kasan, slab: fix conflicts with CONFIG_HARDENED_USERCOPY Date: Wed, 13 Mar 2019 15:09:59 -0400 Message-Id: <20190313191021.158171-38-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190313191021.158171-1-sashal@kernel.org> References: <20190313191021.158171-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrey Konovalov [ Upstream commit 219667c23c68eb3dbc0d5662b9246f28477fe529 ] Similarly to commit 96fedce27e13 ("kasan: make tag based mode work with CONFIG_HARDENED_USERCOPY"), we need to reset pointer tags in __check_heap_object() in mm/slab.c before doing any pointer math. Link: http://lkml.kernel.org/r/9a5c0f958db10e69df5ff9f2b997866b56b7effc.1550602886.git.andreyknvl@google.com Signed-off-by: Andrey Konovalov Tested-by: Qian Cai Cc: Alexander Potapenko Cc: Andrey Ryabinin Cc: Catalin Marinas Cc: Dmitry Vyukov Cc: Evgeniy Stepanov Cc: Kostya Serebryany Cc: Vincenzo Frascino Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- mm/slab.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/slab.c b/mm/slab.c index 9d5de959d9d9..05f21f736be8 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -4421,6 +4421,8 @@ void __check_heap_object(const void *ptr, unsigned long n, struct page *page, unsigned int objnr; unsigned long offset; + ptr = kasan_reset_tag(ptr); + /* Find and validate object. */ cachep = page->slab_cache; objnr = obj_to_index(cachep, page, (void *)ptr); -- 2.19.1