From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1163141AbcG1F4D (ORCPT ); Thu, 28 Jul 2016 01:56:03 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:38416 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1162963AbcG1Fzz (ORCPT ); Thu, 28 Jul 2016 01:55:55 -0400 X-IBM-Helo: d06dlp01.portsmouth.uk.ibm.com X-IBM-MailFrom: heiko.carstens@de.ibm.com X-IBM-RcptTo: linux-kernel@vger.kernel.org;linux-next@vger.kernel.org Date: Thu, 28 Jul 2016 07:55:48 +0200 From: Heiko Carstens To: "Theodore Ts'o" , linux-next@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Martin Schwidefsky Subject: Re: [BUG -next] "random: make /dev/urandom scalable for silly userspace programs" causes crash References: <20160727071400.GA3912@osiris> <20160728034601.GC20032@thunk.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160728034601.GC20032@thunk.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16072805-0020-0000-0000-000001DE28B4 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16072805-0021-0000-0000-00001CE868E3 Message-Id: <20160728055548.GA3942@osiris> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-07-28_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1607280062 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 27, 2016 at 11:46:01PM -0400, Theodore Ts'o wrote: > On Wed, Jul 27, 2016 at 09:14:00AM +0200, Heiko Carstens wrote: > > it looks like your patch "random: make /dev/urandom scalable for silly > > userspace programs" within linux-next seems to be a bit broken: > > > > It causes this allocation failure and subsequent crash on s390 with fake > > NUMA enabled > > Thanks for reporting this. This patch fixes things for you, yes? > > - Ted Yes, it does. It's actually the same what I did to fix this ;) > commit 59b8d4f1f5d26e4ca92172ff6dcd1492cdb39613 > Author: Theodore Ts'o > Date: Wed Jul 27 23:30:25 2016 -0400 > > random: use for_each_online_node() to iterate over NUMA nodes > > This fixes a crash on s390 with fake NUMA enabled. > > Reported-by: Heiko Carstens > Fixes: 1e7f583af67b ("random: make /dev/urandom scalable for silly userspace programs") > Signed-off-by: Theodore Ts'o > > diff --git a/drivers/char/random.c b/drivers/char/random.c > index 8d0af74..7f06224 100644 > --- a/drivers/char/random.c > +++ b/drivers/char/random.c > @@ -1668,13 +1668,12 @@ static int rand_initialize(void) > #ifdef CONFIG_NUMA > pool = kmalloc(num_nodes * sizeof(void *), > GFP_KERNEL|__GFP_NOFAIL|__GFP_ZERO); > - for (i=0; i < num_nodes; i++) { > + for_each_online_node(i) { > crng = kmalloc_node(sizeof(struct crng_state), > GFP_KERNEL | __GFP_NOFAIL, i); > spin_lock_init(&crng->lock); > crng_initialize(crng); > pool[i] = crng; > - > } > mb(); > crng_node_pool = pool; >