From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D72EAC38A2C for ; Fri, 17 Apr 2020 14:05:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B800C21973 for ; Fri, 17 Apr 2020 14:05:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Tip7V2Ta" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730872AbgDQOE7 (ORCPT ); Fri, 17 Apr 2020 10:04:59 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:55148 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730862AbgDQOE6 (ORCPT ); Fri, 17 Apr 2020 10:04:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1587132297; 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=lwqAf8hQ9NZ4TwR6KHxknyiHwy4+5aOuDvj+iSYZvz4=; b=Tip7V2Tax4SY2YO3FGcFmNg/P5sdAK09JluAH70HQza1EbwFP91o5TE8mV+M56vADvNwJj LncUq1ZrQ1weUib9fCYn7YNIukrQwG95L5/aMdySVt/xCXhkYuN99p1t1u3do8CWmAXdEU DoKmX3eAtqIKmqbqB1oFpCgZodRWeeg= 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-147-4QB27YtqOdOiJeXkRNPgYw-1; Fri, 17 Apr 2020 10:04:54 -0400 X-MC-Unique: 4QB27YtqOdOiJeXkRNPgYw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D42B5107B29B; Fri, 17 Apr 2020 14:04:52 +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 3572F5C1C5; Fri, 17 Apr 2020 14:04:52 +0000 (UTC) From: Josh Poimboeuf To: live-patching@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Jessica Yu Subject: [PATCH v2 8/9] livepatch: Remove module_disable_ro() usage Date: Fri, 17 Apr 2020 09:04:33 -0500 Message-Id: <11723c83107129047d3b9e5d5a026b14dce6d391.1587131959.git.jpoimboe@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Content-Transfer-Encoding: quoted-printable Sender: live-patching-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: live-patching@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. Acked-by: Peter Zijlstra (Intel) 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 a090185e8689..3ff886b911ae 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