Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1660090rwl; Fri, 31 Mar 2023 14:48:28 -0700 (PDT) X-Google-Smtp-Source: AKy350Y5hQlUioMacD82+P6tuxpABK4Qa/ZEQxvaW5i+30jChMlgddQNTonFJVO1AEcDMe5114fI X-Received: by 2002:a17:906:7382:b0:93b:dddf:4be2 with SMTP id f2-20020a170906738200b0093bdddf4be2mr5749201ejl.3.1680299308046; Fri, 31 Mar 2023 14:48:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680299308; cv=none; d=google.com; s=arc-20160816; b=mNsYjz/mTUPSomj8ADeeZlRgb1CVItEqaQpaffVrwWmbCfNzSKkwybh4AIg69rHwGg fm11LJWqm6HkLDwG5kbnmNsFSGkuIphhhOR23itn/zLFIdZZCWiJdBkwzWda2MVw+l9B KQ96SSfjP6D+LxNqQ7a3PBoML7coEBlQ2R95MWdIPGeL7h6T/ZZB23KSxvHimw+UKdcJ 5lpnyL+t5zYL08lckPFkL0oS4Xgyem8wZK58OPp654pjpNBpSKeUMNzPKFVJobWVkP63 hzCcFbC2cSwNG1IHBdDlyLTeZsNK07Z99JgvoWS62/1AfCjv+LB+TQfsZ4OcBLy80J9D QfRg== 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=h5CSgtedxihi2QZcr+Ghagbg1u9AWPYWX/Bwef/bbyo=; b=NLc5K/IAQAVrPLYaeayW30Zrc2ykiM+i0aqmMYVKDjiW08LrPnXjA6QRlx00TFGdFu DaHuyvpqWpxDFNLw2R70ZTMnaWIL1DQU7SgaMsJn9IuQofQuXDgKiuPsu6YtC7Oybccg 56fgs1l84PNRdKsBagtP2xPfcdL/MVG4IZ6Z+06yUWwXodtuMWTGR/dORAtkUelcYpYz wrD3bD3C+ws7vm5ak0HDlbisiUfpIM6Bba+KsxGNQC5YdJGRVT3jqn66h0KwiJf+AElr RclDETdww45bK2DEwFYR9LQexT+meE0zevRQjBcHKyGU/aCAaVyOqyOmutJvmVQ4OE59 TxTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="ZY/og5wW"; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u20-20020a1709063b9400b00933f876a545si2815016ejf.516.2023.03.31.14.48.03; Fri, 31 Mar 2023 14:48:28 -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=@gmail.com header.s=20210112 header.b="ZY/og5wW"; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231923AbjCaVnV (ORCPT + 99 others); Fri, 31 Mar 2023 17:43:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229529AbjCaVnU (ORCPT ); Fri, 31 Mar 2023 17:43:20 -0400 Received: from mail-ua1-x933.google.com (mail-ua1-x933.google.com [IPv6:2607:f8b0:4864:20::933]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 219C518F9A; Fri, 31 Mar 2023 14:43:18 -0700 (PDT) Received: by mail-ua1-x933.google.com with SMTP id 89so17145901uao.0; Fri, 31 Mar 2023 14:43:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680298996; 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=h5CSgtedxihi2QZcr+Ghagbg1u9AWPYWX/Bwef/bbyo=; b=ZY/og5wWRWYU0c+i+G/s5X9D3y6gf3ry2Ktx6KHUiQ0zDAsweH1K786Z3ls3IGnP1a e1T38nQdWO1zotYVYYD2d0U3rRoRkoo6hXjhZnKjqYb/Y87uuRduhOeuO4gq1RbxMWRT Z9O7YBsa8XH5Bygu/+oh8liZ7vGdlyd3a3CFyEUl4UtgPFX1qjOZbqTFVf2Ce77bsE/f EjfJZfGmE2gwH4k6Ygs1QovRxLD5l3+wqHJQZ/S+yn+S82fUSOy+ikatTWqz6lD6y462 NVij3HpXqQAjaVMJRiLBpXZnmynXeW5cdx8xRfykYz+D8p8sXlaRk7I8FGY4GeItYLZD orQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680298996; 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=h5CSgtedxihi2QZcr+Ghagbg1u9AWPYWX/Bwef/bbyo=; b=AoRsYrqLDfT/AppdEUsFxBFDrHELE1nxAvTOi4y3PbqMwX9BhGhiGetPFcfEpPgVmk 48FL3j7FcYWRz088uLbT13OaqdBNAZ/YILEemOR5oyQfu0Ds5urcZ8IJAeIquhDTnOgj DmzQaiVmO7QEtHdWMBhfgBIGP78ZL9IsY10RsxuXlmZx8mMKuGOw7QkA1UioYTYXHXkX JclnLkXujui7CY8KXBkLIJNtVmTJ+5LZgY2qWorhar0AYGmi8Q1t2i5g1XoFEFcQQrWt qhmCz+faUjk8qSqcGUqwhMzabkN/DB2BxRJuCTHgvJFrZxCgT8OYtlnL3FXvdkcyJGIp ST6Q== X-Gm-Message-State: AAQBX9fmLBYJHHKD6M2B1F9aMvGv7L3CmvkdQK20EI2Mh570CrR9HJod h3JXbhUzHmMN518pgLk/B64pDxO/XkgCy5IKRCM= X-Received: by 2002:ab0:5b45:0:b0:73f:f15b:d9e3 with SMTP id v5-20020ab05b45000000b0073ff15bd9e3mr3279106uae.0.1680298996597; Fri, 31 Mar 2023 14:43:16 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: jim.cromie@gmail.com Date: Fri, 31 Mar 2023 15:42:50 -0600 Message-ID: Subject: Re: kmemleaks on ac3b43283923 ("module: replace module_layout with module_memory") To: Luis Chamberlain Cc: linux-modules@vger.kernel.org, song@kernel.org, LKML , Jason Baron , Greg KH Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 Fri, Mar 31, 2023 at 1:12=E2=80=AFPM Luis Chamberlain wrote: > > On Fri, Mar 31, 2023 at 11:08:23AM -0600, jim.cromie@gmail.com wrote: > > :#> uptime > > 09:45:32 up 1 day, 23:07, 0 users, load average: 0.07, 0.04, 0.01 > > :#> uname -a > > Linux (none) 6.3.0-rc1-f2-00001-gac3b43283923 #359 SMP PREEMPT_DYNAMIC > > Wed Mar 29 09:33:11 MDT 2023 x86_64 x86_64 x86_64 GNU/Linux > > > > the leaks I sent previously might be from/on a different commit, > > heres the relevant one > > > > fwiw, the config is unremarkable. it started with > > CONFIG_BUILD_SALT=3D"5.16.8-200.fc35.x86_64" > > then `make localmodconfig` to drop anything I dont have hw for > > then `virtme-configkernel --update` to pick up the 9p,etc config option= s > > And some extra DEBUG_* options > > If you'd like to see runs with others, or see the config itself, please= ask. > > If you wanna see things explode > > echo 0 > /proc/sys/vm/oom_dump_tasks > ./stress-ng --module 20 --module-name xfs > > This assumes xfs is not already loaded, and has all dependencies already > loaded. What would test the load_module() path. > > If you wanna see if the test is earlier, you can try a module which > is already loaded on your system. > > > :#> uname -a > > Linux (none) 6.3.0-rc1-f2-00001-gac3b43283923 #359 SMP PREEMPT_DYNAMIC > > Wed Mar 29 09:33:11 MDT 2023 x86_64 x86_64 x86_64 GNU/Linux > > :#> ./grok_kmemleak -n > > not: bless( { > > 'backtraces' =3D> { > > '[<0000000058fb276d>] __kmalloc_node_track_caller+0x4a/0x140 > > [<00000000a2f80203>] memdup_user+0x26/0x90 > > [<00000000f7cd3624>] strndup_user+0x3f/0x60 > > [<0000000098fd26c5>] load_module+0x188b/0x20e0 > > Can you do: > > gdb vmlinux > l *(load_module+0x188b) > > And provide the output? (gdb) l *(load_module+0x188b) 0xffffffff8122a4bb is in load_module (/home/jimc/projects/lx/wk-next/kernel/module/main.c:2820). 2815 goto free_modinfo; 2816 2817 flush_module_icache(mod); 2818 2819 /* Now copy in args */ 2820 mod->args =3D strndup_user(uargs, ~0UL >> 1); 2821 if (IS_ERR(mod->args)) { 2822 err =3D PTR_ERR(mod->args); 2823 goto free_arch_cleanup; 2824 } > > > }, 'LeakSet' ) > > mods: bless( { > > 'backtraces' =3D> { > > '[<0000000058fb276d>] __kmalloc_node_track_caller+0x4a/0x140 > > [<00000000ab7b01fd>] kstrdup+0x32/0x60 > > [<000000005ed25b98>] kobject_set_name_vargs+0x1c/0x90 > > [<0000000090fe19ca>] kobject_init_and_add+0x4d/0x90 > > [<0000000045666935>] mod_sysfs_setup+0xa9/0x6e0 > > Ok that is a specific enough hint. I'll take a review of this sysfs > path see what changed that could break. (gdb) l *(mod_sysfs_setup+0xa9) 0xffffffff8122d2d9 is in mod_sysfs_setup (/home/jimc/projects/lx/wk-next/kernel/module/sysfs.c:361). 356 357 mod->mkobj.mod =3D mod; 358 359 memset(&mod->mkobj.kobj, 0, sizeof(mod->mkobj.kobj)); 360 mod->mkobj.kobj.kset =3D module_kset; 361 err =3D kobject_init_and_add(&mod->mkobj.kobj, &module_ktype, NULL, 362 "%s", mod->name); 363 if (err) 364 mod_kobject_put(mod); 365 (gdb) > > > [<00000000d6f7187b>] load_module+0x1de3/0x20e0 (gdb) l *(load_module+0x1de3) 0xffffffff8122aa13 is in load_module (/home/jimc/projects/lx/wk-next/kernel/module/main.c:2856). 2851 pr_warn("%s: parameters '%s' after `--' ignored\n", 2852 mod->name, after_dashes); 2853 } 2854 2855 /* Link in to sysfs. */ 2856 err =3D mod_sysfs_setup(mod, info, mod->kp, mod->num_kp); 2857 if (err < 0) 2858 goto coming_cleanup; 2859 2860 if (is_livepatch_module(mod)) { > > [<0000000074361279>] __do_sys_finit_module+0x93/0xf0 > > [<000000004caeb948>] do_syscall_64+0x34/0x80 > > [<000000009f5d036c>] entry_SYSCALL_64_after_hwframe+0x46/0xb0' =3D>= 16 > > }, >> Luis