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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F03D9C433EF for ; Wed, 16 Mar 2022 14:55:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350666AbiCPO4k (ORCPT ); Wed, 16 Mar 2022 10:56:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239686AbiCPO4j (ORCPT ); Wed, 16 Mar 2022 10:56:39 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93EFA66211; Wed, 16 Mar 2022 07:55:25 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 4EC9521108; Wed, 16 Mar 2022 14:55:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1647442524; h=from:from:reply-to: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=NXMA/Pj4MkM0jtnceee8WzxTN05heTV2kaXZm6L30uw=; b=QuXrVF7cnCVfdd6o/hNe5x297tISgC7dDlxMmyd/phdT0zsbxaGvQm29fFTL6D6Wob5/O7 Ae0nbqSkzBdqZ8rMAasDxbfi2/9LpEnlvmAz1Ig8nfylZhQQhBcT1jtMdWCUtIq1SHip93 lBw14Zc/oc7h82hykxw6Z1sDSVSqHj4= Received: from suse.cz (unknown [10.100.216.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 31590A3B8A; Wed, 16 Mar 2022 14:55:24 +0000 (UTC) Date: Wed, 16 Mar 2022 15:55:23 +0100 From: Petr Mladek To: Chengming Zhou Cc: jpoimboe@redhat.com, jikos@kernel.org, mbenes@suse.cz, joe.lawrence@redhat.com, live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, songmuchun@bytedance.com, qirui.001@bytedance.com Subject: Re: [PATCH v3] livepatch: Don't block removal of patches that are safe to unload Message-ID: References: <20220312152220.88127-1-zhouchengming@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220312152220.88127-1-zhouchengming@bytedance.com> Precedence: bulk List-ID: X-Mailing-List: live-patching@vger.kernel.org On Sat 2022-03-12 23:22:20, Chengming Zhou wrote: > module_put() is not called for a patch with "forced" flag. It should > block the removal of the livepatch module when the code might still > be in use after forced transition. > > klp_force_transition() currently sets "forced" flag for all patches on > the list. > > In fact, any patch can be safely unloaded when it passed through > the consistency model in KLP_UNPATCHED transition. > > By other words, the "forced" flag must be set only for livepatches > that are being removed. In particular, set the "forced" flag: > > + only for klp_transition_patch when the transition to KLP_UNPATCHED > state was forced. > > + all replaced patches when the transition to KLP_PATCHED state was > forced and the patch was replacing the existing patches. > > Signed-off-by: Chengming Zhou Looks reasonable, passes livepatch tests: Reviewed-by: Petr Mladek Tested-by: Petr Mladek Just let me repeat. The "force" flags must be used carefully because it breaks the consistency model. Best Regards, Petr