Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4575415ybb; Tue, 14 Apr 2020 09:55:54 -0700 (PDT) X-Google-Smtp-Source: APiQypJui8QmC4HI89jSTq66KJnwBoLq0uQx694dLpjevGt0mIOrSFLmYIGYBdpaiKVoVFUTbcMj X-Received: by 2002:aa7:ce86:: with SMTP id y6mr5698797edv.161.1586883353893; Tue, 14 Apr 2020 09:55:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586883353; cv=none; d=google.com; s=arc-20160816; b=WfmCFuOO7vgtjGjKzCXzewpPh5kC/wblrcUnh7HoEaIucx1xqFEzXo6vXHIy+5Nv/9 fcVAseQJiKAu7kpkr68UcmNqW/bogbMw79gfMRu5cSCwwNI99XgVTYXYitec4l/aUhaH BVWKPdg6PrCvbsD6pDlaYhVLVzvsZEcUwG7Gq7lLFi1kQra0o+3DjMZL779+gjvKLNsg AUt+mXpZJpZ9uu1TIRwyHvhy7Ink+E1LWh98OGjdfXOyl3ITMcibmeBP1z/Y+majgfb4 dsJkkL6KlVXBOS+8JxB+f7FFNrO8mQ4IGyWvFpGqRZ8ubk29l7ygmDVA++4OlGzQhWzy Gb2A== 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:date:subject:cc:to:from :dkim-signature; bh=ansrsv2hxb0Ty4Mz0j8p11EC1rt+8+lNlWzTh4/A3Hw=; b=NN0OK/DrQZizmP6BUQsl3ZJZTvA0hDfOvN5SD5IW4D7dZOAwVo131VyBO9V6siRyLW 3KyFpGZZmf13vDzErfqGniYq2oZGFe5tz0txhq3FEy4JXliqf89uPQXInJ1iRLzjya5+ kaeUTvtP8RUw3qcLQpWCY8+yaMgSH5kFCbHTJ1ou8q3VOPM2N/1Gg2IMHMW1HnXybiHH IKMkmeoagJDrNQasw4MJaCdV3MO6vs6KfaobvLLFLuGkuZ7Mn6yejq8K5kvth1xwZ5jG bC4d4lEJsULyAW4xPpiRTO5lRQ8xqI6rJlvRB5+C2hwgdCNcF6f7MZgeIcajjZEVvSXU h+bA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EDQ545hg; spf=pass (google.com: best guess record for 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 a13si10068027edq.515.2020.04.14.09.55.30; Tue, 14 Apr 2020 09:55:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for 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=EDQ545hg; spf=pass (google.com: best guess record for 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 S2391672AbgDNQac (ORCPT + 99 others); Tue, 14 Apr 2020 12:30:32 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:35340 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2391616AbgDNQ3Q (ORCPT ); Tue, 14 Apr 2020 12:29:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586881747; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ansrsv2hxb0Ty4Mz0j8p11EC1rt+8+lNlWzTh4/A3Hw=; b=EDQ545hgCMtJITFhLzlQgrnDiCTwpb6zs68jT6jKdtJ+JzGTS6b86LRsIsv/A59oWOeYqr ozAKdUMwxtGViF3dH7jwHU9TmzEDktNZGR8RiuqPNF/9tdIEG6vi/VyZF2DQlavVo6XREo G7lv92z8iu/ezJYZ0imYyNh6s7jaGvc= 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-213-j6zz4NoGO5ebvhD9g9UlRg-1; Tue, 14 Apr 2020 12:29:05 -0400 X-MC-Unique: j6zz4NoGO5ebvhD9g9UlRg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6349918FF68E; Tue, 14 Apr 2020 16:29:02 +0000 (UTC) Received: from treble.redhat.com (ovpn-116-146.rdu2.redhat.com [10.10.116.146]) by smtp.corp.redhat.com (Postfix) with ESMTP id A521D5DA66; Tue, 14 Apr 2020 16:29:01 +0000 (UTC) From: Josh Poimboeuf To: live-patching@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Jessica Yu Subject: [PATCH 6/7] livepatch: Remove module_disable_ro() usage Date: Tue, 14 Apr 2020 11:28:42 -0500 Message-Id: <9f0d8229bbe79d8c13c091ed70c41d49caf598f2.1586881704.git.jpoimboe@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 =3D patch->mod->klp_info; =20 if (klp_is_module(obj)) { - - mutex_lock(&text_mutex); - module_disable_ro(patch->mod); - /* * Only write module-specific relocations here * (.klp.rela.{module}.*). vmlinux-specific relocations were @@ -782,10 +778,6 @@ static int klp_init_object_loaded(struct klp_patch *= patch, patch->mod->core_kallsyms.strtab, info->symndx, patch->mod, obj->name); - - module_enable_ro(patch->mod, true); - mutex_unlock(&text_mutex); - if (ret) return ret; } --=20 2.21.1