Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp5842569imm; Tue, 12 Jun 2018 14:24:54 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL/i6v3+2BMXCSH4sknlaIYUdnPTLR56jWjJ5JwZ945SmPYyHRBiOtnygRyf5/Nhw9uxjc0 X-Received: by 2002:a62:6f86:: with SMTP id k128-v6mr2084582pfc.150.1528838694174; Tue, 12 Jun 2018 14:24:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528838694; cv=none; d=google.com; s=arc-20160816; b=LcmlEf+bJnfMC8uu4VoPT8jz8PUBGujyrd+WCQUyt7OPTAy1PaxezqMl1XekLsFt9g Yq6XDP2gHQs+eu91djnOk0xt53NJPkCOB5qn11O2Kch7N3u+RZZ+h5NL8K/GL730nI5f 9GyAYO3DIn124uvvQXPlaT01M8lU8LzUBSwkje9ydBkM99msY/Kv6+D9HXkL25jqc9mg JJdoTPMG6etFGliY3STnPswN+7KKq9UD903Wn6I8SV1q8WQnB9taupgP0hjfv4aEwnCd Q/Ue6YXZ3zu1KKNi0cu+NZjdeqDtkLjRNLC9tD5mGa8/6UFRZgr1tflcIZvV5jaVC2Cr pHFw== 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:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature:arc-authentication-results; bh=A65GuVh3Xf/UIsGvCEfFhd/waTry7eJAr1W3EBVir68=; b=ghHrFMy2rG3O9xJNX1yR+8pazZlwDI+KxQwtMIHoOroJA429LZ8HG/186IS2DXS6r1 ythQqdq4F0Dnh9vYMeH82MxKbvjFDGl0QdliBbnUSkE31jmarQ1yppX3AXrmCgkgZ2hY PQ8egKsUPFVGvltcVviorZod3CZY/iKOlGZDV/RlI00yo/cRdl6u48i45o76gJ3cTnG1 enF9atLNa0EmeISSRY6ZJ+oQHK7Sxh7vSLMOyCIYpsl8hCre+p83rIGS8qPlGzPR49Q1 HnszO1WXnquXUJqekEsiO6A426tiW4V0/Q7nqGTLMB5VtXJUuyKE96kn9BjHsxKaeUkd B01g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arista.com header.s=googlenew header.b="M/NRHvrM"; 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=QUARANTINE sp=REJECT dis=NONE) header.from=arista.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c3-v6si999815pld.87.2018.06.12.14.24.39; Tue, 12 Jun 2018 14:24:54 -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=@arista.com header.s=googlenew header.b="M/NRHvrM"; 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=QUARANTINE sp=REJECT dis=NONE) header.from=arista.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933822AbeFLVYQ (ORCPT + 99 others); Tue, 12 Jun 2018 17:24:16 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:55528 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933173AbeFLVYP (ORCPT ); Tue, 12 Jun 2018 17:24:15 -0400 Received: by mail-wm0-f66.google.com with SMTP id v16-v6so1179503wmh.5 for ; Tue, 12 Jun 2018 14:24:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arista.com; s=googlenew; h=message-id:subject:from:to:cc:date:in-reply-to:references :mime-version:content-transfer-encoding; bh=A65GuVh3Xf/UIsGvCEfFhd/waTry7eJAr1W3EBVir68=; b=M/NRHvrMTbAcYDNRsXLFnyc7hmLOFvK8ip5nieC8O49w1V9zGdVqeHlILwEeFWPY8N A5ADtzbc9MFHfQd5ef6pifODvt8r/N0gFbCGzVrNf6M5rK4fmHC+1HD5BbBQSHCeDspA k6oQ18An/lw2VbcOJcWJw9/m+6qHH3f9GmMo1sITgJREbYgkz98UFTBGvCDN6Ancvmww Lc1dqc1LuYvDzSoc51HsIrq7tVGvkKvIhMo8+067wjDGPUNf7wUwxm8PX0IGAoJrH9vQ 9n4AHOG0qpB4uVbJTfIPxfWObhwGW8GevECP0+1wHNNdel6cYixYdFFcBE5UXLm2mm3u DYBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=A65GuVh3Xf/UIsGvCEfFhd/waTry7eJAr1W3EBVir68=; b=fma1Y0GaYb1pG3WLZfHYgNuNZz9rUQ51y411ybLVBEo1otekQlSYFL224l6228BxY5 PM0q5VOXcMwLhtm1c0kjmLCJsVfphYe81xWd7ILauY1B/e24UrwjD0axQdZ5jIjmH7a4 vxZBVzO8m8Bbk+4qNeEC8tf1BfLOHdBjzlCzFVqKzKhZLUKMF2RlFPWGNRrF4Nzfzlcm sXfVkqbK4eC6TLrIWcPSqcf25oStGcCMeZGaLmdZJJfTg03xyU7MbY2SInhCZO1Fvr5t Hctk3/LUpKzZv7+clZLYh5V1mIRdMkH7GO7aTwRNEnKlVTFk+lgd9101PpP55i4Rl+um yTZQ== X-Gm-Message-State: APt69E17mYVHitDY0fd94nkXy1ZXrcfWlNXGGsBd2I3mktvGVyJQNagm duAVxl2KLXkYEO0I11uwNvbXXIw2gRg= X-Received: by 2002:a1c:58d1:: with SMTP id m200-v6mr1767919wmb.160.1528838653788; Tue, 12 Jun 2018 14:24:13 -0700 (PDT) Received: from dhcp.ire.aristanetworks.com ([217.173.96.166]) by smtp.gmail.com with ESMTPSA id f13-v6sm506213eds.15.2018.06.12.14.24.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Jun 2018 14:24:13 -0700 (PDT) Message-ID: <1528838651.26829.69.camel@arista.com> Subject: Re: [RFC] x86/vdso: Align vdso after searching for free area From: Dmitry Safonov To: linux-kernel@vger.kernel.org Cc: Andy Lutomirski , Borislav Petkov , Dmitry Safonov <0x7f454c46@gmail.com>, "H. Peter Anvin" , Ingo Molnar , "Kirill A. Shutemov" , Thomas Gleixner , Vasiliy Khoruzhick , x86@kernel.org Date: Tue, 12 Jun 2018 22:24:11 +0100 In-Reply-To: <20180612204948.4752-1-dima@arista.com> References: <20180612204948.4752-1-dima@arista.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.24.6 (3.24.6-1.fc26) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2018-06-12 at 21:49 +0100, Dmitry Safonov wrote: > There is errata for AMD family 15h CPUs [1] and since > commit dfb09f9b7ab03 ("x86, amd: Avoid cache aliasing penalties on > AMD > family 15h") bits [14:12] are being cleared for shared libraries. > Also per-boot ASLR applies over upper bits by OR directly over the > address. > > As we need special alignment and lower bits values to be set, it > makes > only a little sense to call get_unmapped_area() after calculating the > address. It also can lead to random crashes if get_unmapped_area() > actually changes/aligns the address, which we observed on 15h CPU. > Usually it's not a problem as there isn't many mappings (except > possibly > ld.so, uprobes?) and result address is the same before/after > get_unmapped_area(). > > 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. -- Dima