Created
April 13, 2021 18:40
-
-
Save samueldr/070cdbc353ce20672751c8e17f220873 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From eb32451cf180960441c68d699093aa6237631fb7 Mon Sep 17 00:00:00 2001 | |
From: Samuel Dionne-Riel <samuel@dionne-riel.com> | |
Date: Thu, 18 Mar 2021 01:47:17 -0400 | |
Subject: [PATCH] [DEBUG]: trace firmware loads and filp_open | |
The latter is useful to spy on kernel stealing files from the filesystem | |
without going through the firmware subsystem. | |
--- | |
drivers/base/firmware_class.c | 5 +++++ | |
fs/open.c | 1 + | |
2 files changed, 6 insertions(+) | |
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c | |
index 364181591f77d..daea203b645f2 100644 | |
--- a/drivers/base/firmware_class.c | |
+++ b/drivers/base/firmware_class.c | |
@@ -423,6 +423,9 @@ fw_get_filesystem_firmware(struct device *device, struct firmware_buf *buf) | |
len = snprintf(path, PATH_MAX, "%s/%s", | |
fw_path[i], buf->fw_id); | |
+ | |
+ printk("[TRACE] fw_get_filesystem_firmware(); // %s\n", path); | |
+ | |
if (len >= PATH_MAX) { | |
rc = -ENAMETOOLONG; | |
break; | |
@@ -1228,6 +1231,8 @@ _request_firmware(const struct firmware **firmware_p, const char *name, | |
goto out; | |
} | |
+ printk("[TRACE] _request_firmware(); // %s\n", name); | |
+ | |
ret = _request_firmware_prepare(&fw, name, device, buf, size, | |
opt_flags); | |
if (ret <= 0) /* error or already assigned */ | |
diff --git a/fs/open.c b/fs/open.c | |
index 50d2b404c8a16..a83b190b6fdf7 100644 | |
--- a/fs/open.c | |
+++ b/fs/open.c | |
@@ -1019,6 +1019,7 @@ struct file *file_open_name(struct filename *name, int flags, umode_t mode) | |
*/ | |
struct file *filp_open(const char *filename, int flags, umode_t mode) | |
{ | |
+ printk("[TRACE] filp_open(); // %s\n", filename); | |
struct filename *name = getname_kernel(filename); | |
struct file *file = ERR_CAST(name); | |
-- | |
2.29.2 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment