Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp714047ybz; Wed, 15 Apr 2020 17:19:32 -0700 (PDT) X-Google-Smtp-Source: APiQypJFPPc0xPSPVFG69QVkdds1IMsE8I9S0UpWEGIr8+zJ6hE/ujNJhsy555we7twpCSpxvRQm X-Received: by 2002:a17:906:a98c:: with SMTP id jr12mr7561325ejb.148.1586996371917; Wed, 15 Apr 2020 17:19:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586996371; cv=none; d=google.com; s=arc-20160816; b=PAyhZ0oBh/7BGXjAy8nske4W41mZmzkW9bWi/7NOjV8otrkFm+7x21kWxbZnzh/bGz I1+/P0Pf5jxUEQn1qrh09d4LQH5M88lKTMYz2Zpl0Zb1Lb/39vbmvElONl233Vhao+BY hMU9QJwNeGYnk7yfDOLFCAN3K2uDJ56qjzfnlq2MEXLtoa4UWaay98M9hGvVrM0XUcg8 IYECkggi8TpTXK5kHdewHTILc135Ri2rucBMGFqc4gMRprZeaYGfODLpAN2IKIA9etjL eQB2dLc20Qy3jhX5Amu+sWc5rfbYCkA2SjGuDdVMDM+m+caDKB3/RHXZNiXTEeSu+TmD Qe3w== 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=MmQx0dVAk47tc0qbdb/pjLy+NqzcVcD5V6FFezqkxFQ=; b=EZNDSWrKfVwdDXeXNHQDXV4C0aKAbvKIJuJrWHl8I9QkZFlGC9dRgNH3+aoF+ofL4q O95ykGwPvMAw+bPC/3anJpRAEZEBMQAyNtA5zObE2IN04aFt8e7QCapLMqwWfYIEQt0g S8L6Z27NX1DW8wglEVVXqAHNKP44NspoUgmDE7Ttn9HkabSqi96AH6Lj0nF/ehj1CFiG j2qPWFBLml/24EWCmtDqwKKIADyIuTpQ12gK/vo7woqEQVML3hHpJUB6dSkdgh+QpWa1 6pPZVZsf8d4JjRiQ3VPK2f3FDD9grKpbn9XWty1HJikM3Ma4Dxmc4UzLZpm5zEidmCaW 0j2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KwSFo2KN; 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 y1si12699159edp.606.2020.04.15.17.19.08; Wed, 15 Apr 2020 17:19:31 -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=KwSFo2KN; 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 S1415509AbgDOQR0 (ORCPT + 99 others); Wed, 15 Apr 2020 12:17:26 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:32971 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2406901AbgDOQRU (ORCPT ); Wed, 15 Apr 2020 12:17:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586967439; 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=MmQx0dVAk47tc0qbdb/pjLy+NqzcVcD5V6FFezqkxFQ=; b=KwSFo2KNk12iAz35hNtXpwVJqxdXP2GlsNi+LEsfC0Udds0Z/KoLJCVmj8SqxZhdQ168T2 JcsmbB8oXDvvxhEgJWTvZsaEOVIrk3LYu7t73h1lqHFKOWyysR7WBnor0QBSJtUeZ5TuAd 7EayHxP45HvbR/orZwo2vCHKgN4Hhfc= 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-467-6TTB5x0aOfKoaNrm9VTKRQ-1; Wed, 15 Apr 2020 12:17:17 -0400 X-MC-Unique: 6TTB5x0aOfKoaNrm9VTKRQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 15133101000A; Wed, 15 Apr 2020 16:17:09 +0000 (UTC) Received: from treble (ovpn-116-146.rdu2.redhat.com [10.10.116.146]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 61CCF1001DD8; Wed, 15 Apr 2020 16:17:08 +0000 (UTC) Date: Wed, 15 Apr 2020 11:17:06 -0500 From: Josh Poimboeuf To: Peter Zijlstra Cc: live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, Jessica Yu Subject: Re: [PATCH 0/7] livepatch,module: Remove .klp.arch and module_disable_ro() Message-ID: <20200415161706.3tw5o4se2cakxmql@treble> References: <20200414182726.GF2483@worktop.programming.kicks-ass.net> <20200414190814.glra2gceqgy34iyx@treble> <20200415142415.GH20730@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200415142415.GH20730@hirez.programming.kicks-ass.net> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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 04:24:15PM +0200, Peter Zijlstra wrote: > > It bothers me that both the notifiers and the module init() both see the > > same MODULE_STATE_COMING state, but only in the former case is the text > > writable. > > > > I think it's cognitively simpler if MODULE_STATE_COMING always means the > > same thing, like the comments imply, "fully formed" and thus > > not-writable: > > > > enum module_state { > > MODULE_STATE_LIVE, /* Normal state. */ > > MODULE_STATE_COMING, /* Full formed, running module_init. */ > > MODULE_STATE_GOING, /* Going away. */ > > MODULE_STATE_UNFORMED, /* Still setting it up. */ > > }; > > > > And, it keeps tighter constraints on what a notifier can do, which is a > > good thing if we can get away with it. > > Moo! -- but jump_label and static_call are on the notifier chain and I > was hoping to make it cheaper for them. Should we perhaps weane them off the > notifier and, like ftrace/klp put in explicit calls? > > It'd make the error handling in prepare_coming_module() a bigger mess, > but it should work. So you're wanting to have jump labels and static_call do direct writes instead of text pokes, right? Makes sense. I don't feel strongly about "don't let module notifiers modify text". But I still not a fan of the fact that COMING has two different "states". For example, after your patch, when apply_relocate_add() is called from klp_module_coming(), it can use memcpy(), but when called from klp module init() it has to use text poke. But both are COMING so there's no way to look at the module state to know which can be used. I hate to say it, but it almost feels like another module state would be useful. -- Josh