Received: by 10.192.165.156 with SMTP id m28csp2161372imm; Sat, 14 Apr 2018 15:43:27 -0700 (PDT) X-Google-Smtp-Source: AIpwx49H9pZKFeTMSy4HaQjpLdyXqSlOsmmsl/BjhZS+Cvdel+a23JjQDsH1Cj9kw/4uh3Gm3yas X-Received: by 10.101.102.3 with SMTP id w3mr8138589pgv.200.1523745807817; Sat, 14 Apr 2018 15:43:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523745807; cv=none; d=google.com; s=arc-20160816; b=fQ45eOB2/EBVOouiPcw7czw6XdzYAQoSUuabccP/4U5lmsq6/QTKzYblV3Ht3heRzu 8mcbc8CXm8h/Rr59ikEFHYp+rl7cRJpEEK59uwjZbPFV2lsXvPPxhhlV4HkyjbjG7xJd NQOhlSG0kl/Yn+6j7MDKMpBLEnoDc8IG/1+VFlq2B0bzg/nyHUtAmc4c+E8pzY5dzTvL PGLfX1jl0Joj5lnfNyj1uR8UjINpOD+uJ/jLp4B7L4OrcEgnk5WXNw0fzaaXVRQ64ysC zYYfVn3WXLmOcPdFLNZiS4LuD+/rZgjfjgSoRweWP51SxcJP2togExGeIK8ae2VNZ5Mc jzeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=+EkvA5/u+89pt+cHOknxdWTjitXb4zzTAiUvawvww9U=; b=g05dUdCFYOWJbLV6RsUU8vof9PX+6LateYhrJsqFVPk0OEYFONE7Giw/1JufkY3WtJ /Rp7kCubg6UzrRWz5hOJ6V9C4X7EWFvGlH+wGwuHNZB50YKfv1xaTkPqbEuaOvubvqBN n69HhUPFxgRisjPEHBbPWQr3hs3jl0ZSxaNBav2drgrjYBEpWa9F3Q557Rm4m+ql60oq ojOQgU4vtOb/mtgGI7TTXw0u00saxCCeifn2vJCNv3LO1uG8T3F0Xy3VC9g3qcfZ0w5v YhnEBT3Bhlx+fbHy63cazlzSTArDh12WvXls1QLBjKYmq2x0PPguf9uJciV3/3HmKYmO s5MA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=ZzneQYrW; 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 s19-v6si8183649plp.558.2018.04.14.15.43.11; Sat, 14 Apr 2018 15:43:27 -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=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=ZzneQYrW; 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 S1752146AbeDNWmF (ORCPT + 99 others); Sat, 14 Apr 2018 18:42:05 -0400 Received: from mail-wr0-f172.google.com ([209.85.128.172]:42238 "EHLO mail-wr0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752073AbeDNWmE (ORCPT ); Sat, 14 Apr 2018 18:42:04 -0400 Received: by mail-wr0-f172.google.com with SMTP id s18so16429279wrg.9 for ; Sat, 14 Apr 2018 15:42:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=+EkvA5/u+89pt+cHOknxdWTjitXb4zzTAiUvawvww9U=; b=ZzneQYrWeOT5+BdcHSG7J6I9LaTsPr4RTAsU02mZCZ52U/gYIS8DKXZUQjn1Av5ZRV sPhsJz9cknp5nBEMmUZziDDdqlpIyUgPYlsff8OF8vCTdnY0uO2Wujvt79f9MyMCGe5O QLTkuj4lsnpHjj8Hp6QFyVYEUWLmqLDRHoF/MBFH0VihSbtQJ6FUe8CJg+jru2FIccxk 28khflSGFeZJVpdwcg0q4iJb6ugKWoA80x2NzWBkLks6ORsdrFK4ecUQlO1tPLc0DyTr cHsO1qaUsW3spccYdhKuKesku5Gqco8I7Y0DUQGQHiSL+eNfrUrGkhLk8Og0MOJXidKU SlEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=+EkvA5/u+89pt+cHOknxdWTjitXb4zzTAiUvawvww9U=; b=CM4brilGfBnEF6/FaAY/lxViqaJxnRtSgED0UnGYv55M6d/EACCi2/VsbCG3sjj/qs qQsuuMIY7efBNErnq8JmSyasFH2efrOVGXg234d2UYmSI6+mXwmeSkwYn+XESuFWheZ2 AZgsUCTIrpNcrsFbzTKeFIHFmlGYc7fx3P7GDTI2mdMSV97qVNiyBQMl27MFRlBR7AFk G1XS4IMJ7kKc5Jn06h/ixRXZL2JIYzCkv/g4kP8XlAxxKux9vaVe0chkPp8jaoLHISdr Vq64haDyERZKRy40DJprku9QZfS6b6A94Yl9OOkLnvhWI5V+bmuxLu3AjLDagqNXQHsV kDFA== X-Gm-Message-State: ALQs6tC1CpZtvp4TFuiYD05UzbLGpn1qkEYvIZae+AyjZwwmBMdgIszS DEb1rkznknfTbM1STxRalWQQMeWT2sL8x21LEBGoYw== X-Received: by 10.28.235.14 with SMTP id j14mr6396732wmh.116.1523745722714; Sat, 14 Apr 2018 15:42:02 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.247.15 with HTTP; Sat, 14 Apr 2018 15:41:42 -0700 (PDT) In-Reply-To: <20180414195921.GA10437@avx2> References: <20180414195921.GA10437@avx2> From: Andy Lutomirski Date: Sat, 14 Apr 2018 15:41:42 -0700 Message-ID: Subject: Re: repeatable boot randomness inside KVM guest To: Alexey Dobriyan Cc: LKML , "Ted Ts'o" , kvm list , security@kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Apr 14, 2018 at 12:59 PM, Alexey Dobriyan wrote: > SLAB allocators got CONFIG_SLAB_FREELIST_RANDOM option which randomizes > allocation pattern inside a slab: > > > #ifdef CONFIG_SLAB_FREELIST_RANDOM > /* Pre-initialize the random sequence cache */ > static int init_cache_random_seq(struct kmem_cache *s) > { > ... > > Then I printed actual random sequences for each kmem cache. > Turned out they were all the same for most of the caches and > they didn't vary across guest reboots. > > int cache_random_seq_create(struct kmem_cache *cachep, unsigned int count, gfp_t gfp) > { > ... > /* Get best entropy at this stage of boot */ > prandom_seed_state(&state, get_random_long()); > > Then I searched internet and turned out KVM can pass randomness via > virtio-rng or something. So I linked /dev/urandom. > > And it didn't help! > > The only way to get randomness for SLAB is to enable RDRAND inside guest. > > Is it KVM bug? > > For the record I'm using qemu 2.11.1-r2 and whatever F27 ships now. virtio-rng doesn't really do that. I have an ancient patch set to do exactly what you want, and I should dust it off.