Received: by 10.223.185.116 with SMTP id b49csp531505wrg; Fri, 23 Feb 2018 02:43:49 -0800 (PST) X-Google-Smtp-Source: AH8x225c53xrIgz8O1m+vyuYuEwzb3sMQb+YGwUH18CFoJIed2y1I5/95pS/Jmvr+w/P2Uo8q+NV X-Received: by 2002:a17:902:bb06:: with SMTP id l6-v6mr1301564pls.115.1519382629153; Fri, 23 Feb 2018 02:43:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519382629; cv=none; d=google.com; s=arc-20160816; b=sNPqFhMT10plvL09glcYL9n9xgmrizuH8ZWVy+ynVJrBzRBQCY6NVYmuZb50LUIzDI 3XhDm5KugL8NwNjQMCd0+6YgnkcKR0cJZr7fww7Jh/QIaEhbwA47YroSZcRq3G7HY5dp 8Qqc/Md3OjU8+B730d9/CJF26GVPE0YTmLWTr/Lv9pjJYqYMhajKwENwlATwSRKzOghR F12GrDjNTnHuu7mwaQvySW76IzYcJ8QOsX4L74mhiNcBljey+1uPSMTE71gePbub+PfD bnhdjQbLfuR4P/guRYVt9/DqMVg1JkWsGirgEFUGMYHaallsmBBellyhYlk2To99qiTH 7AVg== 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=oWcaLhcjluvqO3fwhAQJd0XBJhR0/O+CrMNoShwaDUw=; b=Ch8DteJVtMhlTlVSpa3o2wuoQal6AzCQxgau9VYkzhQjEBFP8OQohhKVHLCBu15YXe wqwyErOI6iFHrbUfQHphHVB4WaO544ukbmuasvfmBMjfcbbBLxKaM7d9cTckASRzKE/n y9lQig+b9OvpIHCCGpWMxrP9m4RY/rcfZXfQeKG1//I8a19a9izq6vcWiXIDnzMfH7U7 ZWuV+WCe3FKqFQXEFOHZBNZaTVYAlfysj6KHcGO8fDR+UN4LJIQRZZHS9wEofQaBIMHJ 5CKuZRstimPW2alGv11ZnRI0MX7BC6EIL0DzxKnJ8j5WGYi4Zr2sUm6lhptPdYShVvi4 FNgQ== 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 o8-v6si193168pll.332.2018.02.23.02.43.34; Fri, 23 Feb 2018 02:43:49 -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 S1751542AbeBWKnB (ORCPT + 99 others); Fri, 23 Feb 2018 05:43:01 -0500 Received: from mail.skyhub.de ([5.9.137.197]:34238 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751474AbeBWKm5 (ORCPT ); Fri, 23 Feb 2018 05:42:57 -0500 X-Virus-Scanned: Nedap ESD1 at mail.skyhub.de Received: from mail.skyhub.de ([127.0.0.1]) by localhost (blast.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id WmupCEgqZa5K; Fri, 23 Feb 2018 11:42:55 +0100 (CET) Received: from pd.tnic (p200300EC2BC9CD0031B49A5A0674A779.dip0.t-ipconnect.de [IPv6:2003:ec:2bc9:cd00:31b4:9a5a:674:a779]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 82AD31EC0283; Fri, 23 Feb 2018 11:42:55 +0100 (CET) Date: Fri, 23 Feb 2018 11:42:39 +0100 From: Borislav Petkov To: Seunghun Han , Tony Luck Cc: linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman Subject: Re: [PATCH] x86: mce: fix kernel panic when check_interval is changed Message-ID: <20180223104239.GA4981@pd.tnic> References: <20180223101350.8344-1-kkamagui@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180223101350.8344-1-kkamagui@gmail.com> User-Agent: Mutt/1.9.3 (2018-01-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 23, 2018 at 07:13:50PM +0900, Seunghun Han wrote: > I am Seunghun Han and a senior security researcher at National Security > Research Institute of South Korea. > > I found a critical 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 and broadcasts the event to other Right, so I'm thinking that doing that per-CPU configuration doesn't make a whole lot of sense. It is not something that needs to happen very often and it is done globally anyway. So what we should do here, IMO, is make mce_restart() grab a mutex and thus serialize all those sysfs writes. It will naturally also slow down any hammering from userspace which we should not allow anyway. Tony, what do you think? -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply.