Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

C++: replace Guards with IRGuards #11356

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

Closed
wants to merge 10 commits into from

Conversation

rdmarsh2
Copy link
Contributor

No description provided.

@jketema
Copy link
Contributor

jketema commented Nov 23, 2022

Coding standards tests now pass 🎉

@MathiasVP
Copy link
Contributor

@rdmarsh2 I think the test changes are all good, but I'd appreciate a second pair of 👀s on it.

@jketema
Copy link
Contributor

jketema commented Nov 28, 2022

Happily have a look, but please update the tests, so I don't have to look at the workflow output.

jketema
jketema previously approved these changes Nov 28, 2022
Copy link
Contributor

@jketema jketema left a comment

Choose a reason for hiding this comment

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

Test changes make sense to me.

@MathiasVP
Copy link
Contributor

I guess the remaining task is to run a DCA on this 🎉?

@rdmarsh2
Copy link
Contributor Author

@MathiasVP
Copy link
Contributor

Looks like there are a couple of results on cpp/toctou-race-condition that we need to investigate. It's probably because we're catching more sanitizers now 🤞.

@rdmarsh2
Copy link
Contributor Author

I think it's related to non-returning functions that aren't modeled as such in the IR...

@MathiasVP
Copy link
Contributor

I think it's related to non-returning functions that aren't modeled as such in the IR...

Indeed. Looking at the very first lost result on SAMATE, It looks like we're no longer raising an alert on this pattern (from C/testcases/CWE367_TOC_TOU/CWE367_TOC_TOU__stat_08.c):

if (STAT(filename, &statBuffer) == -1)
{
    exit(1);
}
fileDesc  = OPEN(filename, O_RDWR);

Do we need to teach the IR guards library about non-returning functions before we can merge this PR?

@rdmarsh2
Copy link
Contributor Author

I think we'd be better off modeling it properly in the IR than handling it in the Guards library specifically. A jump from the call to the Unreachable block should make the guards library work as expected.

@rdmarsh2 rdmarsh2 marked this pull request as ready for review December 7, 2022 15:38
@rdmarsh2 rdmarsh2 requested a review from a team as a code owner December 7, 2022 15:38
@jketema
Copy link
Contributor

jketema commented Dec 7, 2022

I seems some files need to be sync'ed and some formatting is required.

@MathiasVP
Copy link
Contributor

It seems like cpp/toctou-race-condition is an excellent test for the Guards library 😂. I like the fact that the set of result changes is very small! It would be interesting to see if these are good or bad changes, though.

@rdmarsh2 rdmarsh2 requested a review from a team as a code owner December 7, 2022 18:48
@github-actions github-actions bot added the C# label Dec 7, 2022
@jketema
Copy link
Contributor

jketema commented Dec 8, 2022

It seems like cpp/toctou-race-condition is an excellent test for the Guards library 😂. I like the fact that the set of result changes is very small! It would be interesting to see if these are good or bad changes, though.

The unclassified results that disappeared are all of the form:

if (file check fails)
  exit()
do something with the file

So that looks ok.

The new unclassified results look a bit funny, though not wrong.

		filemode = (!chmod(path, st1.st_mode ^ S_IXUSR) &&  // file being operated on and two checks
				!lstat(path, &st2) &&               // another check
				st1.st_mode != st2.st_mode &&       // another check
				!chmod(path, st1.st_mode));         // yet another check

and

    return (chmod((char *)                                       // file being operated on
		    name,                                        // check
		    (mode_t)perm) == 0 ? OK : FAIL);

@jketema
Copy link
Contributor

jketema commented Dec 8, 2022

Three of the syntax zoo consistency check tests are currently failing by the way.

@jketema
Copy link
Contributor

jketema commented May 4, 2023

Should we update this PR now #12982 is merged?

@MathiasVP
Copy link
Contributor

Yeah, let's at least fix up the merge conflicts. I guess we need to schedule when to do the last part of this work at the next iteration planning.

@geoffw0
Copy link
Contributor

geoffw0 commented Dec 5, 2023

Superseded by #14992 ?

@MathiasVP
Copy link
Contributor

Yep. Closing!

@MathiasVP MathiasVP closed this Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.