Skip to content

Commit

Permalink
Return ENODEV when the selected speculation misfeature is unsupported
Browse files Browse the repository at this point in the history
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: Anthony Steinhauser <asteinhauser@google.com>
Signed-off-by: Will Deacon <will@kernel.org>
  • Loading branch information
Anthony Steinhauser authored and Will Deacon committed Jan 8, 2020
1 parent 46cf053 commit b3c75c9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/arm64/kernel/ssbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ static int ssbd_prctl_set(struct task_struct *task, unsigned long ctrl)

/* Unsupported */
if (state == ARM64_SSBD_UNKNOWN)
return -EINVAL;
return -ENODEV;

/* Treat the unaffected/mitigated state separately */
if (state == ARM64_SSBD_MITIGATED) {
Expand Down Expand Up @@ -102,7 +102,7 @@ static int ssbd_prctl_get(struct task_struct *task)
{
switch (arm64_get_ssbd_state()) {
case ARM64_SSBD_UNKNOWN:
return -EINVAL;
return -ENODEV;
case ARM64_SSBD_FORCE_ENABLE:
return PR_SPEC_DISABLE;
case ARM64_SSBD_KERNEL:
Expand Down

0 comments on commit b3c75c9

Please sign in to comment.