Received: by 10.223.185.116 with SMTP id b49csp3664782wrg; Tue, 6 Mar 2018 02:59:14 -0800 (PST) X-Google-Smtp-Source: AG47ELtzfeyKXHbzw/OxUwevD8xD7jdVcwUnN6UMxRM57HcJOTTdgfyv2Z/sN0AwnrJFrogJtFVv X-Received: by 10.98.9.5 with SMTP id e5mr18684332pfd.189.1520333954130; Tue, 06 Mar 2018 02:59:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520333954; cv=none; d=google.com; s=arc-20160816; b=abULqoCoacAD58Q8vKXob2/SjJlmQ87rFddmB4O7Im9NsKJUicwDLPB5H8+mUrfkLs yBCPVACzlAeg7N47eEIQBHKSgHgF4MtWCcuD2XuISBdx8q56kEq+3OOtLc0gDBzce3Wp 10Ko+COPvwizUOcvlQzn5bbxqmE3uesimlvkC7KlzmLUk4rm2DFrWJXdXXDLzlg9BkDV Cp/EdOkJzctysqQiHGDg4BMV2LKYCrEOIc71FRkIL6PN+o4qpBneoeuE14DNu9sQ7Cow WlsWxsZ3DAyrWeVNGfu90cYgawxoS3ZDUlzRhrHGJoy3T1BLB9xy39KdU2W2Iwx2w3IJ bQ1g== 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=mYH44/qqsL7hP82kbZtnGcCXZxuLFn2zy+WndcHnkVo=; b=yeuvPFlrX/Dr6A+fKeZfEX+rOe/aSN0Z88MshmxXYSN1YfYNgN5gEtGhqSMFe4ty/M jKALNfwyEM8l0xtLULTF73d+5oajYtY9Mr1JvnezfWfS/h5Ja1HBAlT/Bmqvk6+Unow+ HeHfNsaSt9CHqvnGJM3I15pPIR2+XEUoBTFqkCWw/6bY0Jk2ZNTGGahEvSc1OdcwWydO jt2khEN8AmBs/vlOQB/OXq6MXBFUvLyajzoozIFrgoPlnJ8098QXbVstaakbOFumKqH2 gmwTo5gV/Kw8QgZcoZcMFg01yNFRZvY0YxzR8TiC8hcUbGxsuEntF8zzjVl/x2qxRgvr Bmqw== 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 g126si10999640pfc.395.2018.03.06.02.58.59; Tue, 06 Mar 2018 02:59:14 -0800 (PST) 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 S1753468AbeCFK5r (ORCPT + 99 others); Tue, 6 Mar 2018 05:57:47 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:44530 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750933AbeCFK5p (ORCPT ); Tue, 6 Mar 2018 05:57:45 -0500 Received: from localhost (unknown [185.236.200.248]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 1D229F6A; Tue, 6 Mar 2018 10:57:45 +0000 (UTC) Date: Tue, 6 Mar 2018 02:57:48 -0800 From: Greg Kroah-Hartman To: Borislav Petkov Cc: Seunghun Han , Tony Luck , linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V3] x86: mce: fix kernel panic when check_interval is changed Message-ID: <20180306105748.GA31087@kroah.com> References: <20180302202706.9434-1-kkamagui@gmail.com> <20180306104320.GB11535@pd.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180306104320.GB11535@pd.tnic> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 06, 2018 at 11:43:20AM +0100, Borislav Petkov wrote: > On Sat, Mar 03, 2018 at 05:27:06AM +0900, Seunghun Han wrote: > > I am Seunghun Han and a senior security researcher at National Security > > Research Institute of South Korea. > > > > I found a security issue which can make kernel panic in userspace. After > > analyzing the issue carefully, I found that MCE driver in the kernel has a > > problem which can be occurred in SMP environment. > > > > The check_interval file in > > /sys/devices/system/machinecheck/machinecheck directory is a > > global timer value for MCE polling. If it is changed by one CPU, MCE driver > > in kernel calls mce_restart() function in store_int_with_restart() function > > and broadcasts the event to other CPUs to delete and restart MCE polling > > timer. > > > > The __mcheck_cpu_init_timer() function which is called by mce_restart() > > function initializes the mce_timer variable, and the "lock" in mce_timer is > > also reinitialized. If more than one CPU write a specific value to > > check_interval file concurrently, one can initialize the "lock" in mce_timer > > while the others are handling "lock" in mce_timer. This problem causes some > > synchronization errors such as kernel panic and kernel hang. Other functions > > such as set_ignore_ce(), set_cmci_disabled(), and mce_enable_ce() also > > have synchronization problems. > > > > It could be a security problem because the attacker could make kernel panic > > by writing a value to the check_interval file in userspace, and it could be > > used for Denial-of-Service (DoS) attack. > > > > To fix this problem, I added a mce_sysfs_mutex to serialize requests for > > timer and sysfs functions. > > > > Signed-off-by: Seunghun Han > > --- > > Changes since v2: add a mutex to sysfs functions according to review > > result. > > Changes since v1: add mce_sysfs_mutex according to review result. > > Thanks, I've committed the patch below. Scream if there's still > something not in order: It would have been nice to add a cc:stable for this, but I'll try to watch it and when it hits Linus's tree I'll queue it up there. thanks, greg k-h