Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp6190520ybi; Wed, 29 May 2019 04:20:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqziEsM9Q6gnFXrEuY61iwUb/CAeTvXqAH6R0ZMqUMLNE4u3Bt3mVdkf/tNXLLmjnu0nPdoo X-Received: by 2002:a17:902:b084:: with SMTP id p4mr71936302plr.59.1559128827549; Wed, 29 May 2019 04:20:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559128827; cv=none; d=google.com; s=arc-20160816; b=c9F7vfqnR1+yLGL+vsLkYhkwgunWp7AkTJREtE0in5LzwUJckpU6erPEWDMErav1PU IuHPyLt74CQfSlMexpL9t96/hHz4f1bFj/TlAxrQZRe1LgSXm1ETZy6KJ58uxWjBXSxJ hp9kIaTYmEakklo1+HuBUy4p0NOfL6Bzd5QHT3ZvDD2smRIPZBq4UqZVfRb/1I5IckK8 CQeXyXMvVnwvl/pJ5+I0YYpz1WomzjRZI8m445//ZF/OUXgBSRI7ZapM5etLJ42ZoqTv ZseUaHxl8Xh81HHlYk3FEz1trBobz9/a3hnpElWInKbEWYPHyBf85XlkdWu9cRooR2AJ No0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=FkZqpynYq3Y3XC3YJBMMePvZ5lPfXMwKY9xyX+XOElI=; b=LVcccJOYNCk7T0g9FvoD/RhmWDsJ2sIf+ArRmyD1j8/JQChay2j9QrB19C/bGkt0uq 0JXv6IP40xcNcmEzpaIMLu+PsZXZ9RHEVqKYSdwVYQqo5TvVCN+IzyKOHJ83LKKEnItw OWWVTfJ9Ucn/jpMe4Z0ivJ3xhcaSQbQgnkrOeOvRQcleNHmwbmZeFciZ+pvdlAmUNvd+ GZ3n/xd3iqcBDf2JwDkNK1kxGymMOaGKrrLUQHGtC8jsj6gu5cHl/6GG4o/vzFxc7f/J Cid2hlefszLxQNKlrIUYpY2sJK55CnZOp1Sxl0yoeCjzJ2isBa/Xe9jLfk1vrbClGnh3 STkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mMZ8+pWZ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l13si6681865pjq.69.2019.05.29.04.20.09; Wed, 29 May 2019 04:20:27 -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; dkim=pass header.i=@kernel.org header.s=default header.b=mMZ8+pWZ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726372AbfE2LRZ (ORCPT + 99 others); Wed, 29 May 2019 07:17:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:58838 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726018AbfE2LRZ (ORCPT ); Wed, 29 May 2019 07:17:25 -0400 Received: from pobox.suse.cz (prg-ext-pat.suse.com [213.151.95.130]) (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 45FAC20644; Wed, 29 May 2019 11:17:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559128645; bh=Smat1Yuif21heju3QNdZ7S8YbrPWmVKB3ywV3J2PHnQ=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=mMZ8+pWZ+INzw2O5fqsaC5UFON3C3AHUXRTTwZTJ6pW8fMxXIzTvVE8RAtExGJa+t XqTQuU+faKgbwRAPjR5zltWcBNYUROYFm+Xbt2mrAdPlOx0KG0aLzG+q7rfNzdNNVh xT43K791QRfXK7tU/78YBGvlTX0cjyqhVenog8Xs= Date: Wed, 29 May 2019 13:17:21 +0200 (CEST) From: Jiri Kosina To: Steven Rostedt cc: Josh Poimboeuf , Johannes Erdfelt , Joe Lawrence , Jessica Yu , Miroslav Benes , Ingo Molnar , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: Oops caused by race between livepatch and ftrace In-Reply-To: <20190521125319.04ac8b6c@gandalf.local.home> Message-ID: 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> <20190521125319.04ac8b6c@gandalf.local.home> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 21 May 2019, Steven Rostedt 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, Jessica, any final word on this? Thanks, -- Jiri Kosina SUSE Labs