Commit b3c75c9d authored by Anthony Steinhauser's avatar Anthony Steinhauser Committed by Will Deacon

Return ENODEV when the selected speculation misfeature is unsupported

When the control of the selected speculation misbehavior is unsupported,
the kernel should return ENODEV according to the documentation:
https://www.kernel.org/doc/html/v4.17/userspace-api/spec_ctrl.html
Current aarch64 implementation of SSB control sometimes returns EINVAL
which is reserved for unimplemented prctl and for violations of reserved
arguments. This change makes the aarch64 implementation consistent with
the x86 implementation and with the documentation.
Signed-off-by: default avatarAnthony Steinhauser <asteinhauser@google.com>
Signed-off-by: default avatarWill Deacon <will@kernel.org>
parent 46cf053e
...@@ -37,7 +37,7 @@ static int ssbd_prctl_set(struct task_struct *task, unsigned long ctrl) ...@@ -37,7 +37,7 @@ static int ssbd_prctl_set(struct task_struct *task, unsigned long ctrl)
/* Unsupported */ /* Unsupported */
if (state == ARM64_SSBD_UNKNOWN) if (state == ARM64_SSBD_UNKNOWN)
return -EINVAL; return -ENODEV;
/* Treat the unaffected/mitigated state separately */ /* Treat the unaffected/mitigated state separately */
if (state == ARM64_SSBD_MITIGATED) { if (state == ARM64_SSBD_MITIGATED) {
...@@ -102,7 +102,7 @@ static int ssbd_prctl_get(struct task_struct *task) ...@@ -102,7 +102,7 @@ static int ssbd_prctl_get(struct task_struct *task)
{ {
switch (arm64_get_ssbd_state()) { switch (arm64_get_ssbd_state()) {
case ARM64_SSBD_UNKNOWN: case ARM64_SSBD_UNKNOWN:
return -EINVAL; return -ENODEV;
case ARM64_SSBD_FORCE_ENABLE: case ARM64_SSBD_FORCE_ENABLE:
return PR_SPEC_DISABLE; return PR_SPEC_DISABLE;
case ARM64_SSBD_KERNEL: case ARM64_SSBD_KERNEL:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment