Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp5855365imm; Tue, 12 Jun 2018 14:40:59 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIOsiJjX9+r7D3+kl6pRLALoAz0Gdj9F6FTfd03FUvBfXpb087c034oh+fy0wagG20i0bH7 X-Received: by 2002:a17:902:6a89:: with SMTP id n9-v6mr2199258plk.302.1528839659897; Tue, 12 Jun 2018 14:40:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528839659; cv=none; d=google.com; s=arc-20160816; b=qDWVViavxgMpOJEFORz/5ueS/GpeIZNuNgvwcPrjTv34RtqRyLiF4lhVuWODJGm0ZA GfnAzlL0D45yFmIszAeD227IAXhEcSwJMAcaOpc3Jdo7ScoPutC9mUC/YJ13KsNbSNTH zjSgfjQJoKxYGoRMSmo2kGLPIhf8eOIPx59PAHK5R6uE1tiUpxqA5OqOJSJwAkaJ7Cb+ 3y8nVhUdR+P4U/lEodm2pw/W+R8klETv9C0J55nJ/uLV2nHEmk4TzF58BoWmgp42FORJ KVooyNljjtu8SSr8GBbNozNaf6SzHHu6Wwogito7M9BPmU0ejLxXCHENUAuB0yBPCx8o 1KIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=illXfod9KDO42ItOH3opNNeDLQnejEdQdAriHc5+hPM=; b=PMjj8EKC8ihBkmg/u2jF8+OY3bnLy0+mSKSX9Gw3wG/m+WUq05CchkmH3TP2vIW4pJ 2QwhhYxxYczscxAUvHBH4JnR6Y7aF8k+ouTpJOVRt+JSavAl6b7LJVeGKwJJxEKf9cuB gEwE63zAYjBjuMTzP5f6mZREofW8rN+nDBPnnye6nfsrlFWWXdjGMz8Qrtl0WDZMnmjQ 1UPxL+yzfRvQr4i+xsPnTJ68Iy+b+pV6wOoDYe5ydlh8W6bZNoPpGWrI2evenwdkuLYA MMluRrSGsaYKDAHzvQ88CzShYHfvywxCg3shCrBwngRJ5Fuhh2YwN6DKl8ASRAw4CwmB GB8g== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q69-v6si1019445pfj.51.2018.06.12.14.40.45; Tue, 12 Jun 2018 14:40:59 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754405AbeFLVjT (ORCPT + 99 others); Tue, 12 Jun 2018 17:39:19 -0400 Received: from terminus.zytor.com ([198.137.202.136]:36811 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754325AbeFLVjS (ORCPT ); Tue, 12 Jun 2018 17:39:18 -0400 Received: from hanvin-mobl2.amr.corp.intel.com ([192.55.54.41]) (authenticated bits=0) by mail.zytor.com (8.15.2/8.15.2) with ESMTPSA id w5CLd32O180626 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Tue, 12 Jun 2018 14:39:04 -0700 Subject: Re: [RFC] x86/vdso: Align vdso after searching for free area To: Dmitry Safonov , linux-kernel@vger.kernel.org Cc: Andy Lutomirski , Borislav Petkov , Dmitry Safonov <0x7f454c46@gmail.com>, Ingo Molnar , "Kirill A. Shutemov" , Thomas Gleixner , Vasiliy Khoruzhick , x86@kernel.org References: <20180612204948.4752-1-dima@arista.com> <1528838651.26829.69.camel@arista.com> From: "H. Peter Anvin" Message-ID: <6d53a9e3-5776-1073-a5ae-60d50db3e467@zytor.com> Date: Tue, 12 Jun 2018 14:39:03 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <1528838651.26829.69.camel@arista.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/12/18 14:24, Dmitry Safonov wrote: >> >> Move align_vdso_addr() after get_unmapped_area() to make sure that >> errata for AMD 15h is always applied. > > Alternative dirty-hacky idea: > specify some (struct file*) to get_unmapped_area() for vdso vma, then > mapping would be automatically aligned. Dirty as hell as relies on > get_unmapped_area() realization details. > I have mentioned several times that I would like to see the vdso actually be an actual file in a filesystem, that the kernel *or* user space can map (needs to be MAP_SHARED, of course.) The vdso data page needs to be moved after the ELF object itself for this to work. Ideally it should be given an actual ELF segment (and ideally an ELF section as well.) The easy way to do this is to give the linker a dummy vvar page as a properly aligned section at compile time, into which space the kernel can map the real vvar page. The only downside is that the linker likes to put section headings after the actual data, so it may end up taking up an extra page over the current arrangement. However, I think the gains outweigh the losses. -hpa