Received: by 10.192.165.148 with SMTP id m20csp3111182imm; Mon, 23 Apr 2018 00:16:36 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/ZBdbockd3SP/9KMLORL/ghIQJIkH+ap/5Is3mGyubM/FydDPBpUSCQc5f7Z2VcBmkcwpL X-Received: by 2002:a17:902:a8:: with SMTP id a37-v6mr17818088pla.238.1524467796633; Mon, 23 Apr 2018 00:16:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524467796; cv=none; d=google.com; s=arc-20160816; b=AqHPQlfnq0R/S8H/mf0MUwl4LzOfm5baA4qP+8GSsrMIi0oRAtcR9NURCao8krbrRd +zaZJArC2BAVTuOzeAHVa7ITvWDx/Yh5vGzQ7Rigqa+6ynHDAyuhyxOaLAHbND8/Hd6c oBX1iUhvL1nDDswiOhnySQiKZv5bSFeYuJLU3LGL+dENhGiFl9oPMwqIw5CzTXLkMBWX wXHWUNfHIg+xbjxwTnNnHbyQroYbVsM/aDCNzZnhf95MGbzdrja9mt1TY3+Hj9hbmRMw BNSl0Iscj6sRNGenGDXgdww65cEgWndkKPyQC5GtwiOjD8aaZOETWeLkzngQQrRJIBTx R4Uw== 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:arc-authentication-results; bh=bf6jAYfhDPS8aobHGTIuLtr9nWdzJX8fFA6G3tPJVHk=; b=PSZH96jVlpze6CvDch//sTKNqAUUAWrhu6BTxCW18lAWvWQEDvgqmLsF1eh4iclfqD Jk8Z9lpBBP83eMgos2iR6ykYZH+5qjsrup1XBBOf8uKOrbjQ7cduq11o//xa6HXXnDOn MjqoP1JbnovyM71jIj2WD37+XuTC3QXB+2sHsgYbeMCPh55WzEuSeCwRKgtAo+enYEgH xd1+8e+pqCASo2bthZA0MBElrQpek/iIp/yPMYJ6ogAnl+XC/bvtuPf3bxBl87udyO4b 1fyMDMxKP/BEgUkmb1kNT4vAxIF0c7lceDMAou5N7byi5hCtqXyxPw2miMIqBMlUUo5N hCXg== 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 t16si10872489pfm.150.2018.04.23.00.16.22; Mon, 23 Apr 2018 00:16:36 -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 S1754120AbeDWHP1 (ORCPT + 99 others); Mon, 23 Apr 2018 03:15:27 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:60526 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750997AbeDWHP0 (ORCPT ); Mon, 23 Apr 2018 03:15:26 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 441729C0; Mon, 23 Apr 2018 07:15:26 +0000 (UTC) Date: Mon, 23 Apr 2018 09:15:20 +0200 From: Greg Kroah-Hartman To: Ben Hutchings , Tetsuo Handa Cc: linux-kernel@vger.kernel.org, Theodore Tso , stable@vger.kernel.org, Jann Horn , stable@kernel.org, Salvatore Bonaccorso Subject: Re: [PATCH 4.9 75/95] random: set up the NUMA crng instances after the CRNG is fully initialized Message-ID: <20180423071520.GC28186@kroah.com> References: <20180422135210.432103639@linuxfoundation.org> <20180422135213.491879480@linuxfoundation.org> <49fa7d5f484a06f02946afec0688c33849e018de.camel@decadent.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <49fa7d5f484a06f02946afec0688c33849e018de.camel@decadent.org.uk> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Apr 22, 2018 at 11:28:52PM +0100, Ben Hutchings wrote: > On Sun, 2018-04-22 at 15:53 +0200, Greg Kroah-Hartman wrote: > > 4.9-stable review patch. If anyone has any objections, please let me know. > > > > ------------------ > > > > From: Theodore Ts'o > > > > commit 8ef35c866f8862df074a49a93b0309725812dea8 upstream. > > > > Until the primary_crng is fully initialized, don't initialize the NUMA > > crng nodes. Otherwise users of /dev/urandom on NUMA systems before > > the CRNG is fully initialized can get very bad quality randomness. Of > > course everyone should move to getrandom(2) where this won't be an > > issue, but there's a lot of legacy code out there. This related to > > CVE-2018-1108. > > > > Reported-by: Jann Horn > > Fixes: 1e7f583af67b ("random: make /dev/urandom scalable for silly...") > > Cc: stable@kernel.org # 4.8+ > > Signed-off-by: Theodore Ts'o > > Signed-off-by: Greg Kroah-Hartman > > In 4.9 (and probably older branches too) this leads to a deadlock: > > crng_reseed(primary_crng, ...) takes primary_crng.lock > -> numa_rcng_init() > -> crng_initialize() > -> get_random_bytes() > -> extract_crng() > -> _extract_crng(primary_crng, ...) tries to take primary_crng.lock > > I think this can be fixed by backporting commit 4a072c71f49b > "random: silence compiler warnings and fix race" but I'm not sure > whether that depends on other changes. According to Tetsuo Handa, it's also causing problems in mainline :( Ted, any thoughts as to what to do here? thanks, greg k-h