Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp947280rwi; Mon, 31 Oct 2022 09:20:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6MzWg3qAJuzCpRIDjCbnxXloYAlhWpaVG+ES5ptZdJjEXnjVqwiWUIQKkWL28HOkQ8j5OW X-Received: by 2002:aa7:dd17:0:b0:463:a4a6:efc2 with SMTP id i23-20020aa7dd17000000b00463a4a6efc2mr39061edv.393.1667233246618; Mon, 31 Oct 2022 09:20:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667233246; cv=none; d=google.com; s=arc-20160816; b=uu5soWIKtSCYUstJ10j92zAwXBF8UEkEVNef5KPm+viUCmy69g6cyYS9mP9zU2fqwp Q13CxuzVACrix1+vplIY5opME/GxoGamL/x7szxt/s2lMSHsbZvzKb3n/TQ3k/hjLB9v hbwfCgJCh5JuIW4RI2FvkSoiQWEOaNymPVoWhFH7I22kFO5thkdnJRlk6sJxiB61JM5o mieI9pZrjwXZcG058JXoW1snpq/Qsa3QPCsSZUD6UPFgv96MILaGypKTj0RpJkdT2KVF 9sI/mt1i5DuU/ygr7VnHbORlHAecwNvYKta/2uwwpqPU0bJysNxoUwvWNIL5X8wv55R1 J74A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=5f0KAVsFXb/ej/un0lRY1Csig49umoppXqYjY155Z6g=; b=QYmPLsCfcYWUPFQErxhfUhAGughM1BqLmAQGf0X3JvaelMfk4zS2r4D4upkWN6HTeg KvZd27wdBuHu0i4U4DvIOk8DeB4hLV9SWsOYpAnP6paVmLZFtIRwin00CFV/YMclKPgw JwXBEYNhE3esBC5xU5lKTMxkuSYBgvOllay4f+9ns8ky3PCJbABp1JqgorD/3i8onlRg mSkyViz0VhWegUQQfPQAexEPkou8v+2GszDK9a8Y46P8g6HtxbFPJPQCffBzzFva9ibh WT/RFGZXi73ONSQXFtnKd6+O00wR9/RhoUlaqeMz2Cqkd++eqg1uPTxX6NoVXwMYEZMP wGdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=eZsV82B+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qf16-20020a1709077f1000b0078df24be362si8819004ejc.496.2022.10.31.09.20.21; Mon, 31 Oct 2022 09:20:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=eZsV82B+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231477AbiJaQCx (ORCPT + 99 others); Mon, 31 Oct 2022 12:02:53 -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> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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.