-
Notifications
You must be signed in to change notification settings - Fork 37
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
SIG-6 (SIGABRT) fatal error and core from MUPIP BACKUP when backup filename path length is nearly 255 characters #267
Comments
nars1
added a commit
to nars1/YottaDB
that referenced
this issue
May 31, 2018
1) / is not guaranteed to be last byte in tempdir_full.addr in various cases. So the / that was removed from the prior YottaDB#267 commit is inserted back. 2) Previously, tempdir_full.addr held the fully constructed name but it no longer does after the prior YottaDB#267 commit. So tempdir_full.addr usages after tempfilename has been constructed need to be replaced with tempfilename. 3) One use of orig_buff_size was replaced with SIZEOF(tempfilename) since the latter is what got used as the maximum size in the SNPRINTF call. Both the values hold the same value so there is no issue but still it is better/safer to be consistent.
nars1
added a commit
that referenced
this issue
May 31, 2018
1) / is not guaranteed to be last byte in tempdir_full.addr in various cases. So the / that was removed from the prior #267 commit is inserted back. 2) Previously, tempdir_full.addr held the fully constructed name but it no longer does after the prior #267 commit. So tempdir_full.addr usages after tempfilename has been constructed need to be replaced with tempfilename. 3) One use of orig_buff_size was replaced with SIZEOF(tempfilename) since the latter is what got used as the maximum size in the SNPRINTF call. Both the values hold the same value so there is no issue but still it is better/safer to be consistent.
nars1
added a commit
that referenced
this issue
May 31, 2018
1) / is not guaranteed to be last byte in tempdir_full.addr in various cases. So the / that was removed from the prior #267 commit is inserted back. 2) Previously, tempdir_full.addr held the fully constructed name but it no longer does after the prior #267 commit. So tempdir_full.addr usages after tempfilename has been constructed need to be replaced with tempfilename. 3) One use of orig_buff_size was replaced with SIZEOF(tempfilename) since the latter is what got used as the maximum size in the SNPRINTF call. Both the values hold the same value so there is no issue but still it is better/safer to be consistent.
nars1
added a commit
that referenced
this issue
Jun 1, 2018
…-6 errors The check for whether the temporary file name is longer than the allocated buffer can hold was incorrect. It was assuming 4 bytes (SIZEOF(uint4)) for the string that followed the hexadecimal process-id but the actual name had _XXXXXX following it which accounts for 7 bytes. For example, the actual temporary file name was DEFAULT_17fa_XXXXXX (where XXXXXX was replaced with a temporary string by "mkstemp") but the check was accounting only for DEFAULT_17fa_XXX. So there was a potential for a 3-byte overflow to go unnoticed. This logic is now reworked to use SNPRINTF to let us accurately know if the allocated buffer is not enough and if so issue a FILENAMETOOLONG error. In addition, the FILENAMETOOLONG error is now prefixed with a FILEPARSE error message which prints the entire path name that exceeded the 255 byte limit. Previously this only printed the absolute directory path without including the temporary file name. This could be potentially confusing to the user since they would see the directory path printed in the FILEPARSE error message is less than 255 characters but still an error is being issued saying it is longer than 255 characters. This is the 2nd commit message: [#267] Fix a few issues identified by test failures 1) / is not guaranteed to be last byte in tempdir_full.addr in various cases. So the / that was removed from the prior #267 commit is inserted back. 2) Previously, tempdir_full.addr held the fully constructed name but it no longer does after the prior #267 commit. So tempdir_full.addr usages after tempfilename has been constructed need to be replaced with tempfilename. 3) One use of orig_buff_size was replaced with SIZEOF(tempfilename) since the latter is what got used as the maximum size in the SNPRINTF call. Both the values hold the same value so there is no issue but still it is better/safer to be consistent. This is the 3rd commit message: [#267] Fix more test failures * Zero pad the hexadecimal pid in the backup temporary file name to keep its length at 4-bytes even if the process_id is less than 2**24 * 4-byte pid translates to 8 hexadecimal digits so need 8x instead of 4x in the SNPRINTF format string. * Remove duplication of the format string by moving it to a macro TEMP_FILE_FMT_STRING. This fixes a few differences in the format string used in the two places.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Final Release Note
Description
Below is a backup invocation that demonstrates the issue.
Draft Release Note
MUPIP BACKUP correctly issues a FILENAMETOOLONG error when the absolute path length of the target backup filename is too long (approximately 255 bytes). Previously, this used to result in an abnormal termination of the backup process with a KILLBYSIGSINFO1 fatal error (signal 6/SIGABRT) due to a buffer overflow.
The text was updated successfully, but these errors were encountered: