From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50148C07E99 for ; Mon, 12 Jul 2021 08:38:54 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 15F3F610D1 for ; Mon, 12 Jul 2021 08:38:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 15F3F610D1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=sarCGATx5PuEQTe4vbxYD7/I6Ee1ip2g/Grci29CmK0=; b=mPU7B1WhThOVIl k9N+UwSD8Kn10zIRZxykXeYzLDbpM5tcfUO8wogNFAF/jX1u2Z3bSMtVg7gPn2wGOZo+2t2GVLH5K sxZ9MgB6WMWdhL34EwKVkdZVjE0HhjkjU/49+WXd2zM7UwvgOtle0dPQ+B0rKCk6Z//SySarjpCRs mx6RRm9neyr8LbuZuPvUrpSt+qcEgrf2tcrOdAFtl+yJf2hSn4lEQUJsjzSl8mswMLzxq5E2noVOc PWsuflGR3ZhYloWAEj7aLO+dYB0tGbLNRJoZhF6TlOZmAYcb1huRb7I5NthzShIMwSMvN8HM6Vac7 WzTkZAaWWYQtBZ431c2A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m2rRa-006bvC-PI; Mon, 12 Jul 2021 08:37:38 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m2rRW-006buJ-2r for linux-arm-kernel@lists.infradead.org; Mon, 12 Jul 2021 08:37:36 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B82071FB; Mon, 12 Jul 2021 01:37:28 -0700 (PDT) Received: from C02TD0UTHF1T.local (unknown [10.57.2.95]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D21A03F694; Mon, 12 Jul 2021 01:37:25 -0700 (PDT) Date: Mon, 12 Jul 2021 09:37:17 +0100 From: Mark Rutland To: Andrey Konovalov Cc: Sam Tebbs , Robin Murphy , Andrew Morton , Linux ARM , LKML , Catalin Marinas , Dmitry Vyukov , Alexander Potapenko , Andrey Ryabinin , Will Deacon , Marco Elver Subject: Re: [PATCH] kasan: fix build for CONFIG_KASAN_HW_TAGS Message-ID: <20210712083455.GA85732@C02TD0UTHF1T.local> References: <20210708144411.25467-1-mark.rutland@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210712_013734_288503_6CB802A3 X-CRM114-Status: GOOD ( 30.38 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Sat, Jul 10, 2021 at 09:16:14PM +0200, Andrey Konovalov wrote: > On Thu, Jul 8, 2021 at 4:44 PM Mark Rutland wrote: > > > > When CONFIG_KASAN_HW_TAGS is selected, uses _RET_IP_, > > but doesn't explicitly include where this is defined. > > > > We used to get this via a transitive include, but since commit: > > > > f39650de687e3576 ("kernel.h: split out panic and oops helpers") > > > > ... this is no longer the case, and so we get a build failure: > > > > | CC arch/arm64/mm/kasan_init.o > > | In file included from arch/arm64/mm/kasan_init.c:10: > > | ./include/linux/kasan.h: In function 'kasan_slab_free': > > | ./include/linux/kasan.h:211:39: error: '_RET_IP_' undeclared (first use in this function) > > | 211 | return __kasan_slab_free(s, object, _RET_IP_, init); > > | | ^~~~~~~~ > > | ./include/linux/kasan.h:211:39: note: each undeclared identifier is reported only once for each function it appears in > > | ./include/linux/kasan.h: In function 'kasan_kfree_large': > > | ./include/linux/kasan.h:219:28: error: '_RET_IP_' undeclared (first use in this function) > > | 219 | __kasan_kfree_large(ptr, _RET_IP_); > > | | ^~~~~~~~ > > | ./include/linux/kasan.h: In function 'kasan_slab_free_mempool': > > | ./include/linux/kasan.h:226:34: error: '_RET_IP_' undeclared (first use in this function) > > | 226 | __kasan_slab_free_mempool(ptr, _RET_IP_); > > | | ^~~~~~~~ > > | ./include/linux/kasan.h: In function 'kasan_check_byte': > > | ./include/linux/kasan.h:277:35: error: '_RET_IP_' undeclared (first use in this function) > > | 277 | return __kasan_check_byte(addr, _RET_IP_); > > | | ^~~~~~~~ > > > > Fix this by including explicitly. > > Hi Mark, > > Marco already sent a fix for this. It should be in the mm tree. > (Although the link to it in the Andrew's notification email doesn't > work. But they rarely do :) > > > As a heads-up, there are some unrelated runtime issues with > > CONFIG_KASAN_HW_TAGS and the recent arm64 string routines rework, which > > I'm looking into now. If you boot-test with this applied, you should > > expect to see those. > > +Sam, +Robin > > Looks like the new strlen routine is making accesses past the allocated buffer. > > The guilty commit is 325a1de81287 ("arm64: Import updated version of > Cortex Strings' strlen"). FWIW, I already have a fix for this, I'm just cleaning it up and will post shortly. The issue is that the new strlen() will make unaligned 16-byte accesses within a naturally-aligned 4096-byte window and over-read by up to 15 bytes; we can fiddle with its alignment fixup to always align to 16 bytes when MTE is in use so any over-read is within the same MTE granule as the final byte of the string. I've checked the other routines, and AFAICT they never make accesses which staddle a 16-byte boundary. Thanks, Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel