Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp6395929ybn; Sun, 29 Sep 2019 19:22:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqzzZJaw4AMUyvKQOvhAX2Mk7dufDyWjZsWgiL2Wwiyvy5KJ6KcGnADY15oUiYM3uFdr6A7Z X-Received: by 2002:aa7:c555:: with SMTP id s21mr17266121edr.151.1569810163665; Sun, 29 Sep 2019 19:22:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569810163; cv=none; d=google.com; s=arc-20160816; b=WiFjFT5ca4oLlZWHmKhslwCvFd5xcT1ZlY/3pcXBPpmoSmC7AomfcCUqvxuakK3T8T zdzDK7N84yKamjhQWw5fn+wFiuE7rTTOLubqgoBKitZWXtu6q068NmmFUZ/iaAQhPTEC t433gaq3ynCGDwBOkkf0Ruw298yac+GtZfg3BpQvZjCsbOmVsEiOKCyQ5S2FZMZRg8XC Mj05S1oLAbIL6jtLag9ygdDaPJekJ1pcDOz+M7UkCbIjcjUS0qpl9Rs424TNRr/pd8sT LdvTiKUKV42UxhnBF+c8USXQQzuNIWlh86pck9pJdbibyqBUHCl4OVnSmVsgbAeo95eW fhvg== 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:date:subject:cc:to:from; bh=sRtTgq+rES3P6NZuc11heg1/+tmfNS8MN2xDRzuQB2M=; b=a+NrcWjf1HSKSgyUlEPR9dhD2Crp6Y7Rjaqm6ghIFwcHiq4lJf+PwCANYODCBRKynT Ahs/UbdzkERkmQqevkkG8NsqIxK4LAIx3Qt7rl9jXbqv5v9WMzCPt4eyAYENUsM/+7MK E8YGMWc8qSQn4gwKoJDFxvcFn0uGcgiIPEpQwyizuFB7sHMkpF5VEtSw2Yphm87hfUmP k5WTyGABY6NSZFHXPfYSGpa4IHJqfc6jMhQSyaq32boRt1jcoUSvu7cN6IvAWomKX6v4 J4iiZzkjAjj5djJbaDmUT2XUGLVTrgOdZRhmv/gw1etfU4xQHBAKQthtC0S/Wl9XO+ZM LQxA== 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 e2si6093589edv.369.2019.09.29.19.22.19; Sun, 29 Sep 2019 19:22:43 -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 S1729329AbfI3CWO (ORCPT + 99 others); Sun, 29 Sep 2019 22:22:14 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:61720 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729010AbfI3CWO (ORCPT ); Sun, 29 Sep 2019 22:22:14 -0400 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x8U2LgC2093947 for ; Sun, 29 Sep 2019 22:22:13 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2vb2pbg5ck-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 29 Sep 2019 22:22:13 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 30 Sep 2019 03:22:10 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 30 Sep 2019 03:22:06 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x8U2M5Yp41418830 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 30 Sep 2019 02:22:05 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 853A9AE04D; Mon, 30 Sep 2019 02:22:05 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 322D5AE045; Mon, 30 Sep 2019 02:22:05 +0000 (GMT) Received: from ozlabs.au.ibm.com (unknown [9.192.253.14]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 30 Sep 2019 02:22:05 +0000 (GMT) Received: from adsilva.ozlabs.ibm.com (haven.au.ibm.com [9.192.254.114]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.au.ibm.com (Postfix) with ESMTPSA id 5F45BA018E; Mon, 30 Sep 2019 12:22:03 +1000 (AEST) From: "Alastair D'Silva" To: alastair@d-silva.org Cc: Andrew Morton , Oscar Salvador , Michal Hocko , David Hildenbrand , Pavel Tatashin , Dan Williams , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 0/1] Add bounds check for Hotplugged memory Date: Mon, 30 Sep 2019 12:21:50 +1000 X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 19093002-0028-0000-0000-000003A3D075 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19093002-0029-0000-0000-00002465F798 Message-Id: <20190930022152.14114-1-alastair@au1.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-09-30_01:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1909300024 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alastair D'Silva This series adds bounds checks for hotplugged memory, ensuring that it is within the physically addressable range (for platforms that define MAX_(POSSIBLE_)PHYSMEM_BITS. This allows for early failure, rather than attempting to access bogus section numbers. Changelog: V5: - Factor out calculation into max_allowed var - Declare unchanging vars as const - Use PFN_PHYS macro instead of shifting by PAGE_SHIFT V4: - Relocate call to __add_pages - Add a warning when the addressable check fails V3: - Perform the addressable check before we take the hotplug lock V2: - Don't use MAX_POSSIBLE_PHYSMEM_BITS as it's wider that what may be available Alastair D'Silva (1): memory_hotplug: Add a bounds check to __add_pages mm/memory_hotplug.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) -- 2.21.0