Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1181323ybx; Fri, 1 Nov 2019 18:10:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqyTFo7UoaiifRLItmI4fBcxiVsQswyp7z268ju0+TllEym37isr7Pxh0X4TIy8z4OcTE6Lj X-Received: by 2002:a50:ac14:: with SMTP id v20mr16059556edc.291.1572657026711; Fri, 01 Nov 2019 18:10:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572657026; cv=none; d=google.com; s=arc-20160816; b=uzTOTCdWpeRlNQlf5sOB+0qThXtOAg3YJ4CFMXM3dhVpN0/cU81pTQwYWChgZXvJg0 vkBKI408oC/pEFPS/LJCbG4X5LyybrKQ0tFpi6CrGFXrqnBaKaHp6WPdudlizcoeLeIC BZ/JcM8OGq/5y6rsHVZmY8iXRIyi7PeUKkRyCWyOt4eY7t/zauVzq0+RdJZOInbxh+od Tzl3gsQjS1Qnj9Q7x0Y44tY2vqhfu30i5fugyuvUI2AhcfTlfdOqYpwMV8kbnQjFmD9r IxFw6keFTmHmbVE04usfH7+fOSPPOy3QwgZUamiU+pULxyANIETjOUSQss7Bve9ry3Xt 2XyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=35lfXKNP4c2jItbhC4v/zSw7uQKT5Ot2fCGqJLJcm2U=; b=a/aKnY/XgCJYWr1uSjqLYWxZ39JMvKu2MZIAPlSurkrYzD4/PIP/d5aILSiMll76uu 87tBWXP7tq4youo3C5szrjweOIQB/MLiqjBii4/V832cPbHHBuxsenWh9AI9RDxavnTG 3o+cUNBDw3SFwuwjOtp5rWEcY4WHVudwksO8cyD6AWkGly9gwIIfizDHz3WZCVPQD9Iz Sv/Ju1K4yXIIcKDvcxSbRvSzwo5WLZdna0gWzKS7lLBYGy2h4dZrc03hokC0+5hJfQZe ZVipwb8Oo0J3ydXMVxqs2WOv6aHC743lyyLCfMUjfDcW52bQM3UQfXIOobrxUi3UW8TK 8pzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="BX68/OsL"; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j16si7199930ejb.364.2019.11.01.18.10.03; Fri, 01 Nov 2019 18:10:26 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b="BX68/OsL"; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727357AbfKBBJ3 (ORCPT + 99 others); Fri, 1 Nov 2019 21:09:29 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:40812 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726846AbfKBBJ3 (ORCPT ); Fri, 1 Nov 2019 21:09:29 -0400 Received: by mail-qt1-f196.google.com with SMTP id o49so15386033qta.7 for ; Fri, 01 Nov 2019 18:09:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=35lfXKNP4c2jItbhC4v/zSw7uQKT5Ot2fCGqJLJcm2U=; b=BX68/OsL2S+F0uc5QaciKM6oiownQVJ3FaAKc48nVqbRfWWJDuiME4X/sn+rFtGM26 Q4Zs0lB96EjXFzPlT9+dqeeR7sdDK3NMzGUdBE8enEE39oMykGD45Da0LQe35gt+lkJc 83dbWfy5D2sfleW4EWu75BSDgIlkK//X8/guJtUpq6XKqyQoEWdetFmQR/CObI1ZqePf cKjOe0WZ6q7RLBX36J+/2b1GIlyXEmEcEZXiCHhhKkBOw8cJ4vO0043JpdxdqoUYG1BE YgFoZrEHBLQjCrT4iQ9mvIE3Gq+0c4S2s3guH7kBa4zSU0nxZAY6ymcCkQTo5Xqp4HwD 7fng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=35lfXKNP4c2jItbhC4v/zSw7uQKT5Ot2fCGqJLJcm2U=; b=uaXAeOs1QNydb9AxX2In8v7Vk6IDqx8v8KJkOBht5uwPbnAD/KNZkT5JLwf/SELB66 tvJtPtJ8R+xGl8hDZnjvoCPNOqYU7ivR0/qo9RdEkfu+g2ad+mElryWJbxxhxTfNXvbY o3r7m9nKCKuiIEOC755LX3YXxTdaTAcc0I91sTb5Rqe9/wIkjOQW7u6cJbWKLuLTsXf/ GPHk8rdI3UIdq4C+GMB21N0BtiahQ06QRURCoifPe1Qgh2wAsIfCTWhLClRKiWnKU/KX /2GWESrvmtz6dm87Nndj93w417huAUp6+aLkJ+1jzohc0uijbT6CQROSg336T6ali/6Z N/lQ== X-Gm-Message-State: APjAAAUiXFPptcC7SgIvv6bR7mXEdiVLNn7zeplCT6MmVgSDTcawmyuD 4PRN4eBQF9K2C+6MKzNxmg== X-Received: by 2002:ad4:528d:: with SMTP id v13mr13051033qvr.214.1572656968418; Fri, 01 Nov 2019 18:09:28 -0700 (PDT) Received: from gabell.cable.rcn.com (209-6-122-159.s2973.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [209.6.122.159]) by smtp.gmail.com with ESMTPSA id i66sm4234340qkb.105.2019.11.01.18.09.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2019 18:09:27 -0700 (PDT) From: Masayoshi Mizuma To: Borislav Petkov , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Baoquan He Cc: Masayoshi Mizuma , Masayoshi Mizuma , linux-kernel@vger.kernel.org Subject: [PATCH v4 0/4] Adjust the padding size for KASLR Date: Fri, 1 Nov 2019 21:09:07 -0400 Message-Id: <20191102010911.21460-1-msys.mizuma@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Masayoshi Mizuma The system sometimes crashes while memory hot-adding on KASLR enabled system. The crash happens because the regions pointed by kaslr_regions[].base are overwritten by the hot-added memory. It happens because of the padding size for kaslr_regions[].base isn't enough for the system whose physical memory layout has huge space for memory hotplug. kaslr_regions[].base points "actual installed memory size + padding" or higher address. So, if the "actual + padding" is lower address than the maximum memory address, which means the memory address reachable by memory hot-add, kaslr_regions[].base is destroyed by the overwritten. address ^ |------- maximum memory address (Hotplug) | ^ |------- kaslr_regions[0].base | Hotadd-able region | ^ | | | padding | | V V |------- actual memory address (Installed on boot) | Fix it by getting the maximum memory address from SRAT and store the value in boot_param, then set the padding size while KASLR initializing if the default padding size isn't enough. Masayoshi Mizuma (4): x86/boot: Wrap up the SRAT traversing code into subtable_parse() x86/boot: Add max_addr field in struct boot_params x86/boot: Get the max address from SRAT x86/mm/KASLR: Adjust the padding size for the direct mapping. Documentation/x86/zero-page.rst | 4 ++ arch/x86/boot/compressed/acpi.c | 35 ++++++++++++--- arch/x86/include/uapi/asm/bootparam.h | 2 +- arch/x86/mm/kaslr.c | 65 ++++++++++++++++++++------- 4 files changed, 83 insertions(+), 23 deletions(-) -- 2.20.1