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 D293FECAAA1 for ; Mon, 31 Oct 2022 16:02:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230502AbiJaQCw (ORCPT ); Mon, 31 Oct 2022 12:02:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230244AbiJaQCv (ORCPT ); Mon, 31 Oct 2022 12:02:51 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04DB41261E; Mon, 31 Oct 2022 09:02:49 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id A5C9A1F8BF; Mon, 31 Oct 2022 16:02:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1667232168; 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=5f0KAVsFXb/ej/un0lRY1Csig49umoppXqYjY155Z6g=; b=eZsV82B+J19cWmH9zItt2iMfa9634CyuWIIGXCQaxVv/7DIedpBQ9a2pbA6Vte67mdjjDM ofz02mVR7oIkhDVTyai57snwO48I4si2YtrlXCYJvSz2S2MR4ItCZoTTSvOZa0c1yWW/Zl ZZJ1KZTiYMrMlER9BMd24A1Kmljs+X8= Received: from suse.cz (unknown [10.100.201.202]) (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 766DD2C141; Mon, 31 Oct 2022 16:02:48 +0000 (UTC) Date: Mon, 31 Oct 2022 17:02:47 +0100 From: Petr Mladek To: Marcos Paulo de Souza Cc: linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, jpoimboe@redhat.com, joe.lawrence@redhat.com Subject: Re: [PATCH v2 3/4] livepatch/shadow: Introduce klp_shadow_type structure Message-ID: References: <20221026194122.11761-1-mpdesouza@suse.com> <20221026194122.11761-4-mpdesouza@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221026194122.11761-4-mpdesouza@suse.com> Precedence: bulk List-ID: X-Mailing-List: live-patching@vger.kernel.org On Wed 2022-10-26 16:41:21, Marcos Paulo de Souza wrote: > The shadow variable type will be used in klp_shadow_alloc/get/free > functions instead of id/ctor/dtor parameters. As a result, all callers > use the same callbacks consistently[*][**]. > > The structure will be used in the next patch that will manage the > lifetime of shadow variables and execute garbage collection automatically. > > [*] From the user POV, it might have been easier to pass $id instead > of pointer to struct klp_shadow_type. > > It would require registering the klp_shadow_type so that > the klp_shadow API could find ctor/dtor for the given id. > It actually will be needed for the garbage collection anyway > because it will define the lifetime of the variables. > > The bigger problem is that the same klp_shadow_type might be > used by more livepatch modules. Each livepatch module need > to duplicate the definition of klp_shadow_type and ctor/dtor > callbacks. The klp_shadow API would need to choose one registered > copy. > > The definitions should be compatible and they should stay as long > as the type is registered. But it still feels more safe when > klp_shadow API callers use struct klp_shadow_type and ctor/dtor > callbacks defined in the same livepatch module. > > This problem is gone when each livepatch explicitly uses its > own struct klp_shadow_type pointing to its own callbacks. This paragraph seems redundant. It more or less repeats what is said in the previous one. > [**] test_klp_shadow_vars.c uses a custom @dtor to show that it was called. > The message must be disabled when called via klp_shadow_free_all() > because the ordering of freed variables is not well defined there. > It has to be done using another hack after switching to > klp_shadow_types. > > Co-developed-by: Petr Mladek > Signed-off-by: Petr Mladek > Signed-off-by: Marcos Paulo de Souza I am never sure how the co-authoring should be done ;-) But I believe that the author should always be the first one. And the other author should be listed either by Co-developer-by: or by Signed-off-by: but not by both tags. So, it should be: Signed-off-by: Marcos Paulo de Souza Co-developed-by: Petr Mladek With the removed paragraph and updated tags: Reviewed-by: Petr Mladek Best Regards, Petr PS: No need to resend the patch. I could do the two changes when pushing it.