Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp394934yba; Wed, 8 May 2019 23:00:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqww0jQQmyCbTh46lfkM2YAalxsvF5ZAQ6N8S0etecUtTV+XZqmi62IEz2m3h8B5Ky6LdYh6 X-Received: by 2002:a17:902:2beb:: with SMTP id l98mr608760plb.290.1557381623692; Wed, 08 May 2019 23:00:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557381623; cv=none; d=google.com; s=arc-20160816; b=b/De270mT9tXbpyoHJ1Af5zm2lXW1dVafmKXdX9SAUP52JpvCBLN/+2GFEVJjMgPeF M0028krKIrevf7aguku5nrS7V+LloexVNhXcFFkBjuj8pARCllWzWTB+alw0yU0LAwJA +FZlMOI7/+L86vB35TRDd6NQL3GVwLN3c18/RCx4loR/DysFkQjTWheTiPb7c82HPg6m LnkfJml1CUdUvPsRrGg/LlfiToUzUMDklZIHaizQV7+XXc0IuCNDATn5zfwz9S/vQCV6 Dfm0eEuJkYB3o0wQ2e+1dGiwq3rfmYVF+Jqfx8JYs2ZNqTsOnvTvNCwuANi1ESNNjK5x vFRw== 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=CDL1LOFL6Jlvbl8W+9pBU7MYHG/j9NgPfPY2BCaA4/8=; b=n9TLdaD7M/LrnLo84ROrR0+K8LJxvG3LjfSKaf5raH1BKd5/JV7BBje2y1xeBdrBhR NejiQj2IPfjTvLYI9L/WJbPOf/COpi+DPP6nN/GFO7vATIjVuz1LRw8zEu0Ti20crXFQ vZaGIm7D03LD/zelugGs0h1bCinTkFswqRX3gsVm6R90WDCxGzdWDcyZy7IK1hfJ5AD6 cujgl6rCgK3LEzjlWYPGdxNr84se7OKtN0iu4Fsv08TRv/XWW4H0GZSU6OirbIzyslYc oamq1SS9RYBHcchmmZcMCy2brtCnhqoifGJ1iqHtyKn5RZXSdOWko7jXRSvwoAR29Iw8 T/mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=ukO8xFTk; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 142si1564017pfu.129.2019.05.08.23.00.07; Wed, 08 May 2019 23:00:23 -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=fail header.i=@gmail.com header.s=20161025 header.b=ukO8xFTk; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726797AbfEIF7V (ORCPT + 99 others); Thu, 9 May 2019 01:59:21 -0400 Received: from mail-wm1-f49.google.com ([209.85.128.49]:40669 "EHLO mail-wm1-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726179AbfEIF7U (ORCPT ); Thu, 9 May 2019 01:59:20 -0400 Received: by mail-wm1-f49.google.com with SMTP id h11so1437846wmb.5 for ; Wed, 08 May 2019 22:59:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=CDL1LOFL6Jlvbl8W+9pBU7MYHG/j9NgPfPY2BCaA4/8=; b=ukO8xFTk6d8lkBW+BnbvosZqdHt/Z23qFZl2MnuIOiwHS6LgHeQK+TQJEHet9+/uGo FvQwCmaCHeebWVzM8tcXAVKzKQu+a4x3FpcKhw9r+wBGuwFc55GycXOJzz1hcBWOjJGq 2Uktdl4/e6sVL1dTceBmmYDDwxwKqkQ1e7vVoHA6pQLMkHSjP3XZyczyTaH52Hf/IN1S iOXyxRvpW6PlcOop3UKlghRbwjLs1Ei2AGyUQg6J45/cfC/paMnKRw8eR+I9l4kqILj4 7DlxP2MzWhz0W4Y97L3EaHc5rLnKCKdpyM+6qLDGYsY6zwWospLTzTm17dX4pNNIdCmZ IIpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=CDL1LOFL6Jlvbl8W+9pBU7MYHG/j9NgPfPY2BCaA4/8=; b=YpzKH8mx3gBDZ3Tji5apziZJb9JQKM8cibDh5O4XeyLQm3SjHcXPMFE/tQfbcKw30F AIbMOpS3Nqx092uSP5xRxz2wrIYdAGpZCfW9BRwc08jwnxaFYz+adk9UxWDUI8qUqukV jaXc5Dynt4zfWzZxkG721cnlCZM9fbkUuOmzAmqnGDtXeK3Rnan7s1tFCu3gJqwFyE68 GdFQIDNgoym4sNAmfnHAqiH9lJJKkTg1YJcbGNmyGoM0Dk9mjMN/4AWU1JuN78l0a7sh xNOQZ1rNDr1U42krDAYLEpe1bX9gpL3plmYb0Ct6mF9afw8YWmymrJNTgkHbE2Ntmv6k tlCw== X-Gm-Message-State: APjAAAW96v5mnPDqeR2xwtKHamhKw443BiYnfvs0YDkvrm6cmqE1Y0Jx rxWyeEFqcbMB17XZ6ANuPEw= X-Received: by 2002:a7b:c7d4:: with SMTP id z20mr1441523wmk.66.1557381558974; Wed, 08 May 2019 22:59:18 -0700 (PDT) Received: from gmail.com (2E8B0CD5.catv.pool.telekom.hu. [46.139.12.213]) by smtp.gmail.com with ESMTPSA id g3sm1397588wmh.27.2019.05.08.22.59.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 May 2019 22:59:17 -0700 (PDT) Date: Thu, 9 May 2019 07:59:15 +0200 From: Ingo Molnar To: "Reshetova, Elena" Cc: David Laight , Andy Lutomirski , Theodore Ts'o , Eric Biggers , "ebiggers@google.com" , "herbert@gondor.apana.org.au" , Peter Zijlstra , "keescook@chromium.org" , Daniel Borkmann , "linux-kernel@vger.kernel.org" , "jpoimboe@redhat.com" , "jannh@google.com" , "Perla, Enrico" , "mingo@redhat.com" , "bp@alien8.de" , "tglx@linutronix.de" , "gregkh@linuxfoundation.org" , "Edgecombe, Rick P" , Linus Torvalds , Peter Zijlstra Subject: Re: [PATCH] x86/entry/64: randomize kernel stack offset upon syscall Message-ID: <20190509055915.GA58462@gmail.com> References: <2e55aeb3b39440c0bebf47f0f9522dd8@AcuMS.aculab.com> <20190502150853.GA16779@gmail.com> <20190502164524.GB115950@gmail.com> <2236FBA76BA1254E88B949DDB74E612BA4C6F523@IRSMSX102.ger.corp.intel.com> <2236FBA76BA1254E88B949DDB74E612BA4C760A7@IRSMSX102.ger.corp.intel.com> <20190508113239.GA33324@gmail.com> <2236FBA76BA1254E88B949DDB74E612BA4C762F7@IRSMSX102.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2236FBA76BA1254E88B949DDB74E612BA4C762F7@IRSMSX102.ger.corp.intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Reshetova, Elena wrote: > > * Reshetova, Elena wrote: > > > > > CONFIG_PAGE_TABLE_ISOLATION=n: > > > > > > base: Simple syscall: 0.0510 microseconds > > > get_random_bytes(4096 bytes buffer): Simple syscall: 0.0597 microseconds > > > > > > So, pure speed wise get_random_bytes() with 1 page per-cpu buffer wins. > > > > It still adds +17% overhead to the system call path, which is sad. > > Why is it so expensive? > > I guess I can experiment further with buffer size increase and/or > using HW acceleration (I mostly played around different rdrand paths now). > > What would be acceptable overheard approximately (so that I know how > much I need to squeeze this thing)? As much as possible? No idea, I'm sad about anything that is more than 0%, and I'd be *really* sad about anything more than say 1-2%. I find it ridiculous that even with 4K blocked get_random_bytes(), which gives us 32k bits, which with 5 bits should amortize the RNG call to something like "once per 6553 calls", we still see 17% overhead? It's either a measurement artifact, or something doesn't compute. Thanks, Ingo