Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp2202152rdb; Mon, 9 Oct 2023 17:01:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFQu8QC5jRK9zv5/2xgc6rplRf1yAjIvC74i++O8jwgEyASHkisqIO/UHb+ZIqYWuQOlqDk X-Received: by 2002:a17:902:f546:b0:1c5:b622:6fcd with SMTP id h6-20020a170902f54600b001c5b6226fcdmr21008340plf.22.1696896075195; Mon, 09 Oct 2023 17:01:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696896075; cv=none; d=google.com; s=arc-20160816; b=g1NA+9DNbb2qYsJ9ZwBwDopCrhdPKcyApUSWf9eD86PPa8jNIglkQaJc0WTf7xHQAb joP7xY3eFp9ZwdL4QcV3jKlahb6XxBak1ZL0P7rzp49m8knxr4OMigyoOI1xkRgphNeR FrC13Ry8/37xywQEFCS4YCVvas92MJCVUp7zuUceyaxIB5PPEr9JFfR7H0kaTE6i+qBn U7bXuucXlMSOb9Q8ZLxuWt+j4yGpXGq9BoJW293UQA3kLOzJF6cpbiyQqf2OJ0CmnMyp mcEzxvUf+XOuME/306Lw7B4I9CQjms+JXUQYBGsdNiHZBgbj6fLbdEspCi5nc4te32UQ JVTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=m8wElF7g5syQ7ht8CtQXj+FlFUUWeOsXPs0gqy6jQ4o=; fh=tzl7VynDwwAEKRbUREVdeazSBsK/qY/13Co+MQssVLQ=; b=bZYzXyaCjl0wMvFVHWDLMWb8BbVYAcMGAXJKhRnD2QvFPaFu+Oj5I3FwKwzhJ72W/L VYnx47u4RQXcho4eVDxY39pT0hcA8E7HJyeEHR30c6Wj9JREGtv8AcC3/+Hm+unPBzdg 67g79OhbqIj8UN66WdEIfj8fI0MN1U1tNyt/7dP7GvOAQI5JGg+KlVoOYa0bkHOH0QSE qTc3N2mLPOuwsFfdz6NfxfZ0xDyv43WuV6vteVOTEdzLXfILSXsKyhirSoDuUULtXueb 7XUNaHhJGr04DrkS1dMBYFFIuAvU+Skc2NMusIDsa/r7OoDgpQ1EJPyzysBiXJRQfp7G Mdiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=RryLjpiV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id m18-20020a170902db1200b001b3fb1742e4si11135990plx.547.2023.10.09.17.01.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 17:01:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=RryLjpiV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 8AA298041971; Mon, 9 Oct 2023 17:01:12 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379111AbjJJAA6 (ORCPT + 99 others); Mon, 9 Oct 2023 20:00:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377918AbjJJAAz (ORCPT ); Mon, 9 Oct 2023 20:00:55 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93F23A3 for ; Mon, 9 Oct 2023 17:00:54 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7362C433C7; Tue, 10 Oct 2023 00:00:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1696896054; bh=YKS8Y/7EmqBXYuLK/9MivE+xNPfZVkeyEmaZhaCyW+E=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=RryLjpiV4EvbXtkF6jCKy71S0MNAG5dgMqH2ypf7KUcH8JxcCO2Az3wr4Fop2QoZB 3vUic30DMWobAmFZ3NSBupUnzR8oiCFyzwCFCRMhVbHe34pG+kprS/MS9qoywVGkBA VSZqLNIVRk+B/g6HIw4aYkQXMV018pdZOysyJ0yw= Date: Mon, 9 Oct 2023 17:00:31 -0700 From: Andrew Morton To: Haibo Li Cc: , Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Vincenzo Frascino , Matthias Brugger , AngeloGioacchino Del Regno , , , , , Subject: Re: [PATCH v2] kasan:print the original fault addr when access invalid shadow Message-Id: <20231009170031.a294c11575d5d4941b8596a9@linux-foundation.org> In-Reply-To: <20231009073748.159228-1-haibo.li@mediatek.com> References: <20231009073748.159228-1-haibo.li@mediatek.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 09 Oct 2023 17:01:12 -0700 (PDT) On Mon, 9 Oct 2023 15:37:48 +0800 Haibo Li wrote: > when the checked address is illegal,the corresponding shadow address > from kasan_mem_to_shadow may have no mapping in mmu table. > Access such shadow address causes kernel oops. > Here is a sample about oops on arm64(VA 39bit) > with KASAN_SW_TAGS and KASAN_OUTLINE on: > > [ffffffb80aaaaaaa] pgd=000000005d3ce003, p4d=000000005d3ce003, > pud=000000005d3ce003, pmd=0000000000000000 > Internal error: Oops: 0000000096000006 [#1] PREEMPT SMP > Modules linked in: > CPU: 3 PID: 100 Comm: sh Not tainted 6.6.0-rc1-dirty #43 > Hardware name: linux,dummy-virt (DT) > pstate: 80000005 (Nzcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) > pc : __hwasan_load8_noabort+0x5c/0x90 > lr : do_ib_ob+0xf4/0x110 > ffffffb80aaaaaaa is the shadow address for efffff80aaaaaaaa. > The problem is reading invalid shadow in kasan_check_range. > > The generic kasan also has similar oops. > > It only reports the shadow address which causes oops but not > the original address. > > Commit 2f004eea0fc8("x86/kasan: Print original address on #GP") > introduce to kasan_non_canonical_hook but limit it to KASAN_INLINE. > > This patch extends it to KASAN_OUTLINE mode. Is 2f004eea0fc8 a suitable Fixes: target for this? If not, what is? Also, I'm assuming that we want to backport this fix into earlier kernel versions?