-
Notifications
You must be signed in to change notification settings - Fork 304
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
Comments
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. |
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. |
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. |
This issue was closed because it was inactive for 7 days after being marked stale. |
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.
The text was updated successfully, but these errors were encountered: