Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp4574669ybc; Fri, 15 Nov 2019 06:51:35 -0800 (PST) X-Google-Smtp-Source: APXvYqwzeJKUaRG/MtE1fJqgADBHhcvE1RpmnbvEuhqTmN4RBnz/1pHQbH06l3ty3cFeDLBiWwfM X-Received: by 2002:a17:906:11cf:: with SMTP id o15mr1499193eja.208.1573829495803; Fri, 15 Nov 2019 06:51:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573829495; cv=none; d=google.com; s=arc-20160816; b=luwmj4ycDACWOR8LaWdmhn2FLF6rETnWVsB3TIBX8A/tCw0SsMSVXA8mRnX8FVmSpa cWiFiMYRx/Hz5PHzlrYFcD8r7/8F68IJLEZILCNqo2U97QLFSmAOwqbXTsnj5edYLbEn sa1nSfnlZb5HG+8LGwCJk96hnljcI3rA7hu1t+6Q5dZsycQEIuVLic4zW1STdHdwsVaq 88fZ2l0C3Qw3pU+fprP3ysP6f5FSvePeIlOdWk+vDuHrh2RrN4agjTaRrFET7gzugeU7 4YfDjHqDY5pBN3yak3oy+6SUoqoAlh/CwfjOvZxyaXJ7PrxXSozdorD72eg/HJNS3/3M 0SuA== 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=K3gZuaX72+1R2YBKWM0XR/k39YkPNf3E8LIgGu5FJuc=; b=rsP+vaTlReZTl0HJhLZfQwRZCOVMkU39DjgRLWbZbJHzrI/BxJc3hAub6M3dfBYV8v fE/z2HLzZkGRxl0ur0dF5jwUAyg3AWrU+xD/bU7faF26afdLHH87yFx2xBdHsKyF18kC GhFT62lvI00HpG/NpiYjdECmR/AmMy8dtQe4gFeTkr565MsfmkwiywUwjHHlGs6S5AfH Ht4v+QxcC5nc34/FIkw1teQwpX4qMdehYFStVO/jkgs5ZYlhiZeBLg0pxQeWoLRfVODF yV1FlcYG8uDLssgRfR4q5XTxTBUw7sfdYaOAsWVhGJHX048GHCY/BXXHWrFbvahpNYL9 +/Tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PBz9HlXP; 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 p13si5782436eju.398.2019.11.15.06.51.10; Fri, 15 Nov 2019 06:51:35 -0800 (PST) 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=PBz9HlXP; 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 S1727539AbfKOOuJ (ORCPT + 99 others); Fri, 15 Nov 2019 09:50:09 -0500 Received: from mail-qt1-f193.google.com ([209.85.160.193]:39389 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727380AbfKOOuI (ORCPT ); Fri, 15 Nov 2019 09:50:08 -0500 Received: by mail-qt1-f193.google.com with SMTP id t8so11064001qtc.6 for ; Fri, 15 Nov 2019 06:50:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=K3gZuaX72+1R2YBKWM0XR/k39YkPNf3E8LIgGu5FJuc=; b=PBz9HlXPcfyc723unGRGy53EYrXDu5sl8wtwgcM1SDoj8HBR7wWC08IYQV6YTIrzv1 meuPonDIPUxqZL95KskO4RuW9vRFtij5xoFuegZ365R5bfvdTMHw6QQSRXUREo8DRJMn PPCqyoLj3iY46msN24Yz/3VN0SiTtJjpID4zrRL9CiBWvXZRm6M0fVBwZnf8yGtP230z 4BRYfvyfqd3v7qJSp2GQ7LOL2+bjWgeA936EPTPWTxys7R0hUccemNwort2Ev5suxpdn vguMJNZNSRo+om+U53NEkS4KepzNzSR5DpqL1iSxfoiyaoGOmbolt+ULaKkiXsz0E8kG R53w== 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=K3gZuaX72+1R2YBKWM0XR/k39YkPNf3E8LIgGu5FJuc=; b=hIcwZFqL0UEc4Hv9f5wBpJN/uowC/7lEFihVjGxNQoKv/vUb7HyZx9hiXf5fT+2fta PTpI0+8wZrVXr4RDRfQEwLdXH9J105dOgh3xjJnlykmatNw/FmLdHN9UsXVZQ7EjQc+8 ZqyGw45E3CkQ0hHHsgje5kLbBu2yFUBG6TD+mREkD8tYOZIrkJ7459pvxLXrzLVURnLS ihJThNuCroOYv4oXoNYHfEbJkxhBvD0M+DnBI83jjE8lX/QW6iUjTfrxyJ/9pPbSvkEg iOc7znQEB9BcIJgsiALNgZTDe9yDSyTfLl8JC9zOK8SVJYWGNS4SCSeo7Frg/oA8/wLL vA6g== X-Gm-Message-State: APjAAAVGIPAC6BgoFDGupujZjY7aDCAiCkOjd0XlT5aHMmZpVP9QtUav vV0kbv5kiGjsw+j1E9UA6w== X-Received: by 2002:ac8:ecc:: with SMTP id w12mr14134847qti.134.1573829407686; Fri, 15 Nov 2019 06:50:07 -0800 (PST) Received: from gabell.bos.redhat.com (nat-pool-bos-t.redhat.com. [66.187.233.206]) by smtp.gmail.com with ESMTPSA id l124sm4329317qkf.122.2019.11.15.06.50.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Nov 2019 06:50:07 -0800 (PST) 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 v5 0/4] Adjust the padding size for KASLR Date: Fri, 15 Nov 2019 09:49:13 -0500 Message-Id: <20191115144917.28469-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 | 42 ++++++++++++++++---- arch/x86/include/uapi/asm/bootparam.h | 2 +- arch/x86/mm/kaslr.c | 57 ++++++++++++++++++++------- 4 files changed, 82 insertions(+), 23 deletions(-) -- 2.20.1