From patchwork Thu Jul 14 15:39:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Tomlin X-Patchwork-Id: 12918138 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 14898C43334 for ; Thu, 14 Jul 2022 15:39:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240363AbiGNPjo (ORCPT ); Thu, 14 Jul 2022 11:39:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240131AbiGNPjm (ORCPT ); Thu, 14 Jul 2022 11:39:42 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E86E31903D for ; Thu, 14 Jul 2022 08:39:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657813180; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gdTH44nst3sD0nXnKIJ6b64daWYUB1e/UFpgOGWaKDE=; b=MmA4vD9Ul1BxlU7OBFix6jO7AnjT8Oop8Q+yvIQBBxxegDpvv2cw2uQPCAq68R9D5tWpHv lmICIOfyfLg4E7XWrjlUuky4PWa3CzTjkwtpzqfI0UhUvGVmGWxGCX4+Y82WuOjL1wHPwp d9LKAFKWHZPw/a2ZlXyCG5OHDOlt2dY= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-425-0SWA6JJgNE-JQyNHJzPVeA-1; Thu, 14 Jul 2022 11:39:38 -0400 X-MC-Unique: 0SWA6JJgNE-JQyNHJzPVeA-1 Received: by mail-wm1-f69.google.com with SMTP id m20-20020a05600c4f5400b003a03aad6bdfso796747wmq.6 for ; Thu, 14 Jul 2022 08:39:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gdTH44nst3sD0nXnKIJ6b64daWYUB1e/UFpgOGWaKDE=; b=VmNec8PvTmcsUJDmggOD/V5q4dIZdzlia9xYUYqMkOxNTMVqksEFdhxYEm3wc1wq2Z jP7lB5nxkFY0+5TjRyeUPFdUggxw7iMzlytxLx70ZAwSiTsrN2L2PB8Rj0oAryaHRJiB VUzgE8ganmpK+4o9cQFJZzF1yv0zg2jYXp1kQyCU0Uf/VaQ4H0CYpo+vZeizUiTM2yXr lh1Aw9tCs/bjFdjC3NAnxrZ16YE4cISWTq3P0X+Wn497UJG+zVI+hOoPR67cP+77Em85 HfI+ggfO58uzFGw4nrvo2YYND583wtiDiAQDwro3pYMJ1NXfJq0KHEhb3Bm/FgvaeFt+ kazw== X-Gm-Message-State: AJIora+vc6qDjwC7QLdbaL5NUY4/Ra03fXPBuUCbzcip/IDZBfolmpCn XGbjg2J/XLFlvBjDH6PWM+8nxABoruXalWrE5coGwqv8dceSZscygimoIqDOdTOY0bAfmnwVj/9 HcHlSeBaLp2wNDDmIDiXCRE41 X-Received: by 2002:a7b:c3d8:0:b0:3a2:fcc8:323 with SMTP id t24-20020a7bc3d8000000b003a2fcc80323mr8807232wmj.132.1657813177400; Thu, 14 Jul 2022 08:39:37 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v++nxe/HILzUPTol9MJsOq7z9uFWwle2BGD1WmbDuxwTakpTSviO6mtFLYqYSEKeUfbmFKiw== X-Received: by 2002:a7b:c3d8:0:b0:3a2:fcc8:323 with SMTP id t24-20020a7bc3d8000000b003a2fcc80323mr8807216wmj.132.1657813177237; Thu, 14 Jul 2022 08:39:37 -0700 (PDT) Received: from localhost (cpc111743-lutn13-2-0-cust979.9-3.cable.virginm.net. [82.17.115.212]) by smtp.gmail.com with ESMTPSA id m21-20020a05600c4f5500b0039c5ab7167dsm5870301wmq.48.2022.07.14.08.39.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jul 2022 08:39:36 -0700 (PDT) From: Aaron Tomlin To: mcgrof@kernel.org, christophe.leroy@csgroup.eu Cc: linux-kernel@vger.kernel.org, linux-modules@vger.kernel.org, atomlin@atomlin.com, oleksandr@natalenko.name, neelx@redhat.com Subject: [PATCH v2 1/3] module: Modify module_flags() to accept show_state argument Date: Thu, 14 Jul 2022 16:39:31 +0100 Message-Id: <20220714153933.2095776-2-atomlin@redhat.com> X-Mailer: git-send-email 2.34.3 In-Reply-To: <20220714153933.2095776-1-atomlin@redhat.com> References: <20220714153933.2095776-1-atomlin@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: No functional change. With this patch a given module's state information (i.e. 'mod->state') can be omitted from the specified buffer. Please note that this is in preparation to include the last unloaded module's taint flag(s), if available. Signed-off-by: Aaron Tomlin --- kernel/module/internal.h | 2 +- kernel/module/main.c | 11 +++++++---- kernel/module/procfs.c | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/kernel/module/internal.h b/kernel/module/internal.h index bc5507ab8450..60312f23c7d0 100644 --- a/kernel/module/internal.h +++ b/kernel/module/internal.h @@ -100,7 +100,7 @@ struct module *find_module_all(const char *name, size_t len, bool even_unformed) int cmp_name(const void *name, const void *sym); long module_get_offset(struct module *mod, unsigned int *size, Elf_Shdr *sechdr, unsigned int section); -char *module_flags(struct module *mod, char *buf); +char *module_flags(struct module *mod, char *buf, bool show_state); size_t module_flags_taint(unsigned long taints, char *buf); static inline void module_assert_mutex_or_preempt(void) diff --git a/kernel/module/main.c b/kernel/module/main.c index fed58d30725d..a4d23b0ebbc0 100644 --- a/kernel/module/main.c +++ b/kernel/module/main.c @@ -2970,24 +2970,27 @@ static void cfi_cleanup(struct module *mod) } /* Keep in sync with MODULE_FLAGS_BUF_SIZE !!! */ -char *module_flags(struct module *mod, char *buf) +char *module_flags(struct module *mod, char *buf, bool show_state) { int bx = 0; BUG_ON(mod->state == MODULE_STATE_UNFORMED); + if (!mod->taints && !show_state) + goto out; if (mod->taints || mod->state == MODULE_STATE_GOING || mod->state == MODULE_STATE_COMING) { buf[bx++] = '('; bx += module_flags_taint(mod->taints, buf + bx); /* Show a - for module-is-being-unloaded */ - if (mod->state == MODULE_STATE_GOING) + if (mod->state == MODULE_STATE_GOING && show_state) buf[bx++] = '-'; /* Show a + for module-is-being-loaded */ - if (mod->state == MODULE_STATE_COMING) + if (mod->state == MODULE_STATE_COMING && show_state) buf[bx++] = '+'; buf[bx++] = ')'; } +out: buf[bx] = '\0'; return buf; @@ -3120,7 +3123,7 @@ void print_modules(void) list_for_each_entry_rcu(mod, &modules, list) { if (mod->state == MODULE_STATE_UNFORMED) continue; - pr_cont(" %s%s", mod->name, module_flags(mod, buf)); + pr_cont(" %s%s", mod->name, module_flags(mod, buf, true)); } print_unloaded_tainted_modules(); diff --git a/kernel/module/procfs.c b/kernel/module/procfs.c index 9a8f4f0f6329..cf5b9f1e6ec4 100644 --- a/kernel/module/procfs.c +++ b/kernel/module/procfs.c @@ -91,7 +91,7 @@ static int m_show(struct seq_file *m, void *p) /* Taints info */ if (mod->taints) - seq_printf(m, " %s", module_flags(mod, buf)); + seq_printf(m, " %s", module_flags(mod, buf, true)); seq_puts(m, "\n"); return 0; From patchwork Thu Jul 14 15:39:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Tomlin X-Patchwork-Id: 12918140 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 4B1F1CCA483 for ; Thu, 14 Jul 2022 15:39:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240406AbiGNPj4 (ORCPT ); Thu, 14 Jul 2022 11:39:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240354AbiGNPjo (ORCPT ); Thu, 14 Jul 2022 11:39:44 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 35CAE2C647 for ; Thu, 14 Jul 2022 08:39:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657813182; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mpFwBg17MPLedEeXsKR0g11KSb+p+AI/SVxHMocug7Y=; b=ec1RPWh2V5eR7jxHnrhfI8aRAUnpcLGq5izFJDGWGCHjnDsjyzHcLck9axPA36wePFslmV DD1Uh6Zpyq9k2B0H/wYZFBVAAvfefa2wbttBUniX7COF2ucJKITxwov3Fk5WeIcvVDNOIU aWE1tjSY1KtjOzNJSYkG28YOCEwubR8= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-13-Wl0x9h42MzmdvMGsiEFH6A-1; Thu, 14 Jul 2022 11:39:40 -0400 X-MC-Unique: Wl0x9h42MzmdvMGsiEFH6A-1 Received: by mail-wm1-f71.google.com with SMTP id z20-20020a1c4c14000000b003a3020da654so717472wmf.5 for ; Thu, 14 Jul 2022 08:39:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mpFwBg17MPLedEeXsKR0g11KSb+p+AI/SVxHMocug7Y=; b=UKvtPAEMVAO3kZ0/xA5+JXnACkhwJa3EychNRS5BFccx4f5vjBt5YGwd2ENZPPCdrn ZF1xQcVvjoU7GOaULBRqtemOXx/b4ij6VBpbYMs7QwcNeH/m2XEVdAohiCQp2IylzrxH jN1IflHXI+p6w8/IckKEyPM1xa0wMbAt7DL80POZwxeeeC6o4/CDIli05HJcWHM2RoRL Qk2jbrt5RfSJJhYza085uhVk8C9WK31E+Sw36NzQ5M7pTOCCQWnMFVvpS3swJqtNDg6b QFBjBeiI8v0HHoBPEftjvulIapoUgRl8k+RSM4RqswF//UQjsl/kLyzgS8HkppkKaoz/ QiNg== X-Gm-Message-State: AJIora/NEUYvCKh31/7hNEwhziazd9KuXjf+NfeqPTjD9YeIWHVSCyWP 8dnT/1Ir+Cbbfi4dIIONrsBIs7QOKlA3dxYOw8wc2Y0mVX2f0zGEFF3H2BlPzk6uLYf88idjmUH l//ivZfBfG6/OjqM+3XRddTR8 X-Received: by 2002:adf:f746:0:b0:21d:6afd:b7d3 with SMTP id z6-20020adff746000000b0021d6afdb7d3mr8680746wrp.501.1657813179272; Thu, 14 Jul 2022 08:39:39 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t5tKhmAkul9pcobJT+isErEbVQ/CkLfg6Gb+rF4t/kzbOpZtS1pgsyb94YxSH6cD9DrPkr8Q== X-Received: by 2002:adf:f746:0:b0:21d:6afd:b7d3 with SMTP id z6-20020adff746000000b0021d6afdb7d3mr8680732wrp.501.1657813179045; Thu, 14 Jul 2022 08:39:39 -0700 (PDT) Received: from localhost (cpc111743-lutn13-2-0-cust979.9-3.cable.virginm.net. [82.17.115.212]) by smtp.gmail.com with ESMTPSA id w10-20020adfcd0a000000b0021d888e1132sm1729356wrm.43.2022.07.14.08.39.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jul 2022 08:39:38 -0700 (PDT) From: Aaron Tomlin To: mcgrof@kernel.org, christophe.leroy@csgroup.eu Cc: linux-kernel@vger.kernel.org, linux-modules@vger.kernel.org, atomlin@atomlin.com, oleksandr@natalenko.name, neelx@redhat.com Subject: [PATCH v2 2/3] module: Use strscpy() for last_unloaded_module Date: Thu, 14 Jul 2022 16:39:32 +0100 Message-Id: <20220714153933.2095776-3-atomlin@redhat.com> X-Mailer: git-send-email 2.34.3 In-Reply-To: <20220714153933.2095776-1-atomlin@redhat.com> References: <20220714153933.2095776-1-atomlin@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: The use of strlcpy() is considered deprecated [1]. In this particular context, there is no need to remain with strlcpy(). Therefore we transition to strscpy(). [1]: https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy Signed-off-by: Aaron Tomlin --- kernel/module/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/module/main.c b/kernel/module/main.c index a4d23b0ebbc0..c5db13d06995 100644 --- a/kernel/module/main.c +++ b/kernel/module/main.c @@ -754,7 +754,7 @@ SYSCALL_DEFINE2(delete_module, const char __user *, name_user, async_synchronize_full(); /* Store the name of the last unloaded module for diagnostic purposes */ - strlcpy(last_unloaded_module, mod->name, sizeof(last_unloaded_module)); + strscpy(last_unloaded_module, mod->name, sizeof(last_unloaded_module)); free_module(mod); /* someone could wait for the module in add_unformed_module() */ From patchwork Thu Jul 14 15:39:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Tomlin X-Patchwork-Id: 12918139 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 A0692CCA47B for ; Thu, 14 Jul 2022 15:39:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240218AbiGNPjz (ORCPT ); Thu, 14 Jul 2022 11:39:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240383AbiGNPjp (ORCPT ); Thu, 14 Jul 2022 11:39:45 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D09BDCDA for ; Thu, 14 Jul 2022 08:39:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657813183; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zXjUnaumkR0TOxe9lPH1tSh7D3NCENEIHeJQmON/pbA=; b=jADFrhz72RzL6wZGzqlfB/mH0W5CzQhMN7e3gpSKMjJueQt25f1ia3eYUMiR1aE3opS4He RkfZTN9EqhJHcnTEQkANo5dEHNuuC6BN1591TEFb7gXS/1h3hVB2Y0boUDUbxjOLh1javw N3Zft5t4XTPOPfrsMyjKvcnnvg2pNow= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-287-4TQ0Kp1aNDGpl-TJGT8Zhg-1; Thu, 14 Jul 2022 11:39:42 -0400 X-MC-Unique: 4TQ0Kp1aNDGpl-TJGT8Zhg-1 Received: by mail-wm1-f69.google.com with SMTP id q15-20020a05600c040f00b003a2e5c8fca3so2808432wmb.7 for ; Thu, 14 Jul 2022 08:39:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zXjUnaumkR0TOxe9lPH1tSh7D3NCENEIHeJQmON/pbA=; b=DymSmjQ+x8RUn3uCSNqyP/xH4N1LGupWGLRvv4pa9CXb/05+bNG9Y/3W+NwZA/2Dxb Fveb5P8LHG92h0Ya0Q3/OYa+ZtncSCgW5t/N1r6x2uQYK8ZMQHyRUqKoBj7LEy9zDYAF 9yqm5rU4hD+VEA5GHNXqK+KifOpfaI8lqRT3W1Xi7hpi1Wx5Pu3h9YbbshIuAyStJFZ1 x4P4dOD9eQUIKsYs4e9rGCpX1+MNE6agr7QJS4gZgKDerjiXof/f9bNyi75EE1gicGoJ ve0QRkjAh4sdms1ob5xcPPDIw+MklbJQopjJpCksdwTZuuvJfrybGVwGWac24NtzVuSa DT2A== X-Gm-Message-State: AJIora9/uS0JeXRcE4BnLpzcgZCvpLDxcSeFOrWgvER5nhTKIdwRCG8g NZidf2CF1jF9WjW2lMUDmblwp4O74ky83Mvi6vcgCp2hydhD6GHojgyz34uo0L5GEu0rm4mhIcu 56Vj8Y3XHi95vF7pAudQafZhD X-Received: by 2002:a05:600c:206:b0:3a2:e224:da6f with SMTP id 6-20020a05600c020600b003a2e224da6fmr16099545wmi.167.1657813181598; Thu, 14 Jul 2022 08:39:41 -0700 (PDT) X-Google-Smtp-Source: AGRyM1umKj6lyufc2E/Zv8r5bdD3dbXIXniFnzkwkp6SxSbe6WGK2L1R/iMwFMU8NMI5GYg/lzZAtQ== X-Received: by 2002:a05:600c:206:b0:3a2:e224:da6f with SMTP id 6-20020a05600c020600b003a2e224da6fmr16099535wmi.167.1657813181427; Thu, 14 Jul 2022 08:39:41 -0700 (PDT) Received: from localhost (cpc111743-lutn13-2-0-cust979.9-3.cable.virginm.net. [82.17.115.212]) by smtp.gmail.com with ESMTPSA id a15-20020adffb8f000000b0021dbac444a7sm1742198wrr.59.2022.07.14.08.39.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jul 2022 08:39:40 -0700 (PDT) From: Aaron Tomlin To: mcgrof@kernel.org, christophe.leroy@csgroup.eu Cc: linux-kernel@vger.kernel.org, linux-modules@vger.kernel.org, atomlin@atomlin.com, oleksandr@natalenko.name, neelx@redhat.com Subject: [PATCH v2 3/3] module: Show the last unloaded module's taint flag(s) Date: Thu, 14 Jul 2022 16:39:33 +0100 Message-Id: <20220714153933.2095776-4-atomlin@redhat.com> X-Mailer: git-send-email 2.34.3 In-Reply-To: <20220714153933.2095776-1-atomlin@redhat.com> References: <20220714153933.2095776-1-atomlin@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: For diagnostic purposes, this patch, in addition to keeping a record/or track of the last known unloaded module, we now will include the module's taint flag(s) too e.g: " [last unloaded: fpga_mgr_mod(OE)]" Signed-off-by: Aaron Tomlin --- kernel/module/main.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/kernel/module/main.c b/kernel/module/main.c index c5db13d06995..96ec7f94228d 100644 --- a/kernel/module/main.c +++ b/kernel/module/main.c @@ -524,7 +524,10 @@ static struct module_attribute modinfo_##field = { \ MODINFO_ATTR(version); MODINFO_ATTR(srcversion); -static char last_unloaded_module[MODULE_NAME_LEN+1]; +static struct { + char name[MODULE_NAME_LEN + 1]; + char taints[MODULE_FLAGS_BUF_SIZE]; +} last_unloaded_module; #ifdef CONFIG_MODULE_UNLOAD @@ -694,6 +697,7 @@ SYSCALL_DEFINE2(delete_module, const char __user *, name_user, { struct module *mod; char name[MODULE_NAME_LEN]; + char buf[MODULE_FLAGS_BUF_SIZE]; int ret, forced = 0; if (!capable(CAP_SYS_MODULE) || modules_disabled) @@ -753,8 +757,9 @@ SYSCALL_DEFINE2(delete_module, const char __user *, name_user, async_synchronize_full(); - /* Store the name of the last unloaded module for diagnostic purposes */ - strscpy(last_unloaded_module, mod->name, sizeof(last_unloaded_module)); + /* Store the name and taints of the last unloaded module for diagnostic purposes */ + strscpy(last_unloaded_module.name, mod->name, sizeof(last_unloaded_module.name)); + strscpy(last_unloaded_module.taints, module_flags(mod, buf, false), sizeof(last_unloaded_module.taints)); free_module(mod); /* someone could wait for the module in add_unformed_module() */ @@ -3128,7 +3133,8 @@ void print_modules(void) print_unloaded_tainted_modules(); preempt_enable(); - if (last_unloaded_module[0]) - pr_cont(" [last unloaded: %s]", last_unloaded_module); + if (last_unloaded_module.name[0]) + pr_cont(" [last unloaded: %s%s]", last_unloaded_module.name, + last_unloaded_module.taints); pr_cont("\n"); }