Received: by 2002:a17:90a:8504:0:0:0:0 with SMTP id l4csp4876750pjn; Tue, 29 Oct 2019 08:59:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqx1eAi+UDqLWxFrIG73xkgg5RoIbryWvNnNLe1sZVwaz1+aMw87JxexLr6AG4k9fQ6mjjHO X-Received: by 2002:aa7:d95a:: with SMTP id l26mr17131730eds.12.1572364769704; Tue, 29 Oct 2019 08:59:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572364769; cv=none; d=google.com; s=arc-20160816; b=FINv0v38zxESROWosKLdfrnWj+Hx9Qpyfo6vx1qrE+XXLHzMteev+xlTIGpqSwLvGK Bmx8iANnLjVoouTJdqpymf5kPI/yuI3wCxppRu643/iWZ/FqtYWw6NFqHHKU3FIhgmxl cGTx805xyfQgjoc9rLU5v/6l63W7GVvg0TY7GrkjlipCx7LWypSqoQbeizSsjUoiyFeN WmAa4US3dSKvS41qsaF6XiRTaM4H8LYBEDeTVVNOKBIYdRVNzwI4YLo27RmknWr2iILX KEPRF5ZvXFECwAySYSGNXgFrK+bpPUlA24YLMdkeOpsXAd/qHGSYSltD1RrVbvZXBL4g 3JPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=DM3O9N7/77ihd4L+w4LGNt2vkA69HpxTL+DxOwueRJA=; b=a95OOB8//jgTJeYjjLMvT/HgK91MMXbIw5/BIC7O4tt6kw75eyZO9wjnw4IrieArVw 7zPwUPKt7e3CqCEohnBc6UaDVk77HYc1RyoSvKVB++U+eX4PrJ4ik6HikumblyI2Au2d 8hg40A8oO7okDLe2vt2/vhBIbPnYmoLLPaLvr9lzi5Ny62gc5csJAk4t8wQcHBCootki P4wHXVaah41Qb5TowFsrOLvrPtE8fkv8Vm74azjZ1/jbxWeMr7J+D7V132CsdTBvn2Vy Bxjg/Zts6S6Re587WMWS/DF0WVBSmPjjfEzjBdVureGYLu0wu5htFThs4sq+3x5ur37l AgBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=b6BnbfJ+; 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 y22si8582932eju.150.2019.10.29.08.59.05; Tue, 29 Oct 2019 08:59:29 -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=b6BnbfJ+; 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 S2390165AbfJ2P6M (ORCPT + 99 others); Tue, 29 Oct 2019 11:58:12 -0400 Received: from mail-qk1-f195.google.com ([209.85.222.195]:46736 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389319AbfJ2P6M (ORCPT ); Tue, 29 Oct 2019 11:58:12 -0400 Received: by mail-qk1-f195.google.com with SMTP id e66so12715002qkf.13 for ; Tue, 29 Oct 2019 08:58:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=DM3O9N7/77ihd4L+w4LGNt2vkA69HpxTL+DxOwueRJA=; b=b6BnbfJ+LstWB3B2qxirYa9kEcyXhpRBPyALY88QBrlZNUCGlaws1nvgAEUIrgIY/C LP0k+/CEbT7pYXip6EoZ6qLf/Qb03UpnXcyOgbjKZPC9tALl+VU0NVAEJHcaXVtgyxD+ LE+AZHifsnSXuk0bdlkrnhXtvOPnf8b7cGVhibJC6tcttvPKBYC0JZO32bhlWouFIDH8 smsvbZFgkzwV4H5WIK67VtuKp9VgMm18lVuZRqe6lpFxTa3mpPlRUK+tIBSSyMVDHJTB ObvyAviTEnuTCHLVqpLQ8Y6/72dPBYyG1aT9Z+84gsmQgxfZNOG1menHWqyoYCaBO/Qi husw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=DM3O9N7/77ihd4L+w4LGNt2vkA69HpxTL+DxOwueRJA=; b=eraEeNETSu0B82Qc39YpBKmVVYq7RTRAp/7KK8p4yrbZAwYnG9xZgFKNxWqJXmiwuf 3NMmVUimoeAsqnnxzCcYSrDHaJTPFq1TeeZSXmxOfdDuyoeQqar/9TOKWlKdPDds9iJ9 WGf60W8EtWfxRHoroZVLSbe3jDG/Y3SHs5FRGKGLQns3mcms/PdJ1SPJnYotHEXmVu65 U58GVgFJQaF52jkiY2ZjKArUN1hUJJi4VJdjEWoNqKcEmphblDIJuE0JzdEvdGTliHCN u+YMScm9eA6jCU2jaDymGPBiAdQhx+8fM/p4vnlnrjZfcRE3VY4vskwEVl09Iwox1EHk xIIw== X-Gm-Message-State: APjAAAVZtbefHaHfgSmA5TK1xNZqkHiIzOVy4IONigWOEcOzlhoAHL9L yDop2eDwCj6VtvwhHykesQ== X-Received: by 2002:a37:9442:: with SMTP id w63mr21600482qkd.138.1572364691121; Tue, 29 Oct 2019 08:58:11 -0700 (PDT) Received: from gabell (nat-pool-bos-t.redhat.com. [66.187.233.206]) by smtp.gmail.com with ESMTPSA id x38sm9991789qtc.64.2019.10.29.08.58.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Oct 2019 08:58:10 -0700 (PDT) Date: Tue, 29 Oct 2019 11:58:07 -0400 From: Masayoshi Mizuma To: Baoquan He Cc: Borislav Petkov , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Masayoshi Mizuma , linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 0/5] Adjust the padding size for KASLR Message-ID: <20191029155806.gryhjwentwpyqmt4@gabell> References: <20190830214707.1201-1-msys.mizuma@gmail.com> <20191029025920.GO8527@MiWiFi-R3L-srv> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191029025920.GO8527@MiWiFi-R3L-srv> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Baoquan, On Tue, Oct 29, 2019 at 10:59:20AM +0800, Baoquan He wrote: > Hi Masa, > > On 08/30/19 at 05:47pm, Masayoshi Mizuma wrote: > > From: Masayoshi Mizuma > > Any plan about this patchset? Thank you for pinging me and so sorry for the delay. I'll post the v4 in this week. Thanks, Masa > > Thanks > Baoquan > > > > > 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 > > >