Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp1186397ybm; Tue, 21 May 2019 09:55:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqzthuUovRH8AfftzDAeeFFixZ6lqcO0dvQ6KhEjyjzdDFsTy1lodAMLGiWaf3qHf6HHMFrV X-Received: by 2002:a17:902:c01:: with SMTP id 1mr44922399pls.142.1558457709907; Tue, 21 May 2019 09:55:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558457709; cv=none; d=google.com; s=arc-20160816; b=qgElyyh5ZA3UW7eUAkHXArPnmJdWeuwbzNwcdmbOu+Gs279P4oUJ3gwHufMNFz028f y4xneSms/Usvgq+3LLwlNOvH506qBUKGYW2ksJL1kkWRNljxRDJRskzFyqkCRze36EHG tJAI0xOJcGSVTLkWCuf23o/ylGmeDD5ymb88OHyvoPqw1MDzK1oo0XnHbP+OSgL+hZ0o 8z4mxO3hQt39/4k6F7llXsf9KW7fqTsl1VACjl6cc2VJ2vrHxRG76ptqXv5wwHbtxY7Z 5kRO/eOcf0K4cCpkJ/LLFuNNPIEPBs5dMVyBDM+CGTtEZE4NrSn6p3u+ukUecwLP32p2 gkkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=h0kkpRtIb9JZ6eqh5iQ5NnVcjXHdXNLMc9AOBXc9jzc=; b=kdA/TjMlX7MC7zR/+DJ58FbK78jkQVPtgibKe4WxPdFfj1XDaD0oqtgHnzKNymJGfG uMbkpszS6cD0vNumc52KXAPMi5pqjgbWSneDR1+Uob0/dXsPjXGm7DEWre4oZA10aCZg hBDSILFBPNR2YIRA58MbxL6IOqgMrMn7ylUinfu2AX2L44sEzBaB4E/+8YL6SdVqRevV 5JO7YkdH3q7+yT2D/d64gyAPMY6R6OmQITBnaQPopCXuMsyW8/HKUY7id0Qi+eklubYe phatCCh8L7eMwoJkG/6Cc/pi8TYZEu5dB0bxAbexJaa20Ca0lpJtPOr54Z6s1WQIMI9x zuWQ== 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 d65si21251330pgc.330.2019.05.21.09.54.55; Tue, 21 May 2019 09:55:09 -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 S1729127AbfEUQxX (ORCPT + 99 others); Tue, 21 May 2019 12:53:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:36744 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727817AbfEUQxW (ORCPT ); Tue, 21 May 2019 12:53:22 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4FFEB217F5; Tue, 21 May 2019 16:53:21 +0000 (UTC) Date: Tue, 21 May 2019 12:53:19 -0400 From: Steven Rostedt To: Josh Poimboeuf Cc: Johannes Erdfelt , Joe Lawrence , Jessica Yu , Jiri Kosina , Miroslav Benes , Ingo Molnar , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: Oops caused by race between livepatch and ftrace Message-ID: <20190521125319.04ac8b6c@gandalf.local.home> In-Reply-To: <20190521164227.bxdff77kq7fgl5lp@treble> References: <20190520194915.GB1646@sventech.com> <90f78070-95ec-ce49-1641-19d061abecf4@redhat.com> <20190520210905.GC1646@sventech.com> <20190520211931.vokbqxkx5kb6k2bz@treble> <20190520173910.6da9ddaf@gandalf.local.home> <20190521141629.bmk5onsaab26qoaw@treble> <20190521104204.47d4e175@gandalf.local.home> <20190521164227.bxdff77kq7fgl5lp@treble> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 21 May 2019 11:42:27 -0500 Josh Poimboeuf wrote: > Hm. I suppose using ftrace_lock might be less risky since that lock is > only used internally by ftrace (up until now). But I think it would > also make less sense because the text_mutex is supposed to protect code > patching. And presumably ftrace_lock is supposed to be ftrace-specific. > > Here's the latest patch, still using text_mutex. I added some lockdep > assertions to ensure the permissions toggling functions are always > called with text_mutex. It's running through 0-day right now. I can > try to run it through various tests with CONFIG_LOCKDEP. Yeah, text_mutex probably does make more sense. ftrace_mutex was around before text_mutex as ftrace was the first one to do the runtime patching (after boot has finished). It wasn't until we introduced text_poke that we decided to create the text_mutex locking as well. > > > From: Josh Poimboeuf > Subject: [PATCH] livepatch: Fix ftrace module text permissions race Thanks, I'll try to find some time to test this as well. -- Steve