Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp936076ybh; Sun, 19 Jul 2020 03:40:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJys8B/5oxbColVwVUTIfnM9ZY7AG7GgV+5fNLX4IyCoXg2cB5pv1L1CLkbnoOZTDTH4nONC X-Received: by 2002:a17:906:c44c:: with SMTP id ck12mr16758632ejb.145.1595155220697; Sun, 19 Jul 2020 03:40:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595155220; cv=none; d=google.com; s=arc-20160816; b=UClJhIbd+gAz+I6Mv60aVvdBnYDxji/twyE2qekpvMMRwbNSnQV+vZkM+Dey4qnFse 4FxopxGYr5Tn9PXX53k4v4lr4HHlyyFK7wsK831ErCbaO0lrGmdJ2iL2vpK7v1R3+3FV 4BkWDQFCtFkeSJHeBlT8x4XLkKvyNcm7o9zGfI9O1rKu1cn6Q8BfL0mBoetrF70/Mdhk 5HC5boc6ZTB7wkw2M4fJDdFTG1R/BLY8/CMxdvWgtsB2ys6SBCjLOrBhfD328l9l0RK5 a3Y3uRWqusgGwJS8mVvuIAlqXddPFkIwn2Er32358R7lUXlSg5hWc2t+ntmVRqleFfqb 1iRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=+1ETd7aKPSpRrinlrpad4x5lxTm4WfHvh56U5uL7UPE=; b=KltSpPDjl7g9q/nfXNuBQu/sM4AFbeOKzGF5sgBGxSNkfUfZ80BLFXoboo0HHQFjIi tzOK/rfqQas7wEObHFBqoycK5Dx44yZnOwFPjW3BU5ctOjy67CD/5ZqcPnj8Cx7NaOpq Plolynd9UScIGXN5M1Y8hm8yGCO+iy8VWEhMq9bBdsI6GAkiaRHxe9aqciB+OwH5GgCc Aj7RfCXWSdYppelVHRx2sB6hGCQp5sT02lnQkxBXTmwyEKCHUYRoJq6VZuTs6Ryh9wiA 8l6BGnV8ZGj3vrxYX0HGXb2w0cmvNWUDPEa/pHi30RO+ADRZ1/C2ev1IYnSEjNYeZnyM etPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=d6AtfbNF; dkim=neutral (no key) header.i=@linutronix.de header.b=huyQWIPP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id co28si8599204edb.540.2020.07.19.03.39.56; Sun, 19 Jul 2020 03:40:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=d6AtfbNF; dkim=neutral (no key) header.i=@linutronix.de header.b=huyQWIPP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726024AbgGSKjr (ORCPT + 99 others); Sun, 19 Jul 2020 06:39:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725836AbgGSKjr (ORCPT ); Sun, 19 Jul 2020 06:39:47 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4486DC0619D2 for ; Sun, 19 Jul 2020 03:39:47 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1595155185; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+1ETd7aKPSpRrinlrpad4x5lxTm4WfHvh56U5uL7UPE=; b=d6AtfbNFQu5hSS7Hsnpx76Ie2zyZ++Geam3INRfD2YMGCgtSju6pFp3S6WHzz4VnWxndVN woj6+CT+PoqdxSlh6UWyp4xMLkYZolgwMozRx4PNQ1tOWujWCHRNgt8edNKE5IqnbjkAcD 1kJyzbL8TcpDoW1pMM6LfWIDxMCnqGHatAaKldR5CKz5R2s1tkOkLW1FSrMSxiwWRuBEjW pkxtZArpp9maN8wQ59qu6k0NnbDDT404XdbkWFz/GqLg1tPNSkQuflA8wngDel628wBZBg jyKLWpWM1wTADt3ZzwYN7roKT/2wzwarWemgNwoR9owB37KolR9YHp595nNJyw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1595155185; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+1ETd7aKPSpRrinlrpad4x5lxTm4WfHvh56U5uL7UPE=; b=huyQWIPP5mwxTRp2eJvw3UaEPGs6rn1ENY8RmBy7MM1jRBkeRMy51MVaCMohHQiiZe+0Pj D131i0zXBkXmphBw== To: Arvind Sankar , hpa@zytor.com Cc: Andy Lutomirski , Joerg Roedel , Ingo Molnar , Borislav Petkov , x86@kernel.org, Andy Lutomirski , Peter Zijlstra , Joerg Roedel , linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86/idt: Make sure idt_table takes a whole page In-Reply-To: <20200719023405.GA564835@rani.riverdale.lan> References: <0CEC6A66-FD50-4B6B-9521-A40E5B9DA10F@zytor.com> <7FB389D0-77D4-482E-8A21-8662DDB00268@amacapital.net> <0B7CF270-EC04-4907-821A-A01F24BEF156@zytor.com> <20200719023405.GA564835@rani.riverdale.lan> Date: Sun, 19 Jul 2020 12:39:44 +0200 Message-ID: <87pn8rokjz.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Arvind Sankar writes: > To repeat the commit message, the problem is not misaligned > bss..page_aligned objects, but symbols in _other_ bss sections, which > can get allocated in the last page of bss..page_aligned, because its end > isn't page-aligned (maybe it should be?) That's the real and underlying problem. > Given that this IDT's page is actually going to be mapped with different > page protections, it seems like allocating the full page isn't > unreasonable. Wrong. The expectation of bss page aligned is that each object in that section starts at a page boundary independent of its size. Having the regular .bss objects which have no alignment requirements start inside the bss aligned section if the last object there does not have page size or a multiple of page size, is just hideous. The right fix is trivial. See below. Thanks, tglx ---- arch/x86/kernel/vmlinux.lds.S | 1 + include/asm-generic/vmlinux.lds.h | 1 + 2 files changed, 2 insertions(+) --- a/arch/x86/kernel/vmlinux.lds.S +++ b/arch/x86/kernel/vmlinux.lds.S @@ -358,6 +358,7 @@ SECTIONS .bss : AT(ADDR(.bss) - LOAD_OFFSET) { __bss_start = .; *(.bss..page_aligned) + . = ALIGN(PAGE_SIZE); *(BSS_MAIN) BSS_DECRYPTED . = ALIGN(PAGE_SIZE); --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -738,6 +738,7 @@ .bss : AT(ADDR(.bss) - LOAD_OFFSET) { \ BSS_FIRST_SECTIONS \ *(.bss..page_aligned) \ + . = ALIGN(PAGE_SIZE); \ *(.dynbss) \ *(BSS_MAIN) \ *(COMMON) \