Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp449787yba; Thu, 9 May 2019 00:05:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqyJtbok5URfq8vX+TM1tK0XTW/WHpf4kpdZxFNm8KEvdZjJIqiLmRHAEHi/nYffPezpXvsv X-Received: by 2002:a65:430a:: with SMTP id j10mr3433409pgq.133.1557385499917; Thu, 09 May 2019 00:04:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557385499; cv=none; d=google.com; s=arc-20160816; b=vZdV86k6QRGo/w/toxzIDUbl7Tt/K16KxTV+xdne+jA2QYMuq5X7wecNJVY8l/qLbD N0Yz8l0ExN0UkQYyvwMo0hxae+JSfJSkv+yPKRBkbxhw0lxk22N8iHaaFH0ouTQWJPNJ w/D0kpUE/SY2DOwPKlD43TUxWbS+rN9PAVG5yaaOULMaiPiJYJ2qWH/YiztI1GGYNojv pUbgporxLwJhZ2oHA7vY+DKAu9rLnPYNYZnXciAcKXWlHCDpOMLdmAMlLLKKRz7hnEZZ mCGAFq9s+OHq3+6wUbzsmkzg2nYPsXwGuM2ZpbuS+SzR6bsLge8+wMzAk8hlrF5vzo3u 88IQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :dlp-reaction:dlp-version:dlp-product:content-language :accept-language:references:message-id:date:thread-index :thread-topic:subject:cc:to:from; bh=RzGwFUIyNhKU5AtSe0EhlN3zjVNIs8DvqskJAW57hw0=; b=V0YZ/7Fztp9gj8WIfoFgVaP7f7mZ3WX1JdSkBj6Fy4ISVtwt3yrhXO5edgcJNZpksZ 6gmSDqxDj1vOk9geJL5uSjeI4/DnoJhfKd9eMsZki6L57Qb2kF/RZGH6yE+ODL6pbyIV oHOoY1uKZB1/2osKoR1wjg5fgzStg5AyNK7lAyFUGi1/Sc+dm1hIGM3lJEQudT+ayC3Y tdxy4Lsys/Sgq3KDFmsclZ0Ef+lKaa8JnWkOju1er8EFBQ9A5wToubVb303IKpb/ClBW 3UQv8YDKPQs8zWNepU5YMLvdddpXIK94JO0R5r28FVat2bjgqlxP9FVbhyfgxtbyHSH/ OQfg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j95si1660154plb.414.2019.05.09.00.04.43; Thu, 09 May 2019 00:04: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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726687AbfEIHD3 convert rfc822-to-8bit (ORCPT + 99 others); Thu, 9 May 2019 03:03:29 -0400 Received: from mga01.intel.com ([192.55.52.88]:6135 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725908AbfEIHD3 (ORCPT ); Thu, 9 May 2019 03:03:29 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 May 2019 00:03:29 -0700 X-ExtLoop1: 1 Received: from irsmsx106.ger.corp.intel.com ([163.33.3.31]) by orsmga002.jf.intel.com with ESMTP; 09 May 2019 00:03:25 -0700 Received: from irsmsx102.ger.corp.intel.com ([169.254.2.21]) by IRSMSX106.ger.corp.intel.com ([169.254.8.235]) with mapi id 14.03.0415.000; Thu, 9 May 2019 08:03:24 +0100 From: "Reshetova, Elena" To: Ingo Molnar 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 Thread-Topic: [PATCH] x86/entry/64: randomize kernel stack offset upon syscall Thread-Index: AQHU81HQwzT9MH4dM0y/JZXnSwiYT6Y8wW2AgAAdM1CAAXexAIAANZ3ggAAW1gCAAApRgIAAMeKAgAAd+PCAAQuGgIAAYQuAgAAKhwCACsPi4IADJTwAgAAcagCAAExngIAEBbGAgACIbACAAbyQ8IAA626AgAGZfXCAAARpgIAAWpuAgAAF74CAABf/AIAAAvkAgAGZnrD///dzgIAHjbaA///31ICAAC4VAIABBxmAgAAfuaCAAAKDAA== Date: Thu, 9 May 2019 07:03:24 +0000 Message-ID: <2236FBA76BA1254E88B949DDB74E612BA4C77445@IRSMSX102.ger.corp.intel.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> <20190509055915.GA58462@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMjdhMDJkMGUtYzAwMS00ZTkwLWJiODItNDRiMTgzNzhiMGQyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiOFMwTGRwXC9OTjY5OVg1WFA2cjFWeUhGcmkwT05Wb0h3WFJlc2M5OGhRM0p0WURZZTFiemVKVHBDS0RRaDV4ODEifQ== x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > 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. > > If you check what happens underneath of get_random_bytes(), there is > a fair amount of stuff that is going on, including reseeding CRNG if reseeding > interval has passed (see _extract_crng()). It also even attempts to stir in more > entropy from rdrand if available: Sorry pressed wrong button instead of copy pasting the code. This is where it adds entropy: if (arch_get_random_long(&v)) crng->state[14] ^= v; > I will look into this whole construction > slowly now to investigate. I did't optimize anything yet also (I take 8 bits at > the time for offset), but these small optimization won't make performance > impact from 17% --> 2%, so pointless for now, need a more radical shift. > > Best Regards, > Elena.