Re: [PATCH 14/14] mfd/macsmc: add ioctl to access smc keys
From: Sasha Finkelstein
Date: Fri Dec 04 2026 - 08:41:02 EST
On Dec 4, 2026, at 14:12, Atharva Tiwari <atharvatiwarilinuxdev@xxxxxxxxx> wrote:
>
> Add a /dev/smc device so userspace can talk to the SMC
> directly. Some keys that need to be written aren't handled by
> any driver, or affect several drivers at once, so they
> can't be exposed cleanly through the kernel interfaces.
>
> Keys already managed by kernel drivers can't be written this
> way, to avoid conflicts.
>
> [...]
> + switch (cmd) {
> + case IOCTL_SMC_READ: {
> + struct ioctl_smc_rw_payload payload;
> + struct apple_smc_key_info info;
> +
> + if (copy_from_user(&payload, argp, sizeof(payload)))
> + return -EFAULT;
> +
> + ret = apple_smc_get_key_info(smc, payload.key, &info);
> + if (ret < 0)
> + return ret;
> +
> + if (payload.size != info.size)
> + return -EINVAL;
> +
> + if (payload.size > 32 || !(info.flags & APPLE_SMC_READABLE))
> + return -EINVAL;
> +
This needs a key whitelist too, AS has read-sensitive keys.