Open flukeeey opened 2 months ago
Can you test this patch?
diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c
index d2f7fd7743a1..11278f785526 100644
--- a/drivers/acpi/platform_profile.c
+++ b/drivers/acpi/platform_profile.c
@@ -22,8 +22,8 @@ static const char * const profile_names[] = {
};
static_assert(ARRAY_SIZE(profile_names) == PLATFORM_PROFILE_LAST);
-static ssize_t platform_profile_choices_show(struct device *dev,
- struct device_attribute *attr,
+static ssize_t platform_profile_choices_show(struct kobject *kobj,
+ struct kobj_attribute *attr,
char *buf)
{
int len = 0;
@@ -49,8 +49,8 @@ static ssize_t platform_profile_choices_show(struct device *dev,
return len;
}
-static ssize_t platform_profile_show(struct device *dev,
- struct device_attribute *attr,
+static ssize_t platform_profile_show(struct kobject *kobj,
+ struct kobj_attribute *attr,
char *buf)
{
enum platform_profile_option profile = PLATFORM_PROFILE_BALANCED;
@@ -77,8 +77,8 @@ static ssize_t platform_profile_show(struct device *dev,
return sysfs_emit(buf, "%s\n", profile_names[profile]);
}
-static ssize_t platform_profile_store(struct device *dev,
- struct device_attribute *attr,
+static ssize_t platform_profile_store(struct kobject *kobj,
+ struct kobj_attribute *attr,
const char *buf, size_t count)
{
int err, i;
@@ -115,12 +115,12 @@ static ssize_t platform_profile_store(struct device *dev,
return count;
}
-static DEVICE_ATTR_RO(platform_profile_choices);
-static DEVICE_ATTR_RW(platform_profile);
+static struct kobj_attribute attr_platform_profile_choices = __ATTR_RO(platform_profile_choices);
+static struct kobj_attribute attr_platform_profile = __ATTR_RW(platform_profile);
static struct attribute *platform_profile_attrs[] = {
- &dev_attr_platform_profile_choices.attr,
- &dev_attr_platform_profile.attr,
+ &attr_platform_profile_choices.attr,
+ &attr_platform_profile.attr,
NULL
};
I've put it on paste.debian.net too since copying from GitHub does not always work well: https://paste.debian.net/downloadh/747d3f6b
$ curl -LSs https://paste.debian.net/downloadh/747d3f6b | git apply -3v
Checking patch drivers/acpi/platform_profile.c...
Applied patch to 'drivers/acpi/platform_profile.c' cleanly.
Applied patch drivers/acpi/platform_profile.c cleanly.
If it works, please let me know if you would like a Reported-by:
tag and what name/email I should use when I write the formal patch (and I'll stick a Tested-by:
on there too).
Looks to be working perfectly now!
I can cat both of the aforementioned files, and also set the platform profile by echoing 'low-power', 'balanced', or 'performance' to /sys/firmware/acpi/platform_profile
.
Please use John Rowley <lkml@johnrowley.me>
for those two tags.
Many thanks for the prompt fix (and the kudos). :smile:
Thanks a lot for the quick testing! I have sent a formal patch: https://lore.kernel.org/20240819-acpi-platform_profile-fix-cfi-violation-v1-1-479365d848f6@kernel.org/
@nathanchance @samitolvanen
What is the status of this patch?
We had similiar issues - one I can remember was (2020 - early days of Clang-CFI):
"perf/x86: fix sysfs type mismatches" https://git.kernel.org/linus/ebd19fc372e3e78bf165f230e7c084e304441c08
What is the status of this patch?
Per the thread, I was waiting for Greg to give me some guidance on his proposed solution but I'll consider just sending v2 with the wording changes I mentioned if he does not reply by the end of the week.
Hi!
When attempting to read
/sys/firmware/acpi/platform_profile
or/sys/firmware/acpi/platform_profile_choices
I receive a "SIGSEGV (Address boundary error)" error, with the following oops:System is an AMD Framework Laptop 13 running Arch Linux, kernel version 6.11.0-rc4 (commit: 20e8b2f2a6b2).
/proc/version:
Apologies if this is the incorrect place to report a CFI violation, and please let me know if I can assist further in investigation.
config.txt