Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp2248993rdh; Sat, 25 Nov 2023 22:01:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IGwHisyNuE/RjsJ9S5IlNb3wSmv2EoCzpND0dj1pCzeAAapqT7DA9vae+FloBOrM9H0YHm/ X-Received: by 2002:a17:90b:4f4e:b0:285:b67b:f435 with SMTP id pj14-20020a17090b4f4e00b00285b67bf435mr1289049pjb.41.1700978487743; Sat, 25 Nov 2023 22:01:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700978487; cv=none; d=google.com; s=arc-20160816; b=vlXdAzW6kcdjCLq+QYla3CeroXsam0C+i7cKIVlouMG89AKzltZl39g/NMhFEElXbL 54hAC44blWXR3DOWOcjaf+dTc2zfjvbE5OqsRKON3KZtQn9WyXFHDw8XmTQ7YTYjrc7y +KehtUb3TlxSWjWyi8xm9pUKKbbjgesZ9DOQrR1RKRswdXGyaqmJ3XsJV7BVY6Um2rGZ ZB9YYPm1ssvc7luy8SXgtP3fVQprHDgGJVBk8jYbCL4Yehkl9ZTQK3q5kTzEU5QCKCva jQKYGYvpR7J/9XYOu7946NADgTocGn9s3ky4jPDZzc8M4wpWc6lud+Ozj/sQWM70rJlV mIHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=zVBJvNUR0/pOzjVeXc6+sRDyqqnU2dxLFNeCeuHxDVU=; fh=hm8KtcG5XFjVZPkNvVhFffx0LGsjfjp8SyUB/UtwLxA=; b=wtDLWMURFtE79pQVh0PL19Z/HA7kXIUHDBYvmaoX4iugATQc41zHLxz1BmuBsxjK+1 IlU6KZ2YwzhvEcyU9Jt/wxmPLokbJk+LbEfnP1WJX6FtWuDo+dEdp53UEHAJ5IR/eQIE ml2XBd12HwWUEApBi0bm6YHdba0M9MFtipoF4jBa5V+8x38+Dwp4N2fjuyRVqjiIP9pP J/GQBQt9uh7Jo/Vepl3Fms6ksd84F/HdAX9RGAaEVtirJvurmLXBq4KBXH1XNJAtScfe 9V6K/K4rhRO4kVqJwxVUXEo2M/SAmh4i3zj+33j3Ltp619Veu21mDuHmYrdiIXPiZDPu ZveA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=deDQazEY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id n14-20020a17090ade8e00b002840019a45fsi7654884pjv.148.2023.11.25.22.01.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Nov 2023 22:01:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=deDQazEY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 26518807C74D; Sat, 25 Nov 2023 22:00:50 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229473AbjKZGAd (ORCPT + 99 others); Sun, 26 Nov 2023 01:00:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229447AbjKZGAc (ORCPT ); Sun, 26 Nov 2023 01:00:32 -0500 Received: from mail-vs1-xe35.google.com (mail-vs1-xe35.google.com [IPv6:2607:f8b0:4864:20::e35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EC4710B for ; Sat, 25 Nov 2023 22:00:38 -0800 (PST) Received: by mail-vs1-xe35.google.com with SMTP id ada2fe7eead31-462e70f1c20so320010137.0 for ; Sat, 25 Nov 2023 22:00:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700978437; x=1701583237; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=zVBJvNUR0/pOzjVeXc6+sRDyqqnU2dxLFNeCeuHxDVU=; b=deDQazEYemCGEm/n51V6uhPd/o/3oeo6qvjjfX7JBWvu7jILrJKsS9hXbF4CHFcAgD qv7T8nfbCiyapAuGSi+HYmPuKpVzYbv9drTh8n6UULD4oQ5ncF7FwITnuXgLxqOXrT7f KkPF5GyvTRRYR0MnOWfFFvJPCWlVKLr9rZ7TcQRv1gmDxwCZkHZiLSt+01ouk9qHOJet BanDpdt5lzGAvKQIA7ScpvdW0d+gaTGXi0WUw2sqgfmGW5/Hy9m75V9U5zmxopN8F1hU qclU6gO89E3oXHuZiARBNnCcYeksg5zU8tFtGj6s29Dw99ZF6bGB+gpjb4HwOC3dFDFu MU7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700978437; x=1701583237; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zVBJvNUR0/pOzjVeXc6+sRDyqqnU2dxLFNeCeuHxDVU=; b=GlTiI+x/B2uD13S6SCtF13Wx82X4A6VsdX1b1zDgy8jCSN6qtmNO/REtFeyWNcLLPO ViPTML/TBoweAvHY544tbqH/wZntDEcSa1zWT9WifdRREfZUCZKFo5iVL7UQTtznmjkL QfsdDb0cSv7UJ30iLnygtv63Oxr7lUeVE7I3QSNGoapkNCKkL6hfvhlDTWxYAxS+zDBA pbow4xaSiZxmBzZdS0ke9Cntg90Npoapz4yBRse4GU1Q/Yl0GR5E/t627anxhpCXFzoM x3DtiGUriqyNNFN+vZKXjDvdUPN2qfXCCPa2zdxZA4I2ro1WE8lm8u2PRxIQtkuj+5T3 rzmg== X-Gm-Message-State: AOJu0YzljBPwKB1PTaEtMiTMX6OwIMTTgP47I5fBFNCil8FN9bmLPuOC 8mLWfMnnGRQUdGBwYulz3fYaaGautHvNZ3jAwbc= X-Received: by 2002:a67:e444:0:b0:462:9ad2:9f75 with SMTP id n4-20020a67e444000000b004629ad29f75mr2395567vsm.14.1700978437150; Sat, 25 Nov 2023 22:00:37 -0800 (PST) MIME-Version: 1.0 References: <20231103131011.1316396-1-lb@semihalf.com> <20231103131011.1316396-8-lb@semihalf.com> In-Reply-To: From: jim.cromie@gmail.com Date: Sat, 25 Nov 2023 23:00:11 -0700 Message-ID: Subject: Re: [PATCH v1 07/12] dyndbg: repack struct _ddebug To: =?UTF-8?Q?=C5=81ukasz_Bartosik?= Cc: Jason Baron , Andrew Morton , Kees Cook , Douglas Anderson , Guenter Roeck , Yaniv Tzoreff , Benson Leung , Steven Rostedt , Vincent Whitchurch , Pekka Paalanen , Sean Paul , Daniel Vetter , linux-kernel@vger.kernel.org, upstream@semihalf.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Sat, 25 Nov 2023 22:00:50 -0800 (PST) On Fri, Nov 24, 2023 at 7:39=E2=80=AFAM =C5=81ukasz Bartosik wrote: > > niedz., 12 lis 2023 o 17:28 =C5=81ukasz Bartosik napisa= =C5=82(a): > > > > pt., 10 lis 2023 o 22:01 napisa=C5=82(a): > > > > > > On Fri, Nov 10, 2023 at 7:51=E2=80=AFAM =C5=81ukasz Bartosik wrote: > > > > > > > > sob., 4 lis 2023 o 02:49 napisa=C5=82(a): > > > > > > > > > > On Fri, Nov 3, 2023 at 7:10=E2=80=AFAM =C5=81ukasz Bartosik wrote: > > > > > > > > > > > > From: Jim Cromie > > > > > > > > > > > > Move the JUMP_LABEL to the top of the struct, since theyre both > > > > > > align(8) and this closes a pahole (unfortunately trading for pa= dding, > > > > > > but still). > > > > > > > > > > > > Signed-off-by: Jim Cromie > > > > > > > > > > let me add, I havent really tested this, nevermind thorough. > > > > > specifically, I didnt look for any offset dependence on the stati= c-key > > > > > inside their container. > > > > > Conversely, maybe theres a free default or something in there. > > > > > > > > > > > > > Any idea how to properly test the relocation of the key ? > > > > > > I was hoping Jason knew it from memory. > > > > > > I have booted dd-kitchen-sink, which includes it, and it didnt melt t= he box. > > > > > > I just checked `pahole vmlinux` output for the existence of 0-offset = keys. > > > Its not conclusive, cuz im only looking at x86. > > > > > > it does occur, but only for "sub-types". > > > > > > struct static_key_true { > > > struct static_key key; /* 0 = 16 */ > > > > > > /* size: 16, cachelines: 1, members: 1 */ > > > /* last cacheline: 16 bytes */ > > > }; > > > struct static_key_false { > > > struct static_key key; /* 0 = 16 */ > > > > > > /* size: 16, cachelines: 1, members: 1 */ > > > /* last cacheline: 16 bytes */ > > > }; > > > struct static_key_false_deferred { > > > struct static_key_false key; /* 0 = 16 */ > > > ...}; > > > struct static_key_mod { > > > struct static_key_mod * next; /* 0 = 8 */ > > > ...}; > > > struct static_key_deferred { > > > struct static_key key; /* 0 = 16 */ > > > > I will test it on arm64. > > Hi Jim, > > I verified that relocation of JUMP_LABEL to the top of the _ddebug > struct does not brak dynamic debug functionality on arm64. > I double checked I had CONFIG_JUMP_LABEL enabled in the kernel config for= arm64. > I was able to enable/disable callsites and see debug logs being written. > > But if you're concerned there might be issue related to that > relocation on other architectures then let's drop this patch > and I will use pahole instead of padding for location of flags and > trace destination fields. > What do you think ? > On balance, I think it should go in. 0 - my bias was towards abundance of paranoia 1 - youve done real work to evaluate the actual risk 2 - Jason is on thread, hasnt said WHOA 3 - actual patches have seen some testing (lkp-robot included) 4 - static-keys/jump-labels have been around a long time One new topic: Do you have any thoughts or plans wrt self-testing ? the addition of private instances, that can be opened & closed, and written to by +T:private_1 would benefit greatly from a test harness to validate it. so far all Ive done is demo scripts :-) thanks > Thanks, > Lukasz