Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp5046156ybe; Tue, 17 Sep 2019 01:28:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqz/I7RwBmKO9SXGljs2S47Z6TO9aXLczikn8iklgAsBCR6GLPlZpYv3KC8bfucDnGs4qiP8 X-Received: by 2002:a17:906:48d4:: with SMTP id d20mr3679608ejt.84.1568708926081; Tue, 17 Sep 2019 01:28:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568708926; cv=none; d=google.com; s=arc-20160816; b=Qr1XWq65PFxEZeFjNdZlEdgGo73D1dlX169LJZlOXSd+/RHpGMYK7gxIh3lBdevcvD JJ87d94scym6AIOb8EWtQ7MAUVQCLq68j0+4Jg6RNkqHMHFu0kr9v3LMy4N0irQqlNLl U82eRQBf87f+ev2cHvBirWJ3n3MEf5xPNK7YyObs5FamlXYRm2o4y04nUFtnQMS9c8m6 sm/SKX7p9jaQZcGxSbt/0P90boUcuKGMSP2X1ymLB4oW93jegPKkDHxDoYl2p8D3aVAf cc6Ed5/Z/m2fKrCIZSm9P+YlSQNb9WvVynGeo9Fs3Us56L7/FBYjrS4TGBYAudXrC3/u 8PHA== 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=Gr4bQdQRrIQKDHPOi5nbQawifNqivgqp/r1ZbKfKa2U=; b=TnirqmP3VLRKP3khCvX2dlVNGkfzvLmeyvhRIiOkIBKSOkGYpCxMKVjAyJkhUcojcQ dJPHdkzWjLcxoVxJrF68W2bA+N6tkuSnGIVSLsC0yRpBL+nbpcYRgKLpyoI5xv+iK57K fg24WgQBAyM7xu/GLOUhR3v+4UB7/PN7yOPX41Bg1SK/UFpnZ22e8paNez3RUliNbiYs dCK4RUE6lswvCZ2qaGmMrvvlzVJHFN+2c0D/bqLhkJEV72w9AONDd2hz6GpL7BYHdGK8 3CJY0/o+KfEFNw4iMHfjXTBY6rM7ahDi1O1jFggXyeo4FwmrIUO282mNTZzSz+a+PhMD ELEg== 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 u11si708669ejr.234.2019.09.17.01.28.22; Tue, 17 Sep 2019 01:28:46 -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 S2388419AbfIQBIf (ORCPT + 99 others); Mon, 16 Sep 2019 21:08:35 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:11090 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728127AbfIQBIe (ORCPT ); Mon, 16 Sep 2019 21:08:34 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x8H17cfU013794 for ; Mon, 16 Sep 2019 21:08:33 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2v2kfeu8br-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 16 Sep 2019 21:08:33 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 17 Sep 2019 02:08:29 +0100 Received: from b06avi18878370.portsmouth.uk.ibm.com (9.149.26.194) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 17 Sep 2019 02:08:26 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x8H18PQ246858652 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 17 Sep 2019 01:08:25 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D915511C050; Tue, 17 Sep 2019 01:08:24 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8DEFE11C05B; Tue, 17 Sep 2019 01:08:24 +0000 (GMT) Received: from ozlabs.au.ibm.com (unknown [9.192.253.14]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 17 Sep 2019 01:08:24 +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 3467FA019A; Tue, 17 Sep 2019 11:08:23 +1000 (AEST) From: "Alastair D'Silva" To: alastair@d-silva.org Cc: Andrew Morton , David Hildenbrand , Oscar Salvador , Michal Hocko , Pavel Tatashin , Dan Williams , Wei Yang , Qian Cai , Jason Gunthorpe , Logan Gunthorpe , Ira Weiny , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 0/2] Add bounds check for Hotplugged memory Date: Tue, 17 Sep 2019 11:07:46 +1000 X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 19091701-0008-0000-0000-000003173CB5 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19091701-0009-0000-0000-00004A35B80A Message-Id: <20190917010752.28395-1-alastair@au1.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-09-16_09:,, 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=606 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1909170011 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: 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 (2): memory_hotplug: Add a bounds check to check_hotplug_memory_range() mm: Add a bounds check in devm_memremap_pages() include/linux/memory_hotplug.h | 1 + mm/memory_hotplug.c | 13 ++++++++++++- mm/memremap.c | 5 +++++ 3 files changed, 18 insertions(+), 1 deletion(-) -- 2.21.0