Received: by 10.223.164.221 with SMTP id h29csp524584wrb; Thu, 26 Oct 2017 02:26:58 -0700 (PDT) X-Google-Smtp-Source: ABhQp+Rh+4H5cqqM7h9n1MBkH2jookkZ9zENY7faloEyfH+pfx4ngo1FApj42EKFv65pDAv+LyZ3 X-Received: by 10.99.157.133 with SMTP id i127mr4547718pgd.204.1509010018359; Thu, 26 Oct 2017 02:26:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509010018; cv=none; d=google.com; s=arc-20160816; b=Edj0wAhoPw1rcMvdzuB528azVBSiAa2moCKY22tXrrtjX/Xx2KeJFpzR1M8z8AbYul U1nw+Gg4nwg43TOarQMospyWeXCJjcAF72kUvh0JnfMBvvMVUqQQo3L3fwePQFTdi0OP BNAQ4jVHb30qX5IXWCKi9Mm37BqWYDWW55goRrqPOqoQbDm+XiGaOvryU6A58iOS7OSR KPkUlrq3qNK1ljwFjZIyNzpv+t92YFBPwM/nDJ1PT9hDpH7bFqNjJJzzvm24snNcjIah om9jwvxvApF5ZCnrA+IvaHyYDQ6DYegH5e011TTollrYJnsvjPuhgGYVci+G0fC9Z1fX go+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:references:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=ICbRkMTB4a3oelkJZ6ayR9X8RJo/PWpaKHjAw3YJM+c=; b=d/qLB9Ak4ZZatczyPxd9/jpSgTkfA4l9zQMjdIDoNSpl81VrVCZv/Ovi3BgV+cKNVq kM+KLbV3FsnPlqCxntrXV7A6pC2FSSP6fhmwgX1O+vqyauer93fF0XzuCBNE2kPXaQPi BPDVy3kCK9wKQlmSysQTVWTclwxVdEp1rdyq/xmuzkE/fUsJVPCOG7EFvBy+9vfv8Kpk xBbFXTOVMgRDdHdvF45IAYLNU7uJerBjnvnqRanFH3rSfvOYGtDKFpq2f9QZkqF6q6kn kmwxsS03SmmrKxdx7EtfI4FkEcWglkzaIjC5LFcr/dedPq5up+zmT/bEqfIVX5xM18jZ gL0Q== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b5si2731791ple.688.2017.10.26.02.26.43; Thu, 26 Oct 2017 02:26:58 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752021AbdJZJ0R (ORCPT + 99 others); Thu, 26 Oct 2017 05:26:17 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:36084 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751027AbdJZJ0M (ORCPT ); Thu, 26 Oct 2017 05:26:12 -0400 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v9Q9Or4k024121 for ; Thu, 26 Oct 2017 05:26:11 -0400 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0b-001b2d01.pphosted.com with ESMTP id 2dud0308ps-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 26 Oct 2017 05:26:11 -0400 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 26 Oct 2017 10:26:09 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 26 Oct 2017 10:26:05 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v9Q9Q5AL20119686; Thu, 26 Oct 2017 09:26:05 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2A2294C052; Thu, 26 Oct 2017 10:21:42 +0100 (BST) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DF2B74C046; Thu, 26 Oct 2017 10:21:41 +0100 (BST) Received: from mschwideX1 (unknown [9.152.212.220]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 26 Oct 2017 10:21:41 +0100 (BST) Date: Thu, 26 Oct 2017 11:26:03 +0200 From: Martin Schwidefsky To: Li Wang Cc: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, heiko.carstens@de.ibm.com, mingo@kernel.org, hughd@google.com, paul.gortmaker@windriver.com, mhocko@suse.com, shuwang@redhat.com Subject: Re: [PATCH] s390/mm: return -ENOMEM in arch_get_unmapped_area[_topdown] In-Reply-To: <20171026073610.9139-1-liwang@redhat.com> References: <20171026073610.9139-1-liwang@redhat.com> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 17102609-0040-0000-0000-000004070ABB X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17102609-0041-0000-0000-000020A97EA5 Message-Id: <20171026112603.7c095ee6@mschwideX1> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-10-26_02:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1710260130 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 26 Oct 2017 15:36:10 +0800 Li Wang wrote: > That would be very hard to get -ENOMEM returned in crst_table_upgrade() > because the condition(addr + len <= TASK_SIZE) makes all 'end' value > is smaller/equal than 'TASK_SIZE_TASK'. So let's move it to the upper > layer. I have a hard time understanding what scenario you describe. There is no 'TASK_SIZE_TASK', only TASK_SIZE, TASK_SIZE_OF and TASK_SIZE_MAX. The code in mmap.c checks for the per-task limit, 31-bit vs 64-bit. pgalloc.c checks for the maximum allowed address and does not care about the task. > Fixes: 8ab867cb0806 (s390/mm: fix BUG_ON in crst_table_upgrade) > Signed-off-by: Li Wang I don't think this patch fixes anything. > --- > arch/s390/mm/mmap.c | 6 ++++++ > arch/s390/mm/pgalloc.c | 3 +-- > 2 files changed, 7 insertions(+), 2 deletions(-) > > diff --git a/arch/s390/mm/mmap.c b/arch/s390/mm/mmap.c > index 5bea139..8ddb13a 100644 > --- a/arch/s390/mm/mmap.c > +++ b/arch/s390/mm/mmap.c > @@ -119,6 +119,9 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, > return addr; > > check_asce_limit: > + if (addr + len >= TASK_SIZE_MAX) > + return -ENOMEM; > + > if (addr + len > current->mm->context.asce_limit && > addr + len <= TASK_SIZE) { > rc = crst_table_upgrade(mm, addr + len); > @@ -184,6 +187,9 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, > } > > check_asce_limit: > + if (addr + len >= TASK_SIZE_MAX) > + return -ENOMEM; > + > if (addr + len > current->mm->context.asce_limit && > addr + len <= TASK_SIZE) { > rc = crst_table_upgrade(mm, addr + len); > diff --git a/arch/s390/mm/pgalloc.c b/arch/s390/mm/pgalloc.c > index 05f1f27..5e4b887 100644 > --- a/arch/s390/mm/pgalloc.c > +++ b/arch/s390/mm/pgalloc.c > @@ -84,8 +84,7 @@ int crst_table_upgrade(struct mm_struct *mm, unsigned long end) > > /* upgrade should only happen from 3 to 4, 3 to 5, or 4 to 5 levels */ > VM_BUG_ON(mm->context.asce_limit < _REGION2_SIZE); > - if (end >= TASK_SIZE_MAX) > - return -ENOMEM; > + > rc = 0; > notify = 0; > while (mm->context.asce_limit < end) { -- blue skies, Martin. "Reality continues to ruin my life." - Calvin. From 1582304768297398323@xxx Thu Oct 26 07:36:58 +0000 2017 X-GM-THRID: 1582304768297398323 X-Gmail-Labels: Inbox,Category Forums