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=0.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLACK 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 EECDAC433E0 for ; Tue, 23 Jun 2020 08:48:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D2A5320724 for ; Tue, 23 Jun 2020 08:48:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731986AbgFWIso (ORCPT ); Tue, 23 Jun 2020 04:48:44 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:7046 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731735AbgFWIsg (ORCPT ); Tue, 23 Jun 2020 04:48:36 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 05N8XEsU052824; Tue, 23 Jun 2020 04:48:32 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 31ud982nqh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 23 Jun 2020 04:48:31 -0400 Received: from m0098420.ppops.net (m0098420.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 05N8XeG7055496; Tue, 23 Jun 2020 04:48:31 -0400 Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0b-001b2d01.pphosted.com with ESMTP id 31ud982npp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 23 Jun 2020 04:48:31 -0400 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 05N8fdtL029890; Tue, 23 Jun 2020 08:48:29 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma04fra.de.ibm.com with ESMTP id 31sa381w8u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 23 Jun 2020 08:48:29 +0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 05N8mQG562390426 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 23 Jun 2020 08:48:26 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 96D684204B; Tue, 23 Jun 2020 08:48:26 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 25E7642041; Tue, 23 Jun 2020 08:48:26 +0000 (GMT) Received: from osiris (unknown [9.171.83.193]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Tue, 23 Jun 2020 08:48:26 +0000 (GMT) Date: Tue, 23 Jun 2020 10:48:24 +0200 From: Heiko Carstens To: Qian Cai Cc: Dmitry Vyukov , Andrew Morton , Christian Borntraeger , Alexander Potapenko , Kees Cook , kasan-dev , Linux-MM , linux-s390 , LKML , Vasily Gorbik Subject: Re: [PATCH] mm/page_alloc: silence a KASAN false positive Message-ID: <20200623084824.GB5665@osiris> References: <20200610052154.5180-1-cai@lca.pw> <20200610122600.GB954@lca.pw> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200610122600.GB954@lca.pw> X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216,18.0.687 definitions=2020-06-23_04:2020-06-22,2020-06-23 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 mlxscore=0 malwarescore=0 spamscore=0 cotscore=-2147483648 mlxlogscore=851 lowpriorityscore=0 impostorscore=0 clxscore=1011 priorityscore=1501 bulkscore=0 adultscore=0 suspectscore=84 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006230064 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 10, 2020 at 08:26:00AM -0400, Qian Cai wrote: > On Wed, Jun 10, 2020 at 07:54:50AM +0200, Dmitry Vyukov wrote: > > On Wed, Jun 10, 2020 at 7:22 AM Qian Cai wrote: > > > > > > kernel_init_free_pages() will use memset() on s390 to clear all pages > > > from kmalloc_order() which will override KASAN redzones because a > > > redzone was setup from the end of the allocation size to the end of the > > > last page. Silence it by not reporting it there. An example of the > > > report is, > > > > Interesting. The reason why we did not hit it on x86_64 is because > > clear_page is implemented in asm (arch/x86/lib/clear_page_64.S) and > > thus is not instrumented. Arm64 probably does the same. However, on > > s390 clear_page is defined to memset. > > clear_[high]page are pretty extensively used in the kernel. > > We can either do this, or make clear_page non instrumented on s390 as > > well to match the existing implicit assumption. The benefit of the > > current approach is that we can find some real use-after-free's and > > maybe out-of-bounds on clear_page. The downside is that we may need > > more of these annotations. Thoughts? > > Since we had already done the same thing in poison_page(), I suppose we > could do the same here. Also, clear_page() has been used in many places > on s390, and it is not clear to me if those are all safe like this. > > There might be more annotations required, so it probably up to s390 > maintainers (CC'ed) if they prefer not instrumenting clear_page() like > other arches. Vasily will look into this and come up with a proper solution for s390.