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

Storing state in global variables considered harmful #1057

Open
jpoimboe opened this issue Nov 8, 2019 · 4 comments
Open

Storing state in global variables considered harmful #1057

jpoimboe opened this issue Nov 8, 2019 · 4 comments
Assignees

Comments

@jpoimboe
Copy link
Member

jpoimboe commented Nov 8, 2019

If a patch stores state in a global variable, and then the patch is later replaced with a newer cumulative patch, the global variable in the new patch will be distinct from the variable in the original patch, and thus won't have the original state. This is dangerous and needs to be prevented. Instead a shadow variable should be used to store global state.

Ideally the best option would be to report an error (or at least a warning) if non-rodata data is added to a patch. I'm not sure if there would be any false positive warnings. It needs to be investigated.

@CentUser
Copy link

I think we should be strict with gcc version. When using the same version (I mean the exactly same version of gcc), we can expect that gcc would store global variable using the same way.
And static local variables could be using the same suffix.

@github-actions
Copy link

github-actions bot commented Aug 2, 2023

This issue has been open for 30 days with no activity and no assignee. It will be closed in 7 days unless a comment is added.

@github-actions github-actions bot added the stale label Aug 2, 2023
@jpoimboe jpoimboe removed the stale label Aug 3, 2023
@github-actions
Copy link

github-actions bot commented Sep 3, 2023

This issue has been open for 30 days with no activity and no assignee. It will be closed in 7 days unless a comment is added.

@github-actions github-actions bot added the stale label Sep 3, 2023
@github-actions
Copy link

This issue was closed because it was inactive for 7 days after being marked stale.

@jpoimboe jpoimboe self-assigned this Sep 12, 2023
@jpoimboe jpoimboe removed the stale label Sep 12, 2023
@jpoimboe jpoimboe reopened this Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants