Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3424962ybt; Tue, 23 Jun 2020 01:51:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXM043/MMuc3dc1m5WjiXmbeAQqhTHNPupkczWtEhkz8cEYLkM0Mfl4XLpx127KmWNgB5m X-Received: by 2002:aa7:d64b:: with SMTP id v11mr10669111edr.381.1592902269224; Tue, 23 Jun 2020 01:51:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592902269; cv=none; d=google.com; s=arc-20160816; b=VvSlvflm88J905f5LhOyn6t+Ce6f0SbmjIr2KBnXzHofECdd8uUUBYVq7cqSKNZDg/ 8lrSeKvtdb/tPV8WAo9RKCSgzZLIJ+lMagJDJ8eVH2SkdNG8c7g7VGAcJKBRegtdSWy/ Si/Gi/zm8hnu6gRN91DJCT1f/31o7qU2U1s/Sx/GGm+BCDjOuVEZd0WdCzeeCxG/qAGm BFAqo4RBZFeEHesCB6zrtp3TR4yE232DH+GQ3b5SQrI2S/QcgfOokgAzHOMVePB+OKNy pURNN/xaJXqaZc3JqskIRrQFlqGr4I68nhDaKwurvZmgtcNPLLgJuDUSbjqeEIn7NQQi fCbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=hOFZROz1GcB3XE2yENNgVWLQ2R7fqOJ30/qeOXf9AQQ=; b=MbpOkfFzpwUz3FS0dRvlnRmyxAK4QCfxdvC4zbbN8LJi1+FlquYhNLuQOmZ20qc8F+ IavwDTaKubhN7UdzqtruLBuq3loAfg+9NovH1Cb5xSwxTXkXMDTolaza9HsoZkFBpXYk OarWqQcnj3pso8eGAb4A4uDc46p239aDHrbbn9B3oPQXaxE+EOoQBPBXiBS6pl+ihCXu gsIscXgf0hPDL4tEoKKLOprRtdw0qmQ3gwisJzY1BRBOTvzMvLAflsLJ/5E98pkMRlgi cHwnKii/NdP5/XBoEVR6ENKSh5MqhBakHV86UJZGN3ifDk0BJB/pmXSoJPV6y+/waFsi +hnw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id fi17si4041168ejb.724.2020.06.23.01.50.46; Tue, 23 Jun 2020 01:51:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731978AbgFWIso (ORCPT + 99 others); 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.