-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VT kbd reset check #12378
VT kbd reset check #12378
Conversation
Is it ever okay for Thanks |
@setharnold I felt the code more descriptive having the checks and the actions separately rather than moving the extra checks to the actions. Also I did not add extra logging, because it is normal to have VTs in raw mode. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, just some nitpicks
i think i agree with @setharnold though: if those checks are pre-condition to these operations they probably should move into the callee, not the caller. Encapsulation and terseness is nice, and the caller shouldn't need to know about that |
0e15bbe
to
4368327
Compare
@setharnold @poettering OK, made the requested changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, CI doesn't pass. Please always build and test before pushing. Thanks!
4368327
to
9a03a4e
Compare
9a03a4e
to
6b7da9d
Compare
@poettering Would you like to see something else to be changed? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks pretty good, just some nitpcks
src/basic/terminal-util.c
Outdated
r = vt_verify_kbmode(fd); | ||
if (r < 0) { | ||
if (r == -EBUSY) { | ||
log_debug_errno(-r, "Keyboard is not in XLATE or UNICODE mode, not resetting: %m"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to negate "r". log_debug_errno() (and its friends) generally do that internally if necessary.
Let's keep the indentation level small here, hence maybe write as:
if (r == -EBUSY) {
…
} else if (r < 0)
return r;
src/vconsole/vconsole-setup.c
Outdated
r = vt_verify_kbmode(fd); | ||
if (r < 0) { | ||
if (r == -EBUSY) { | ||
log_debug_errno(-r, "Virtual console %s is not in K_XLATE or K_UNICODE: %m", name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as above, no negation necessary
src/vconsole/vconsole-setup.c
Outdated
log_debug_errno(-r, "Virtual console %s is not in K_XLATE or K_UNICODE: %m", name); | ||
return 0; | ||
} else | ||
return log_debug_errno(-r, "Failed to verify kbdmode on %s: %m", name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dito
src/vconsole/vconsole-setup.c
Outdated
return 0; | ||
} else | ||
return log_debug_errno(-r, "Failed to verify kbdmode on %s: %m", name); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and similar to above: small indentation levels are cool!
6b7da9d
to
9a932dd
Compare
src/vconsole/vconsole-setup.c
Outdated
log_debug_errno(r, "Virtual console %s is not in K_XLATE or K_UNICODE: %m", name); | ||
return 0; | ||
} else if (r < 0) | ||
return log_debug_errno(r, "Failed to verify kbdmode on %s: %m", name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all other failure codepaths in this functions log loudly, this one should hence too, i.e. bump this one line from log_debug_errno() to log_warning_errno()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(btw, please always add a quick comment when you push a new version. For some reason github doesn't always notify us about pushes)
e7e5b3e
to
de564ef
Compare
Switching to K_UNICODE from other than L_XLATE can make the keyboard unusable and possibly leak keypresses from X. BugLink: https://launchpad.net/bugs/1803993
de564ef
to
13a43c7
Compare
@poettering I see bionic autopkgtests failing for other PR-s, too, and I ran autopkgtest successfully when I cherry-picked the change to Disco, thus I believe the failing tests are not related to this commit. |
🎉 |
Thanks everyone for working on this! Use CVE-2018-20839. Thanks |
@rbalint seems like this has caused a regression. |
Thanks, the regression is tracked in #12616 . |
Sorry for coming late but I can't figure out how the initial issue that @rbalint fixed can happen in practice and the commit message of the relevant commit doesn't really help... In my understanding logind resets the keyboard to K_UNICODE only when it has to acknowledge the VT-switch signal itself for a terminal which has no controlling process. @rbalint did you manage to reproduce the issue ? If so can you tell how exactly ? I'm asking because I can't here. |
fwiw, github never notifies for force-pushes. Even though it's well aware of them. People can complain to github support and maybe they'll eventually fix it. |
Revert of #12378 ("VT kbd reset check")
No description provided.