Skip to content
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

Coverity fixes #238

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Coverity fixes #238

wants to merge 2 commits into from

Conversation

beldmit
Copy link

@beldmit beldmit commented Mar 29, 2021

This is a set of patches fixing the issues found during the coverity scan of the openssh 8.5.

@daztucker
Copy link
Contributor

Some of these have been fixed (eg the addr.c and ssh-keygen.c moduli screening ones). Could you please update and rebase?

@beldmit
Copy link
Author

beldmit commented Mar 7, 2023

@daztucker done.

@beldmit
Copy link
Author

beldmit commented Mar 7, 2023

Whoops, sorry, a typo :(

@beldmit
Copy link
Author

beldmit commented Mar 7, 2023

Fixup pushed

@beldmit beldmit force-pushed the coverity_85 branch 3 times, most recently from bb98864 to 5f9b431 Compare March 13, 2023 15:24
@beldmit
Copy link
Author

beldmit commented Mar 13, 2023

The tests has passed locally.

@beldmit beldmit closed this Mar 13, 2023
@beldmit beldmit reopened this Mar 13, 2023
@beldmit
Copy link
Author

beldmit commented Mar 14, 2023

The failures seem irrelevant

@@ -1,4 +1,4 @@
/* This file has be substantially modified from the original OpenBSD source */
* This file has be substantially modified from the original OpenBSD source */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this compile?

ssh-keygen.c Outdated Show resolved Hide resolved
auth-options.c Outdated Show resolved Hide resolved
dns.c Show resolved Hide resolved
@@ -1261,6 +1261,7 @@ is_key_revoked(struct ssh_krl *krl, const struct sshkey *key)
return r;
erb = RB_FIND(revoked_blob_tree, &krl->revoked_sha1s, &rb);
free(rb.blob);
rb.blob = NULL; /* make coverity happy */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the reason for this change? (our Coverity scan doesn't flag this)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't remember, can skip it

ssh-keygen.c Show resolved Hide resolved
@@ -436,9 +436,9 @@ channel_register_fds(struct ssh *ssh, Channel *c, int rfd, int wfd, int efd,
} else if (nonblock) {
if (rfd != -1)
set_nonblock(rfd);
if (wfd != -1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what warning is this fixing, and why is rfd treated differently?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's an artifact of our coverity run, they should be uniform.

@@ -543,7 +543,7 @@ server_request_tun(struct ssh *ssh)
debug_f("invalid tun");
goto done;
}
if (auth_opts->force_tun_device != -1) {
if (auth_opts->force_tun_device >= 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's this fixing?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, don't remember. Better skip it.

monitor.c Outdated Show resolved Hide resolved
ssh_sandbox_child(box);
free(box);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sent upstream, waiting for an ok.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Damien points out that this will cause problems for other sandboxes where the sandbox has some persistent (non-kernel) state, eg the systrace sandbox since the contents of "box" is needed throughout the life of the preauth privsep supervisor process.

Ideally we'd add a ssh_sandbox_child_finish and call it near mm_send_keystate, but the "box" variable doesn't exist in that scope and getting it there would be messy.

One option would be to free "box" at the end of ssh_sandbox_child in any sandbox implementation that can do that, and do nothing for the ones that can't. Another option would be to just ignore it, because while it is technically a leak, it's in a process that exists only during the authentication process and exits once the authentication succeeds or fails.

@beldmit
Copy link
Author

beldmit commented Apr 6, 2023

Resolved, thanks. What's better - to remove the places where the changes are suspicious?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants