Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp710851ybz; Wed, 15 Apr 2020 17:15:16 -0700 (PDT) X-Google-Smtp-Source: APiQypICfLUjwJahDh0IFbCEDDVVa7XlkiuBY5KoWP45Jk1aNyTiuCXw2OsG/JH1N/rhavFRQ6Ck X-Received: by 2002:a17:907:2054:: with SMTP id pg20mr3808981ejb.127.1586996115888; Wed, 15 Apr 2020 17:15:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586996115; cv=none; d=google.com; s=arc-20160816; b=PSy8Uuqg9gYaDVB7eFIEc3lTdVEauc1xd+w9r7oK/ZYP6wNGXfWBwqXKsPFTkxiXHa BRT4niswD6zuH+xvga8WpcSgzHpP15cdB7sNLO7PYJN7ATpqu7bNj9w/EUjX+rNdFE+4 0DKaMNjscqhkgRggDJgOwZD2sSWYtznL0CWPgW5rXLMfm/hkZr3Xi/sbqmDqFc5JVgJL GjrBxOk/bkNVaZYavQ2N+sVq66SPxDCQVGtZw3K4Uqc4Hg5zt5xSl234UGjtslemLuxp MGSxSqetgPkZPJQDFU/x3Ava3loMVkx1mmjGmJ7CHt/phYwVLCbIC9g0rGUnjb6MO5Xb NVvQ== 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:dkim-signature; bh=QDwBnCqAqngS1AniTyQtrnkXiNrnm1ypL3hC5RbDYoU=; b=V2ih6XBW5RSxnkTJB91Oo6EdotlcqYG3s1cBMag5FYrkZHKhIwgP9RIU9pRmJnsjzJ 208/u8CCOeiiZVJZ2K+VLuKNQtM2I8e/jzRgTqyig+1LPgAI/3/jlWaeUttY1iYAbYeG +WVZFao8zgUJpfpUb00SYJzOy1VBYyMdRmf4dyx4UO+B0jD1f5I/OQEZAOPvOx6Mb3F0 aFitJ7Ff7f60FVbN6+J/xlBM7FAboJQrxVsfJJIz+mGa3Fuzch1bXVePb7YTawEtTRQo TTgWGZAp+H+vDtpYfPhGF14u5GcJp9HA3POzCdzS78sf3FQSRBw8DFNU4RfFMHOeP+8w a4SQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nPEAM9Hp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id m6si11482954edq.603.2020.04.15.17.14.52; Wed, 15 Apr 2020 17:15:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nPEAM9Hp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S2389124AbgDOPCY (ORCPT + 99 others); Wed, 15 Apr 2020 11:02:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:43476 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729666AbgDOPCV (ORCPT ); Wed, 15 Apr 2020 11:02:21 -0400 Received: from linux-8ccs.fritz.box (p3EE2C7AC.dip0.t-ipconnect.de [62.226.199.172]) (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 CF8572076A; Wed, 15 Apr 2020 15:02:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586962940; bh=xa6f99U25qSXApPs4fRkURvkgMb0zfOGAin9cSoNDkY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=nPEAM9HpwWDso+/0bKiVX7Hz8ysCJ9twOqNFYtr78pcJDBppKm/dk0lGyy8qh4DAv BYwNcLT7AKrrRvAG0cu5iR+LKDGJy6OY2Db0R2pQz8tI0J8ddjLod71vS9dhF0abMP 8f/75JkQ35kBnOjfXTDVg3/YbJ4yGCrsBw7tSoJo= Date: Wed, 15 Apr 2020 17:02:16 +0200 From: Jessica Yu To: Josh Poimboeuf Cc: live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, Peter Zijlstra Subject: Re: [PATCH 6/7] livepatch: Remove module_disable_ro() usage Message-ID: <20200415150216.GA6164@linux-8ccs.fritz.box> References: <9f0d8229bbe79d8c13c091ed70c41d49caf598f2.1586881704.git.jpoimboe@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <9f0d8229bbe79d8c13c091ed70c41d49caf598f2.1586881704.git.jpoimboe@redhat.com> X-OS: Linux linux-8ccs 4.12.14-lp150.12.61-default x86_64 User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org +++ Josh Poimboeuf [14/04/20 11:28 -0500]: >With arch_klp_init_object_loaded() gone, and apply_relocate_add() now >using text_poke(), livepatch no longer needs to use module_disable_ro(). > >The text_mutex usage can also be removed -- its purpose was to protect >against module permission change races. > >Signed-off-by: Josh Poimboeuf >--- > kernel/livepatch/core.c | 8 -------- > 1 file changed, 8 deletions(-) > >diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c >index 817676caddee..3a88639b3326 100644 >--- a/kernel/livepatch/core.c >+++ b/kernel/livepatch/core.c >@@ -767,10 +767,6 @@ static int klp_init_object_loaded(struct klp_patch *patch, > struct klp_modinfo *info = patch->mod->klp_info; > > if (klp_is_module(obj)) { >- >- mutex_lock(&text_mutex); >- module_disable_ro(patch->mod); >- Don't you still need the text_mutex to use text_poke() though? (Through klp_write_relocations -> apply_relocate_add -> text_poke) At least, I see this assertion there: void *text_poke(void *addr, const void *opcode, size_t len) { lockdep_assert_held(&text_mutex); return __text_poke(addr, opcode, len); } Jessica