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

protect ovis_log_flush from invalid arguments. #1330

Merged
merged 1 commit into from
Jan 22, 2024

Conversation

baallan
Copy link
Collaborator

@baallan baallan commented Jan 19, 2024

ovis_log_flush can be called in any order wrt initialization, so it must be guarded against null and syslog values. This prevents segfault in fflush.

ovis_log_flush can be called in any order wrt initialization,
so it must be guarded against null and syslog values.
@baallan baallan force-pushed the top_log_flush_syslog branch from e306026 to e7eeea6 Compare January 19, 2024 01:47
@tom95858
Copy link
Collaborator

@nichamon I think having OVIS_LOG_SYSLOG and overloading the value 0x7 as a FILE* is bad practice. I think the initialization of log_fp should be to stdout. This will cause anything started via systemd to go to syslog as expected. It will also avoid the checking around the code for this value and disabuse accidentally calling a function that is expecting a FILE* with an invalid address. What do you think?

@baallan
Copy link
Collaborator Author

baallan commented Jan 22, 2024

The use of a sentinel value instead of a separate boolean is a memory optimization we can afford to live without if anyone finds it bothersome; we will either way need some flag that differentiates syslog from logging to files.
Given that afaik we still have the goal of running and controlling "syslog or not" choices in non-systemd environments, I suggest we should not get rid of log_fp altogether.
Unless a change was introduced with the multi-log-object library, we have always started with log_fp defaulted to stdout and syslog being something the user must opt into.

@tom95858 tom95858 merged commit 8640f27 into ovis-hpc:OVIS-4 Jan 22, 2024
14 checks passed
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

Successfully merging this pull request may close these issues.

2 participants