Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp717082ybz; Wed, 15 Apr 2020 17:23:49 -0700 (PDT) X-Google-Smtp-Source: APiQypLpCFBhLLuphmRYk+liGUDJ8QK0lQ7fN7r/YexdF2d4q+ZlVKs0VEcqwdh539P+6cafy/9t X-Received: by 2002:a17:906:d18e:: with SMTP id c14mr7686591ejz.120.1586996628926; Wed, 15 Apr 2020 17:23:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586996628; cv=none; d=google.com; s=arc-20160816; b=eRwiqLDBDI19aa2VWlgRQbzcR8F7hkqCHkCG6F8rOo2NYWzj6tWKIh/xNYSOFrG7s6 LHvP77kyy0MJixrvbY7ke0yp6Mcmz2bnrP/AfOIwFDSy2N+iQ3piIGloM5BrSXwngqBC L8MfWnw4rflptNBp3TcgiaTg4H4KUCeQwv3kZJe/fDIjsrSLRP1sv+5XomDQlPgLmDS/ YvajEUDmoY6NidD+7Nx6z1wzz7KyxsT4JF1kUpNseJXudm+VF88o2NxHlav5nmjYpaRx Zw8q8vI7pseTuR6uM8gNmsg6hbcOV4dYgT/oSDF+kgmi12DQfn03K0oj1xbp9oUnpXIQ +emg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=o3eM1tZfmQMcRnJYXT++oOFvPIFgK+wYaNmGs2fM6+8=; b=lkKV4rL1Oz9pKOM2PGtccg5IsuaVXZR7vjRcYO8xPqXueolOFT/rfN2dHieX7V3Wv3 +rdmYbxRcjaIeD36wfR80nzRg+HJJ25k+uN/SmRLDUlX6HOrxYkvBD2sydjYa7pKLcwi mCN79IodIa4GFcMUs34Q/zy4YWTnt925q0Waa6Z67W/1BSDXyoQNnUNpUgH2CSGWK9+Y +J+/4XR3uoa3at2Qx4eNiswJl2kR+Gzah8emQ5Mqg05jiSFcKs8RRvgPW3WV/r3HggAK xY4h8Bvll3X27RVuVdwQbYltnsuHOTW7mNLV0JBC3w64n7rsU0jfd7agmN2I0jHVykDa kfHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YMrgm++u; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r11si11638556ejb.49.2020.04.15.17.23.25; Wed, 15 Apr 2020 17:23:48 -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=@redhat.com header.s=mimecast20190719 header.b=YMrgm++u; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1416137AbgDOQdf (ORCPT + 99 others); Wed, 15 Apr 2020 12:33:35 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:21793 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1416090AbgDOQdd (ORCPT ); Wed, 15 Apr 2020 12:33:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586968412; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=o3eM1tZfmQMcRnJYXT++oOFvPIFgK+wYaNmGs2fM6+8=; b=YMrgm++uKB7tlX44bL380LgGD/wDT+Mt8fmdaOASmIE1WQXOWgHgqp35U2BcLxoLRszjcZ nI80PNeFelx/pIMz6ta1pVNQWuoCn37LeUEoEr694Cu2HUFpaq2JeE/nwt8VsbnRQuW7sL JeE1Yll9E0YbP75jtrasVFkcDDgEhKY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-456-SnfPGWtkNpWuZX1_2QFTIw-1; Wed, 15 Apr 2020 12:33:29 -0400 X-MC-Unique: SnfPGWtkNpWuZX1_2QFTIw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DF85F107BA97; Wed, 15 Apr 2020 16:33:05 +0000 (UTC) Received: from treble (ovpn-116-146.rdu2.redhat.com [10.10.116.146]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5483CA098C; Wed, 15 Apr 2020 16:33:05 +0000 (UTC) Date: Wed, 15 Apr 2020 11:33:03 -0500 From: Josh Poimboeuf To: Jessica Yu 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: <20200415163303.ubdnza6okg4h3e5a@treble> References: <9f0d8229bbe79d8c13c091ed70c41d49caf598f2.1586881704.git.jpoimboe@redhat.com> <20200415150216.GA6164@linux-8ccs.fritz.box> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200415150216.GA6164@linux-8ccs.fritz.box> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 15, 2020 at 05:02:16PM +0200, Jessica Yu wrote: > +++ 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); > } Hm, guess I should have tested with lockdep ;-) -- Josh