Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1260288ybl; Fri, 30 Aug 2019 14:50:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqyPKD0cfhUqLsq+b/BN/P45+wk20OOncR5SXtbr7ZS2Q8247BjtwweFEU1icBSuIiJjdQ+K X-Received: by 2002:a17:902:426:: with SMTP id 35mr18181858ple.192.1567201841919; Fri, 30 Aug 2019 14:50:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567201841; cv=none; d=google.com; s=arc-20160816; b=Z8MDoMPm6YHjqb/Xn4GttbFIbvYBvYqzhtjHAuKv/sdTERXxDZMiXzMU7u/5PJeSxx Xg1e0smvByjgdAdSRSrYfd0T9e9EsUNTDenHU6tjz1lfXObiyTJi0LeGKvN9FSsclzXN QLbTbgJCDz6iV0VLRE0W+8KzDBinanxoaFka65F2QodHTUSobFZNGnIszsAE2uysQBOM 5ta4mgHmV1VgxnLu3KjZb02QZGke+TIlovZWkuEf0RgbJCaUKN/2aQZcdk6gMN3Whysn 399RneNRyuAB5Av1CNAQ8lxzFpWwe/b6SLXjcCBwlLymtkPeY6Xc57K7ZJzAQcOpVObW XF7A== 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=AsFuNuPXHxPU1debd4Sg6mOdtNgPuHaXYSxsCnsbb+4=; b=IRSFDmaI8ThXpe90Gwat9rI413qN1muWKuFwL4rbpIHx41z/mYZAS4W2E23iMVFIfd m7lMLlsx4waGYQg+a2P2oZq1E5E4zkNIPfClSjBt+HGv4ru1eWHe/x3z3VUyHfkW+8bR vTs1zSMCe0DgKlH+SaXnqnlESgqdpV4iaLQ879z8uV4qHpnhD829kZqNNnqcKL+RXuXx TP43ipMgOmbeWezOaBn4g9f8t4OIz3ApYnDBrEYaK0Bd38vqzIwZ4/FElP4nz+Je2Opx 0ZC9OLJBIGILTEOOmXR2SynLv5ZHLy/6ay9y72YdroQt6Ln7iJ9Qikm5NW5hJBpkhRCI qrzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gFVF9++0; 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 l35si5646164plb.322.2019.08.30.14.50.27; Fri, 30 Aug 2019 14:50:41 -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=gFVF9++0; 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 S1728342AbfH3VsA (ORCPT + 99 others); Fri, 30 Aug 2019 17:48:00 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:42747 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728122AbfH3VsA (ORCPT ); Fri, 30 Aug 2019 17:48:00 -0400 Received: by mail-qt1-f196.google.com with SMTP id t12so9245186qtp.9 for ; Fri, 30 Aug 2019 14:47:59 -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=AsFuNuPXHxPU1debd4Sg6mOdtNgPuHaXYSxsCnsbb+4=; b=gFVF9++0hexcCjd326zgHyxCem+GBTjabZ/1tW+ufKNXHau0zJez0dB8VC37fhJxrm +LcizIU0hZ/f0vCxGIqO/kQhbNFIa6YVTtE6bywAEjjxdIGOrCBEoINugeF6A80dQP7w WviSQYIY7P9w77VJg2op1icPo1DUiK2rvOzlo5E5nP8ZhvEDqwEL6//S16iBylnXnBMy VWlX7vvebER1jRRm2lYoTfcEx7Jy1fwXBWGOeeEMiGjB1LxpICURj4mVZyOjobQtZpAF YRN7oih+A5lP7zsyVkbLsUVIAb81ZjTUNJmoOb6k7QuCV6GT+WRccvG5lvzbE3tHbfpE ixuA== 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=AsFuNuPXHxPU1debd4Sg6mOdtNgPuHaXYSxsCnsbb+4=; b=bngAXJ1T+hPtT6CDLk/ALdxHdTHHBPMgH3/IkIMV5YXguG+wM/D7PxhYYI+7YX3BW6 ZD+qeF8Kb1lHDOk2pRX5ylR3Nd9ZCg1N1kD13YLoaIjb3CF/leApeD3Ke4fnNe/knL8g +Jj8gKRSaG1rutbWzkn8UH31kng/Fhwc9uaJQDNrCoo0QEVy/ZeIJB6V4f05l+Va5Qz6 7f3X+KcFaJ58O3D6jlUBjy9ld4rf7kEPJhWB596Hp5cte4m1gb3LRxyKMVCObi/86k0K oiHia/giei/o83rv/tdTztUEnM1u6TWSJbtGfuJ4XzX0bppVaKc+thys4S85aqDdQSyS aNww== X-Gm-Message-State: APjAAAWj4KzQUy9MdqQGZSebz/km5FQiIumrJ/9LsVdXf5w+gvXZiMnw WgQ35wRp+AJFGP0vNXYevA== X-Received: by 2002:ac8:1848:: with SMTP id n8mr17493634qtk.147.1567201679503; Fri, 30 Aug 2019 14:47:59 -0700 (PDT) Received: from gabell.bos.redhat.com (nat-pool-bos-t.redhat.com. [66.187.233.206]) by smtp.gmail.com with ESMTPSA id a4sm4857834qtb.17.2019.08.30.14.47.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Aug 2019 14:47:58 -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 v3 0/5] Adjust the padding size for KASLR Date: Fri, 30 Aug 2019 17:47:02 -0400 Message-Id: <20190830214707.1201-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 (5): 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: Cleanup calculation for direct mapping size x86/mm/KASLR: Adjust the padding size for the direct mapping. Documentation/x86/zero-page.rst | 4 ++ arch/x86/boot/compressed/acpi.c | 33 +++++++++--- arch/x86/include/uapi/asm/bootparam.h | 2 +- arch/x86/mm/kaslr.c | 77 +++++++++++++++++++++------ 4 files changed, 93 insertions(+), 23 deletions(-) -- 2.18.1