+
Skip to content

Conversation

richardfearn
Copy link
Contributor

No description provided.

@peff
Copy link
Member

peff commented Oct 11, 2012

Your change looks good, but all development for git happens on the git mailing list, and patches need to go there. See Documentation/SubmittingPatches for details.

@peff peff closed this Oct 11, 2012
max630 pushed a commit to max630/git that referenced this pull request May 17, 2015
Fixes required to build Git for Windows with MSys2
max630 pushed a commit to max630/git that referenced this pull request May 17, 2015
Fixes required to build Git for Windows with MSys2
max630 pushed a commit to max630/git that referenced this pull request May 17, 2015
Fixes required to build Git for Windows with MSys2
max630 pushed a commit to max630/git that referenced this pull request May 17, 2015
Fixes required to build Git for Windows with MSys2
max630 pushed a commit to max630/git that referenced this pull request May 17, 2015
Fixes required to build Git for Windows with MSys2
phillipwood added a commit to phillipwood/git that referenced this pull request Apr 20, 2022
 test-results/t0010-racy-git.out...
 ------------------------------------------------------------------------
 Initialized empty Git repository in /__w/git/git/t/trash directory.t0010-racy-git/.git/
 =================================================================
 ==7972==ERROR: AddressSanitizer: invalid-pointer-pair: 0x6020000004f0 0x6020000004ef
     #0 0x7cfcbb in count_trailing_blank diff.c:621
     #1 0x7cfe73 in check_blank_at_eof diff.c:637
     #2 0x804cb9 in builtin_diff diff.c:3583
     #3 0x809494 in run_diff_cmd diff.c:4428
     #4 0x80ae96 in run_diff diff.c:4517
     #5 0x80ae96 in diff_flush_patch diff.c:5870
     git#6 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     #7 0x80cb6a in diff_flush diff.c:6552
     git#8 0x7c831f in run_diff_files diff-lib.c:265
     git#9 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#10 0x41e8c9 in run_builtin git.c:465
     git#11 0x41e8c9 in handle_builtin git.c:719
     git#12 0x41f9ac in run_argv git.c:786
     git#13 0x41f9ac in cmd_main git.c:917
     git#14 0x419515 in main common-main.c:56
     git#15 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#16 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#17 0x41b494 in _start (git+0x41b494)

 0x6020000004f0 is located 0 bytes inside of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 0x6020000004ef is located 1 bytes to the left of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 SUMMARY: AddressSanitizer: invalid-pointer-pair diff.c:621 in count_trailing_blank
 ==7972==ABORTING

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
phillipwood added a commit to phillipwood/git that referenced this pull request Apr 20, 2022
 test-results/t0010-racy-git.out...
 ------------------------------------------------------------------------
 Initialized empty Git repository in /__w/git/git/t/trash directory.t0010-racy-git/.git/
 =================================================================
 ==7972==ERROR: AddressSanitizer: invalid-pointer-pair: 0x6020000004f0 0x6020000004ef
     #0 0x7cfcbb in count_trailing_blank diff.c:621
     #1 0x7cfe73 in check_blank_at_eof diff.c:637
     #2 0x804cb9 in builtin_diff diff.c:3583
     #3 0x809494 in run_diff_cmd diff.c:4428
     #4 0x80ae96 in run_diff diff.c:4517
     #5 0x80ae96 in diff_flush_patch diff.c:5870
     git#6 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     #7 0x80cb6a in diff_flush diff.c:6552
     git#8 0x7c831f in run_diff_files diff-lib.c:265
     git#9 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#10 0x41e8c9 in run_builtin git.c:465
     git#11 0x41e8c9 in handle_builtin git.c:719
     git#12 0x41f9ac in run_argv git.c:786
     git#13 0x41f9ac in cmd_main git.c:917
     git#14 0x419515 in main common-main.c:56
     git#15 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#16 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#17 0x41b494 in _start (git+0x41b494)

 0x6020000004f0 is located 0 bytes inside of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 0x6020000004ef is located 1 bytes to the left of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 SUMMARY: AddressSanitizer: invalid-pointer-pair diff.c:621 in count_trailing_blank
 ==7972==ABORTING

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
phillipwood added a commit to phillipwood/git that referenced this pull request Apr 20, 2022
 test-results/t0010-racy-git.out...
 ------------------------------------------------------------------------
 Initialized empty Git repository in /__w/git/git/t/trash directory.t0010-racy-git/.git/
 =================================================================
 ==7972==ERROR: AddressSanitizer: invalid-pointer-pair: 0x6020000004f0 0x6020000004ef
     #0 0x7cfcbb in count_trailing_blank diff.c:621
     #1 0x7cfe73 in check_blank_at_eof diff.c:637
     #2 0x804cb9 in builtin_diff diff.c:3583
     #3 0x809494 in run_diff_cmd diff.c:4428
     #4 0x80ae96 in run_diff diff.c:4517
     #5 0x80ae96 in diff_flush_patch diff.c:5870
     git#6 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     #7 0x80cb6a in diff_flush diff.c:6552
     git#8 0x7c831f in run_diff_files diff-lib.c:265
     git#9 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#10 0x41e8c9 in run_builtin git.c:465
     git#11 0x41e8c9 in handle_builtin git.c:719
     git#12 0x41f9ac in run_argv git.c:786
     git#13 0x41f9ac in cmd_main git.c:917
     git#14 0x419515 in main common-main.c:56
     git#15 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#16 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#17 0x41b494 in _start (git+0x41b494)

 0x6020000004f0 is located 0 bytes inside of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 0x6020000004ef is located 1 bytes to the left of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 SUMMARY: AddressSanitizer: invalid-pointer-pair diff.c:621 in count_trailing_blank
 ==7972==ABORTING

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
phillipwood added a commit to phillipwood/git that referenced this pull request Apr 21, 2022
 test-results/t0010-racy-git.out...
 ------------------------------------------------------------------------
 Initialized empty Git repository in /__w/git/git/t/trash directory.t0010-racy-git/.git/
 =================================================================
 ==7972==ERROR: AddressSanitizer: invalid-pointer-pair: 0x6020000004f0 0x6020000004ef
     #0 0x7cfcbb in count_trailing_blank diff.c:621
     #1 0x7cfe73 in check_blank_at_eof diff.c:637
     #2 0x804cb9 in builtin_diff diff.c:3583
     #3 0x809494 in run_diff_cmd diff.c:4428
     #4 0x80ae96 in run_diff diff.c:4517
     #5 0x80ae96 in diff_flush_patch diff.c:5870
     git#6 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     #7 0x80cb6a in diff_flush diff.c:6552
     git#8 0x7c831f in run_diff_files diff-lib.c:265
     git#9 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#10 0x41e8c9 in run_builtin git.c:465
     git#11 0x41e8c9 in handle_builtin git.c:719
     git#12 0x41f9ac in run_argv git.c:786
     git#13 0x41f9ac in cmd_main git.c:917
     git#14 0x419515 in main common-main.c:56
     git#15 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#16 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#17 0x41b494 in _start (git+0x41b494)

 0x6020000004f0 is located 0 bytes inside of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 0x6020000004ef is located 1 bytes to the left of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 SUMMARY: AddressSanitizer: invalid-pointer-pair diff.c:621 in count_trailing_blank
 ==7972==ABORTING

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
phillipwood added a commit to phillipwood/git that referenced this pull request Apr 21, 2022
 test-results/t0010-racy-git.out...
 ------------------------------------------------------------------------
 Initialized empty Git repository in /__w/git/git/t/trash directory.t0010-racy-git/.git/
 =================================================================
 ==7972==ERROR: AddressSanitizer: invalid-pointer-pair: 0x6020000004f0 0x6020000004ef
     #0 0x7cfcbb in count_trailing_blank diff.c:621
     #1 0x7cfe73 in check_blank_at_eof diff.c:637
     #2 0x804cb9 in builtin_diff diff.c:3583
     #3 0x809494 in run_diff_cmd diff.c:4428
     #4 0x80ae96 in run_diff diff.c:4517
     #5 0x80ae96 in diff_flush_patch diff.c:5870
     git#6 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     #7 0x80cb6a in diff_flush diff.c:6552
     git#8 0x7c831f in run_diff_files diff-lib.c:265
     git#9 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#10 0x41e8c9 in run_builtin git.c:465
     git#11 0x41e8c9 in handle_builtin git.c:719
     git#12 0x41f9ac in run_argv git.c:786
     git#13 0x41f9ac in cmd_main git.c:917
     git#14 0x419515 in main common-main.c:56
     git#15 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#16 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#17 0x41b494 in _start (git+0x41b494)

 0x6020000004f0 is located 0 bytes inside of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 0x6020000004ef is located 1 bytes to the left of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 SUMMARY: AddressSanitizer: invalid-pointer-pair diff.c:621 in count_trailing_blank
 ==7972==ABORTING

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
phillipwood added a commit to phillipwood/git that referenced this pull request Apr 21, 2022
 test-results/t0010-racy-git.out...
 ------------------------------------------------------------------------
 Initialized empty Git repository in /__w/git/git/t/trash directory.t0010-racy-git/.git/
 =================================================================
 ==7972==ERROR: AddressSanitizer: invalid-pointer-pair: 0x6020000004f0 0x6020000004ef
     #0 0x7cfcbb in count_trailing_blank diff.c:621
     #1 0x7cfe73 in check_blank_at_eof diff.c:637
     #2 0x804cb9 in builtin_diff diff.c:3583
     #3 0x809494 in run_diff_cmd diff.c:4428
     #4 0x80ae96 in run_diff diff.c:4517
     #5 0x80ae96 in diff_flush_patch diff.c:5870
     git#6 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     #7 0x80cb6a in diff_flush diff.c:6552
     git#8 0x7c831f in run_diff_files diff-lib.c:265
     git#9 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#10 0x41e8c9 in run_builtin git.c:465
     git#11 0x41e8c9 in handle_builtin git.c:719
     git#12 0x41f9ac in run_argv git.c:786
     git#13 0x41f9ac in cmd_main git.c:917
     git#14 0x419515 in main common-main.c:56
     git#15 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#16 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#17 0x41b494 in _start (git+0x41b494)

 0x6020000004f0 is located 0 bytes inside of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 0x6020000004ef is located 1 bytes to the left of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 SUMMARY: AddressSanitizer: invalid-pointer-pair diff.c:621 in count_trailing_blank
 ==7972==ABORTING

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
phillipwood added a commit to phillipwood/git that referenced this pull request Apr 24, 2022
 test-results/t0010-racy-git.out...
 ------------------------------------------------------------------------
 Initialized empty Git repository in /__w/git/git/t/trash directory.t0010-racy-git/.git/
 =================================================================
 ==7972==ERROR: AddressSanitizer: invalid-pointer-pair: 0x6020000004f0 0x6020000004ef
     #0 0x7cfcbb in count_trailing_blank diff.c:621
     #1 0x7cfe73 in check_blank_at_eof diff.c:637
     #2 0x804cb9 in builtin_diff diff.c:3583
     #3 0x809494 in run_diff_cmd diff.c:4428
     #4 0x80ae96 in run_diff diff.c:4517
     #5 0x80ae96 in diff_flush_patch diff.c:5870
     git#6 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     #7 0x80cb6a in diff_flush diff.c:6552
     git#8 0x7c831f in run_diff_files diff-lib.c:265
     git#9 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#10 0x41e8c9 in run_builtin git.c:465
     git#11 0x41e8c9 in handle_builtin git.c:719
     git#12 0x41f9ac in run_argv git.c:786
     git#13 0x41f9ac in cmd_main git.c:917
     git#14 0x419515 in main common-main.c:56
     git#15 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#16 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#17 0x41b494 in _start (git+0x41b494)

 0x6020000004f0 is located 0 bytes inside of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 0x6020000004ef is located 1 bytes to the left of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 SUMMARY: AddressSanitizer: invalid-pointer-pair diff.c:621 in count_trailing_blank
 ==7972==ABORTING

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
phillipwood added a commit to phillipwood/git that referenced this pull request Apr 25, 2022
 test-results/t0010-racy-git.out...
 ------------------------------------------------------------------------
 Initialized empty Git repository in /__w/git/git/t/trash directory.t0010-racy-git/.git/
 =================================================================
 ==7972==ERROR: AddressSanitizer: invalid-pointer-pair: 0x6020000004f0 0x6020000004ef
     #0 0x7cfcbb in count_trailing_blank diff.c:621
     #1 0x7cfe73 in check_blank_at_eof diff.c:637
     #2 0x804cb9 in builtin_diff diff.c:3583
     #3 0x809494 in run_diff_cmd diff.c:4428
     #4 0x80ae96 in run_diff diff.c:4517
     #5 0x80ae96 in diff_flush_patch diff.c:5870
     git#6 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     #7 0x80cb6a in diff_flush diff.c:6552
     git#8 0x7c831f in run_diff_files diff-lib.c:265
     git#9 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#10 0x41e8c9 in run_builtin git.c:465
     git#11 0x41e8c9 in handle_builtin git.c:719
     git#12 0x41f9ac in run_argv git.c:786
     git#13 0x41f9ac in cmd_main git.c:917
     git#14 0x419515 in main common-main.c:56
     git#15 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#16 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#17 0x41b494 in _start (git+0x41b494)

 0x6020000004f0 is located 0 bytes inside of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 0x6020000004ef is located 1 bytes to the left of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 SUMMARY: AddressSanitizer: invalid-pointer-pair diff.c:621 in count_trailing_blank
 ==7972==ABORTING

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
phillipwood added a commit to phillipwood/git that referenced this pull request Apr 25, 2022
 test-results/t0010-racy-git.out...
 ------------------------------------------------------------------------
 Initialized empty Git repository in /__w/git/git/t/trash directory.t0010-racy-git/.git/
 =================================================================
 ==7972==ERROR: AddressSanitizer: invalid-pointer-pair: 0x6020000004f0 0x6020000004ef
     #0 0x7cfcbb in count_trailing_blank diff.c:621
     #1 0x7cfe73 in check_blank_at_eof diff.c:637
     #2 0x804cb9 in builtin_diff diff.c:3583
     #3 0x809494 in run_diff_cmd diff.c:4428
     #4 0x80ae96 in run_diff diff.c:4517
     #5 0x80ae96 in diff_flush_patch diff.c:5870
     git#6 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     #7 0x80cb6a in diff_flush diff.c:6552
     git#8 0x7c831f in run_diff_files diff-lib.c:265
     git#9 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#10 0x41e8c9 in run_builtin git.c:465
     git#11 0x41e8c9 in handle_builtin git.c:719
     git#12 0x41f9ac in run_argv git.c:786
     git#13 0x41f9ac in cmd_main git.c:917
     git#14 0x419515 in main common-main.c:56
     git#15 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#16 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#17 0x41b494 in _start (git+0x41b494)

 0x6020000004f0 is located 0 bytes inside of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 0x6020000004ef is located 1 bytes to the left of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 SUMMARY: AddressSanitizer: invalid-pointer-pair diff.c:621 in count_trailing_blank
 ==7972==ABORTING

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
phillipwood added a commit to phillipwood/git that referenced this pull request Apr 26, 2022
 test-results/t0010-racy-git.out...
 ------------------------------------------------------------------------
 Initialized empty Git repository in /__w/git/git/t/trash directory.t0010-racy-git/.git/
 =================================================================
 ==7972==ERROR: AddressSanitizer: invalid-pointer-pair: 0x6020000004f0 0x6020000004ef
     #0 0x7cfcbb in count_trailing_blank diff.c:621
     #1 0x7cfe73 in check_blank_at_eof diff.c:637
     #2 0x804cb9 in builtin_diff diff.c:3583
     #3 0x809494 in run_diff_cmd diff.c:4428
     #4 0x80ae96 in run_diff diff.c:4517
     #5 0x80ae96 in diff_flush_patch diff.c:5870
     git#6 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     #7 0x80cb6a in diff_flush diff.c:6552
     git#8 0x7c831f in run_diff_files diff-lib.c:265
     git#9 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#10 0x41e8c9 in run_builtin git.c:465
     git#11 0x41e8c9 in handle_builtin git.c:719
     git#12 0x41f9ac in run_argv git.c:786
     git#13 0x41f9ac in cmd_main git.c:917
     git#14 0x419515 in main common-main.c:56
     git#15 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#16 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#17 0x41b494 in _start (git+0x41b494)

 0x6020000004f0 is located 0 bytes inside of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 0x6020000004ef is located 1 bytes to the left of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 SUMMARY: AddressSanitizer: invalid-pointer-pair diff.c:621 in count_trailing_blank
 ==7972==ABORTING

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
phillipwood added a commit to phillipwood/git that referenced this pull request Apr 29, 2022
 test-results/t0010-racy-git.out...
 ------------------------------------------------------------------------
 Initialized empty Git repository in /__w/git/git/t/trash directory.t0010-racy-git/.git/
 =================================================================
 ==7972==ERROR: AddressSanitizer: invalid-pointer-pair: 0x6020000004f0 0x6020000004ef
     #0 0x7cfcbb in count_trailing_blank diff.c:621
     #1 0x7cfe73 in check_blank_at_eof diff.c:637
     #2 0x804cb9 in builtin_diff diff.c:3583
     #3 0x809494 in run_diff_cmd diff.c:4428
     #4 0x80ae96 in run_diff diff.c:4517
     #5 0x80ae96 in diff_flush_patch diff.c:5870
     git#6 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     #7 0x80cb6a in diff_flush diff.c:6552
     git#8 0x7c831f in run_diff_files diff-lib.c:265
     git#9 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#10 0x41e8c9 in run_builtin git.c:465
     git#11 0x41e8c9 in handle_builtin git.c:719
     git#12 0x41f9ac in run_argv git.c:786
     git#13 0x41f9ac in cmd_main git.c:917
     git#14 0x419515 in main common-main.c:56
     git#15 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#16 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#17 0x41b494 in _start (git+0x41b494)

 0x6020000004f0 is located 0 bytes inside of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 0x6020000004ef is located 1 bytes to the left of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 SUMMARY: AddressSanitizer: invalid-pointer-pair diff.c:621 in count_trailing_blank
 ==7972==ABORTING

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
phillipwood added a commit to phillipwood/git that referenced this pull request Apr 30, 2022
 test-results/t0010-racy-git.out...
 ------------------------------------------------------------------------
 Initialized empty Git repository in /__w/git/git/t/trash directory.t0010-racy-git/.git/
 =================================================================
 ==7972==ERROR: AddressSanitizer: invalid-pointer-pair: 0x6020000004f0 0x6020000004ef
     #0 0x7cfcbb in count_trailing_blank diff.c:621
     #1 0x7cfe73 in check_blank_at_eof diff.c:637
     #2 0x804cb9 in builtin_diff diff.c:3583
     #3 0x809494 in run_diff_cmd diff.c:4428
     #4 0x80ae96 in run_diff diff.c:4517
     #5 0x80ae96 in diff_flush_patch diff.c:5870
     git#6 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     #7 0x80cb6a in diff_flush diff.c:6552
     git#8 0x7c831f in run_diff_files diff-lib.c:265
     git#9 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#10 0x41e8c9 in run_builtin git.c:465
     git#11 0x41e8c9 in handle_builtin git.c:719
     git#12 0x41f9ac in run_argv git.c:786
     git#13 0x41f9ac in cmd_main git.c:917
     git#14 0x419515 in main common-main.c:56
     git#15 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#16 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#17 0x41b494 in _start (git+0x41b494)

 0x6020000004f0 is located 0 bytes inside of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 0x6020000004ef is located 1 bytes to the left of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 SUMMARY: AddressSanitizer: invalid-pointer-pair diff.c:621 in count_trailing_blank
 ==7972==ABORTING

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
phillipwood added a commit to phillipwood/git that referenced this pull request Jun 19, 2022
 test-results/t0010-racy-git.out...
 ------------------------------------------------------------------------
 Initialized empty Git repository in /__w/git/git/t/trash directory.t0010-racy-git/.git/
 =================================================================
 ==7972==ERROR: AddressSanitizer: invalid-pointer-pair: 0x6020000004f0 0x6020000004ef
     #0 0x7cfcbb in count_trailing_blank diff.c:621
     #1 0x7cfe73 in check_blank_at_eof diff.c:637
     #2 0x804cb9 in builtin_diff diff.c:3583
     #3 0x809494 in run_diff_cmd diff.c:4428
     #4 0x80ae96 in run_diff diff.c:4517
     #5 0x80ae96 in diff_flush_patch diff.c:5870
     git#6 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     #7 0x80cb6a in diff_flush diff.c:6552
     git#8 0x7c831f in run_diff_files diff-lib.c:265
     git#9 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#10 0x41e8c9 in run_builtin git.c:465
     git#11 0x41e8c9 in handle_builtin git.c:719
     git#12 0x41f9ac in run_argv git.c:786
     git#13 0x41f9ac in cmd_main git.c:917
     git#14 0x419515 in main common-main.c:56
     git#15 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#16 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#17 0x41b494 in _start (git+0x41b494)

 0x6020000004f0 is located 0 bytes inside of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 0x6020000004ef is located 1 bytes to the left of 7-byte region [0x6020000004f0,0x6020000004f7)
 allocated by thread T0 here:
     #0 0x7f8a847c291f in __interceptor_malloc (/lib64/libasan.so.6+0xae91f)
     #1 0xc30972 in do_xmalloc wrapper.c:51
     #2 0xc30afd in do_xmallocz wrapper.c:85
     #3 0xc30afd in do_xmallocz wrapper.c:75
     #4 0xc30afd in xmallocz wrapper.c:93
     #5 0x97fbe1 in unpack_loose_rest object-file.c:1312
     git#6 0x98d70c in loose_object_info object-file.c:1479
     #7 0x98e270 in do_oid_object_info_extended object-file.c:1577
     git#8 0x98e9fe in oid_object_info_extended object-file.c:1639
     git#9 0x7f3204 in diff_populate_filespec diff.c:4100
     git#10 0x7f3ab9 in diff_filespec_is_binary diff.c:3329
     git#11 0x805ec6 in builtin_diff diff.c:3507
     git#12 0x809494 in run_diff_cmd diff.c:4428
     git#13 0x80ae96 in run_diff diff.c:4517
     git#14 0x80ae96 in diff_flush_patch diff.c:5870
     git#15 0x80cb6a in diff_flush_patch_all_file_pairs diff.c:6409
     git#16 0x80cb6a in diff_flush diff.c:6552
     git#17 0x7c831f in run_diff_files diff-lib.c:265
     git#18 0x4ac215 in cmd_diff_files builtin/diff-files.c:82
     git#19 0x41e8c9 in run_builtin git.c:465
     git#20 0x41e8c9 in handle_builtin git.c:719
     git#21 0x41f9ac in run_argv git.c:786
     git#22 0x41f9ac in cmd_main git.c:917
     git#23 0x419515 in main common-main.c:56
     git#24 0x7f8a83bad55f in __libc_start_call_main (/lib64/libc.so.6+0x2d55f)
     git#25 0x7f8a83bad60b in __libc_start_main_impl (/lib64/libc.so.6+0x2d60b)
     git#26 0x41b494 in _start (git+0x41b494)

 SUMMARY: AddressSanitizer: invalid-pointer-pair diff.c:621 in count_trailing_blank
 ==7972==ABORTING

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
john-cai added a commit to john-cai/git that referenced this pull request Sep 26, 2022
In the tmp-objdir api, tmp_objdir_create will create a temporary
directory but also register signal handlers responsible for removing the
directory's contents and the directory itself. However, the function
responsible for recursively removing the contents and directory,
remove_dir_recurse() calls opendir(3) and closedir(3). This can be problematic
because these functions allocate and free memory, which are not
async-signal-safe functions. This can lead to deadlocks.

One place we call tmp_objdir_create() is in git-receive-pack, where we create a
temporary quarantine directory "incoming". Incoming objects will be written to
this directory before they get moved to the object directory.

We have observed this code leading to a deadlock:

	Thread 1 (Thread 0x7f621ba0b200 (LWP 326305)):
	#0  __lll_lock_wait_private (futex=futex@entry=0x7f621bbf8b80 <main_arena>) at ./lowlevellock.c:35
	#1  0x00007f621baa635b in __GI___libc_malloc (bytes=bytes@entry=32816) at malloc.c:3064
	#2  0x00007f621bae9f49 in __alloc_dir (statp=0x7fff2ea7ed60, flags=0, close_fd=true, fd=5) at ../sysdeps/posix/opendir.c:118
	#3  opendir_tail (fd=5) at ../sysdeps/posix/opendir.c:69
	#4  __opendir (name=<optimized out>) at ../sysdeps/posix/opendir.c:92
	#5  0x0000557c19c77de1 in remove_dir_recurse ()
	git#6  0x0000557c19d81a4f in remove_tmp_objdir_on_signal ()
	#7  <signal handler called>
	git#8  _int_malloc (av=av@entry=0x7f621bbf8b80 <main_arena>, bytes=bytes@entry=7160) at malloc.c:4116
	git#9  0x00007f621baa62c9 in __GI___libc_malloc (bytes=7160) at malloc.c:3066
	git#10 0x00007f621bd1e987 in inflateInit2_ () from /opt/gitlab/embedded/lib/libz.so.1
	git#11 0x0000557c19dbe5f4 in git_inflate_init ()
	git#12 0x0000557c19cee02a in unpack_compressed_entry ()
	git#13 0x0000557c19cf08cb in unpack_entry ()
	git#14 0x0000557c19cf0f32 in packed_object_info ()
	git#15 0x0000557c19cd68cd in do_oid_object_info_extended ()
	git#16 0x0000557c19cd6e2b in read_object_file_extended ()
	git#17 0x0000557c19cdec2f in parse_object ()
	git#18 0x0000557c19c34977 in lookup_commit_reference_gently ()
	git#19 0x0000557c19d69309 in mark_uninteresting ()
	git#20 0x0000557c19d2d180 in do_for_each_repo_ref_iterator ()
	git#21 0x0000557c19d21678 in for_each_ref ()
	git#22 0x0000557c19d6a94f in assign_shallow_commits_to_refs ()
	git#23 0x0000557c19bc02b2 in cmd_receive_pack ()
	git#24 0x0000557c19b29fdd in handle_builtin ()
	git#25 0x0000557c19b2a526 in cmd_main ()
	git#26 0x0000557c19b28ea2 in main ()

To prevent this, add a flag REMOVE_DIR_SIGNAL that allows remove_dir_recurse()
to know that a signal is being handled and avoid calling opendir(3).
One implication of this change is that when signal handling, the temporary
directory may not get cleaned up properly.

Signed-off-by: John Cai <johncai86@gmail.com>
john-cai added a commit to john-cai/git that referenced this pull request Sep 26, 2022
In the tmp-objdir api, tmp_objdir_create will create a temporary
directory but also register signal handlers responsible for removing the
directory's contents and the directory itself. However, the function
responsible for recursively removing the contents and directory,
remove_dir_recurse() calls opendir(3) and closedir(3). This can be problematic
because these functions allocate and free memory, which are not
async-signal-safe functions. This can lead to deadlocks.

One place we call tmp_objdir_create() is in git-receive-pack, where we create a
temporary quarantine directory "incoming". Incoming objects will be written to
this directory before they get moved to the object directory.

We have observed this code leading to a deadlock:

	Thread 1 (Thread 0x7f621ba0b200 (LWP 326305)):
	#0  __lll_lock_wait_private (futex=futex@entry=0x7f621bbf8b80
		<main_arena>) at ./lowlevellock.c:35
	#1  0x00007f621baa635b in __GI___libc_malloc (bytes=bytes@entry=32816)
		at malloc.c:3064
	#2  0x00007f621bae9f49 in __alloc_dir (statp=0x7fff2ea7ed60, flags=0,
		close_fd=true, fd=5) at ../sysdeps/posix/opendir.c:118
	#3  opendir_tail (fd=5) at ../sysdeps/posix/opendir.c:69
	#4  __opendir (name=<optimized out>) at ../sysdeps/posix/opendir.c:92
	#5  0x0000557c19c77de1 in remove_dir_recurse ()
	git#6  0x0000557c19d81a4f in remove_tmp_objdir_on_signal ()
	#7  <signal handler called>
	git#8  _int_malloc (av=av@entry=0x7f621bbf8b80 <main_arena>,
		bytes=bytes@entry=7160) at malloc.c:4116
	git#9  0x00007f621baa62c9 in __GI___libc_malloc (bytes=7160)
		at malloc.c:3066
	git#10 0x00007f621bd1e987 in inflateInit2_ ()
		from /opt/gitlab/embedded/lib/libz.so.1
	git#11 0x0000557c19dbe5f4 in git_inflate_init ()
	git#12 0x0000557c19cee02a in unpack_compressed_entry ()
	git#13 0x0000557c19cf08cb in unpack_entry ()
	git#14 0x0000557c19cf0f32 in packed_object_info ()
	git#15 0x0000557c19cd68cd in do_oid_object_info_extended ()
	git#16 0x0000557c19cd6e2b in read_object_file_extended ()
	git#17 0x0000557c19cdec2f in parse_object ()
	git#18 0x0000557c19c34977 in lookup_commit_reference_gently ()
	git#19 0x0000557c19d69309 in mark_uninteresting ()
	git#20 0x0000557c19d2d180 in do_for_each_repo_ref_iterator ()
	git#21 0x0000557c19d21678 in for_each_ref ()
	git#22 0x0000557c19d6a94f in assign_shallow_commits_to_refs ()
	git#23 0x0000557c19bc02b2 in cmd_receive_pack ()
	git#24 0x0000557c19b29fdd in handle_builtin ()
	git#25 0x0000557c19b2a526 in cmd_main ()
	git#26 0x0000557c19b28ea2 in main ()

To prevent this, add a flag REMOVE_DIR_SIGNAL that allows remove_dir_recurse()
to know that a signal is being handled and avoid calling opendir(3).
One implication of this change is that when signal handling, the temporary
directory may not get cleaned up properly.

Signed-off-by: John Cai <johncai86@gmail.com>
john-cai added a commit to john-cai/git that referenced this pull request Sep 26, 2022
In the tmp-objdir api, tmp_objdir_create will create a temporary
directory but also register signal handlers responsible for removing
the directory's contents and the directory itself. However, the
function responsible for recursively removing the contents and
directory, remove_dir_recurse() calls opendir(3) and closedir(3).
This can be problematic because these functions allocate and free
memory, which are not async-signal-safe functions. This can lead to
deadlocks.

One place we call tmp_objdir_create() is in git-receive-pack, where
we create a temporary quarantine directory "incoming". Incoming
objects will be written to this directory before they get moved to
the object directory.

We have observed this code leading to a deadlock:

	Thread 1 (Thread 0x7f621ba0b200 (LWP 326305)):
	#0  __lll_lock_wait_private (futex=futex@entry=0x7f621bbf8b80
		<main_arena>) at ./lowlevellock.c:35
	#1  0x00007f621baa635b in __GI___libc_malloc
		(bytes=bytes@entry=32816) at malloc.c:3064
	#2  0x00007f621bae9f49 in __alloc_dir (statp=0x7fff2ea7ed60,
		flags=0, close_fd=true, fd=5)
		at ../sysdeps/posix/opendir.c:118
	#3  opendir_tail (fd=5) at ../sysdeps/posix/opendir.c:69
	#4  __opendir (name=<optimized out>)
		at ../sysdeps/posix/opendir.c:92
	#5  0x0000557c19c77de1 in remove_dir_recurse ()
	git#6  0x0000557c19d81a4f in remove_tmp_objdir_on_signal ()
	#7  <signal handler called>
	git#8  _int_malloc (av=av@entry=0x7f621bbf8b80 <main_arena>,
		bytes=bytes@entry=7160) at malloc.c:4116
	git#9  0x00007f621baa62c9 in __GI___libc_malloc (bytes=7160)
		at malloc.c:3066
	git#10 0x00007f621bd1e987 in inflateInit2_ ()
		from /opt/gitlab/embedded/lib/libz.so.1
	git#11 0x0000557c19dbe5f4 in git_inflate_init ()
	git#12 0x0000557c19cee02a in unpack_compressed_entry ()
	git#13 0x0000557c19cf08cb in unpack_entry ()
	git#14 0x0000557c19cf0f32 in packed_object_info ()
	git#15 0x0000557c19cd68cd in do_oid_object_info_extended ()
	git#16 0x0000557c19cd6e2b in read_object_file_extended ()
	git#17 0x0000557c19cdec2f in parse_object ()
	git#18 0x0000557c19c34977 in lookup_commit_reference_gently ()
	git#19 0x0000557c19d69309 in mark_uninteresting ()
	git#20 0x0000557c19d2d180 in do_for_each_repo_ref_iterator ()
	git#21 0x0000557c19d21678 in for_each_ref ()
	git#22 0x0000557c19d6a94f in assign_shallow_commits_to_refs ()
	git#23 0x0000557c19bc02b2 in cmd_receive_pack ()
	git#24 0x0000557c19b29fdd in handle_builtin ()
	git#25 0x0000557c19b2a526 in cmd_main ()
	git#26 0x0000557c19b28ea2 in main ()

To prevent this, add a flag REMOVE_DIR_SIGNAL that allows
remove_dir_recurse() to know that a signal is being handled and avoid
calling opendir(3). One implication of this change is that when
signal handling, the temporary directory may not get cleaned up
properly.

Signed-off-by: John Cai <johncai86@gmail.com>
john-cai added a commit to john-cai/git that referenced this pull request Sep 26, 2022
In the tmp-objdir api, tmp_objdir_create will create a temporary
directory but also register signal handlers responsible for removing
the directory's contents and the directory itself. However, the
function responsible for recursively removing the contents and
directory, remove_dir_recurse() calls opendir(3) and closedir(3).
This can be problematic because these functions allocate and free
memory, which are not async-signal-safe functions. This can lead to
deadlocks.

One place we call tmp_objdir_create() is in git-receive-pack, where
we create a temporary quarantine directory "incoming". Incoming
objects will be written to this directory before they get moved to
the object directory.

We have observed this code leading to a deadlock:

	Thread 1 (Thread 0x7f621ba0b200 (LWP 326305)):
	#0  __lll_lock_wait_private (futex=futex@entry=0x7f621bbf8b80
		<main_arena>) at ./lowlevellock.c:35
	#1  0x00007f621baa635b in __GI___libc_malloc
		(bytes=bytes@entry=32816) at malloc.c:3064
	#2  0x00007f621bae9f49 in __alloc_dir (statp=0x7fff2ea7ed60,
		flags=0, close_fd=true, fd=5)
		at ../sysdeps/posix/opendir.c:118
	#3  opendir_tail (fd=5) at ../sysdeps/posix/opendir.c:69
	#4  __opendir (name=<optimized out>)
		at ../sysdeps/posix/opendir.c:92
	#5  0x0000557c19c77de1 in remove_dir_recurse ()
	git#6  0x0000557c19d81a4f in remove_tmp_objdir_on_signal ()
	#7  <signal handler called>
	git#8  _int_malloc (av=av@entry=0x7f621bbf8b80 <main_arena>,
		bytes=bytes@entry=7160) at malloc.c:4116
	git#9  0x00007f621baa62c9 in __GI___libc_malloc (bytes=7160)
		at malloc.c:3066
	git#10 0x00007f621bd1e987 in inflateInit2_ ()
		from /opt/gitlab/embedded/lib/libz.so.1
	git#11 0x0000557c19dbe5f4 in git_inflate_init ()
	git#12 0x0000557c19cee02a in unpack_compressed_entry ()
	git#13 0x0000557c19cf08cb in unpack_entry ()
	git#14 0x0000557c19cf0f32 in packed_object_info ()
	git#15 0x0000557c19cd68cd in do_oid_object_info_extended ()
	git#16 0x0000557c19cd6e2b in read_object_file_extended ()
	git#17 0x0000557c19cdec2f in parse_object ()
	git#18 0x0000557c19c34977 in lookup_commit_reference_gently ()
	git#19 0x0000557c19d69309 in mark_uninteresting ()
	git#20 0x0000557c19d2d180 in do_for_each_repo_ref_iterator ()
	git#21 0x0000557c19d21678 in for_each_ref ()
	git#22 0x0000557c19d6a94f in assign_shallow_commits_to_refs ()
	git#23 0x0000557c19bc02b2 in cmd_receive_pack ()
	git#24 0x0000557c19b29fdd in handle_builtin ()
	git#25 0x0000557c19b2a526 in cmd_main ()
	git#26 0x0000557c19b28ea2 in main ()

To prevent this, add a flag REMOVE_DIR_SIGNAL that allows
remove_dir_recurse() to know that a signal is being handled and avoid
calling opendir(3). One implication of this change is that when
signal handling, the temporary directory may not get cleaned up
properly.

Signed-off-by: John Cai <johncai86@gmail.com>
john-cai added a commit to john-cai/git that referenced this pull request Sep 27, 2022
In the tmp-objdir api, tmp_objdir_create will create a temporary
directory but also register signal handlers responsible for removing
the directory's contents and the directory itself. However, the
function responsible for recursively removing the contents and
directory, remove_dir_recurse() calls opendir(3) and closedir(3).
This can be problematic because these functions allocate and free
memory, which are not async-signal-safe functions. This can lead to
deadlocks.

One place we call tmp_objdir_create() is in git-receive-pack, where
we create a temporary quarantine directory "incoming". Incoming
objects will be written to this directory before they get moved to
the object directory.

We have observed this code leading to a deadlock:

	Thread 1 (Thread 0x7f621ba0b200 (LWP 326305)):
	#0  __lll_lock_wait_private (futex=futex@entry=0x7f621bbf8b80
		<main_arena>) at ./lowlevellock.c:35
	#1  0x00007f621baa635b in __GI___libc_malloc
		(bytes=bytes@entry=32816) at malloc.c:3064
	#2  0x00007f621bae9f49 in __alloc_dir (statp=0x7fff2ea7ed60,
		flags=0, close_fd=true, fd=5)
		at ../sysdeps/posix/opendir.c:118
	#3  opendir_tail (fd=5) at ../sysdeps/posix/opendir.c:69
	#4  __opendir (name=<optimized out>)
		at ../sysdeps/posix/opendir.c:92
	#5  0x0000557c19c77de1 in remove_dir_recurse ()
	git#6  0x0000557c19d81a4f in remove_tmp_objdir_on_signal ()
	#7  <signal handler called>
	git#8  _int_malloc (av=av@entry=0x7f621bbf8b80 <main_arena>,
		bytes=bytes@entry=7160) at malloc.c:4116
	git#9  0x00007f621baa62c9 in __GI___libc_malloc (bytes=7160)
		at malloc.c:3066
	git#10 0x00007f621bd1e987 in inflateInit2_ ()
		from /opt/gitlab/embedded/lib/libz.so.1
	git#11 0x0000557c19dbe5f4 in git_inflate_init ()
	git#12 0x0000557c19cee02a in unpack_compressed_entry ()
	git#13 0x0000557c19cf08cb in unpack_entry ()
	git#14 0x0000557c19cf0f32 in packed_object_info ()
	git#15 0x0000557c19cd68cd in do_oid_object_info_extended ()
	git#16 0x0000557c19cd6e2b in read_object_file_extended ()
	git#17 0x0000557c19cdec2f in parse_object ()
	git#18 0x0000557c19c34977 in lookup_commit_reference_gently ()
	git#19 0x0000557c19d69309 in mark_uninteresting ()
	git#20 0x0000557c19d2d180 in do_for_each_repo_ref_iterator ()
	git#21 0x0000557c19d21678 in for_each_ref ()
	git#22 0x0000557c19d6a94f in assign_shallow_commits_to_refs ()
	git#23 0x0000557c19bc02b2 in cmd_receive_pack ()
	git#24 0x0000557c19b29fdd in handle_builtin ()
	git#25 0x0000557c19b2a526 in cmd_main ()
	git#26 0x0000557c19b28ea2 in main ()

Since we can't do the cleanup in a portable and signal-safe way, skip
the cleanup when we're handling a signal.

This means that when signal handling, the temporary directory may not
get cleaned up properly. This is mitigated by b3cecf4 (tmp-objdir: new
API for creating temporary writable databases, 2021-12-06) which changed
the default name and allows gc to clean up these temporary directories.

Signed-off-by: John Cai <johncai86@gmail.com>
john-cai added a commit to john-cai/git that referenced this pull request Sep 27, 2022
In the tmp-objdir api, tmp_objdir_create will create a temporary
directory but also register signal handlers responsible for removing
the directory's contents and the directory itself. However, the
function responsible for recursively removing the contents and
directory, remove_dir_recurse() calls opendir(3) and closedir(3).
This can be problematic because these functions allocate and free
memory, which are not async-signal-safe functions. This can lead to
deadlocks.

One place we call tmp_objdir_create() is in git-receive-pack, where
we create a temporary quarantine directory "incoming". Incoming
objects will be written to this directory before they get moved to
the object directory.

We have observed this code leading to a deadlock:

	Thread 1 (Thread 0x7f621ba0b200 (LWP 326305)):
	#0  __lll_lock_wait_private (futex=futex@entry=0x7f621bbf8b80
		<main_arena>) at ./lowlevellock.c:35
	#1  0x00007f621baa635b in __GI___libc_malloc
		(bytes=bytes@entry=32816) at malloc.c:3064
	#2  0x00007f621bae9f49 in __alloc_dir (statp=0x7fff2ea7ed60,
		flags=0, close_fd=true, fd=5)
		at ../sysdeps/posix/opendir.c:118
	#3  opendir_tail (fd=5) at ../sysdeps/posix/opendir.c:69
	#4  __opendir (name=<optimized out>)
		at ../sysdeps/posix/opendir.c:92
	#5  0x0000557c19c77de1 in remove_dir_recurse ()
	git#6  0x0000557c19d81a4f in remove_tmp_objdir_on_signal ()
	#7  <signal handler called>
	git#8  _int_malloc (av=av@entry=0x7f621bbf8b80 <main_arena>,
		bytes=bytes@entry=7160) at malloc.c:4116
	git#9  0x00007f621baa62c9 in __GI___libc_malloc (bytes=7160)
		at malloc.c:3066
	git#10 0x00007f621bd1e987 in inflateInit2_ ()
		from /opt/gitlab/embedded/lib/libz.so.1
	git#11 0x0000557c19dbe5f4 in git_inflate_init ()
	git#12 0x0000557c19cee02a in unpack_compressed_entry ()
	git#13 0x0000557c19cf08cb in unpack_entry ()
	git#14 0x0000557c19cf0f32 in packed_object_info ()
	git#15 0x0000557c19cd68cd in do_oid_object_info_extended ()
	git#16 0x0000557c19cd6e2b in read_object_file_extended ()
	git#17 0x0000557c19cdec2f in parse_object ()
	git#18 0x0000557c19c34977 in lookup_commit_reference_gently ()
	git#19 0x0000557c19d69309 in mark_uninteresting ()
	git#20 0x0000557c19d2d180 in do_for_each_repo_ref_iterator ()
	git#21 0x0000557c19d21678 in for_each_ref ()
	git#22 0x0000557c19d6a94f in assign_shallow_commits_to_refs ()
	git#23 0x0000557c19bc02b2 in cmd_receive_pack ()
	git#24 0x0000557c19b29fdd in handle_builtin ()
	git#25 0x0000557c19b2a526 in cmd_main ()
	git#26 0x0000557c19b28ea2 in main ()

Since we can't do the cleanup in a portable and signal-safe way, skip
the cleanup when we're handling a signal.

This means that when signal handling, the temporary directory may not
get cleaned up properly. This is mitigated by b3cecf4 (tmp-objdir: new
API for creating temporary writable databases, 2021-12-06) which changed
the default name and allows gc to clean up these temporary directories.

Signed-off-by: John Cai <johncai86@gmail.com>
john-cai added a commit to john-cai/git that referenced this pull request Sep 28, 2022
In the tmp-objdir api, tmp_objdir_create will create a temporary
directory but also register signal handlers responsible for removing
the directory's contents and the directory itself. However, the
function responsible for recursively removing the contents and
directory, remove_dir_recurse() calls opendir(3) and closedir(3).
This can be problematic because these functions allocate and free
memory, which are not async-signal-safe functions. This can lead to
deadlocks.

One place we call tmp_objdir_create() is in git-receive-pack, where
we create a temporary quarantine directory "incoming". Incoming
objects will be written to this directory before they get moved to
the object directory.

We have observed this code leading to a deadlock:

	Thread 1 (Thread 0x7f621ba0b200 (LWP 326305)):
	#0  __lll_lock_wait_private (futex=futex@entry=0x7f621bbf8b80
		<main_arena>) at ./lowlevellock.c:35
	#1  0x00007f621baa635b in __GI___libc_malloc
		(bytes=bytes@entry=32816) at malloc.c:3064
	#2  0x00007f621bae9f49 in __alloc_dir (statp=0x7fff2ea7ed60,
		flags=0, close_fd=true, fd=5)
		at ../sysdeps/posix/opendir.c:118
	#3  opendir_tail (fd=5) at ../sysdeps/posix/opendir.c:69
	#4  __opendir (name=<optimized out>)
		at ../sysdeps/posix/opendir.c:92
	#5  0x0000557c19c77de1 in remove_dir_recurse ()
	git#6  0x0000557c19d81a4f in remove_tmp_objdir_on_signal ()
	#7  <signal handler called>
	git#8  _int_malloc (av=av@entry=0x7f621bbf8b80 <main_arena>,
		bytes=bytes@entry=7160) at malloc.c:4116
	git#9  0x00007f621baa62c9 in __GI___libc_malloc (bytes=7160)
		at malloc.c:3066
	git#10 0x00007f621bd1e987 in inflateInit2_ ()
		from /opt/gitlab/embedded/lib/libz.so.1
	git#11 0x0000557c19dbe5f4 in git_inflate_init ()
	git#12 0x0000557c19cee02a in unpack_compressed_entry ()
	git#13 0x0000557c19cf08cb in unpack_entry ()
	git#14 0x0000557c19cf0f32 in packed_object_info ()
	git#15 0x0000557c19cd68cd in do_oid_object_info_extended ()
	git#16 0x0000557c19cd6e2b in read_object_file_extended ()
	git#17 0x0000557c19cdec2f in parse_object ()
	git#18 0x0000557c19c34977 in lookup_commit_reference_gently ()
	git#19 0x0000557c19d69309 in mark_uninteresting ()
	git#20 0x0000557c19d2d180 in do_for_each_repo_ref_iterator ()
	git#21 0x0000557c19d21678 in for_each_ref ()
	git#22 0x0000557c19d6a94f in assign_shallow_commits_to_refs ()
	git#23 0x0000557c19bc02b2 in cmd_receive_pack ()
	git#24 0x0000557c19b29fdd in handle_builtin ()
	git#25 0x0000557c19b2a526 in cmd_main ()
	git#26 0x0000557c19b28ea2 in main ()

Since we can't do the cleanup in a portable and signal-safe way, skip
the cleanup when we're handling a signal.

This means that when signal handling, the temporary directory may not
get cleaned up properly. This is mitigated by b3cecf4 (tmp-objdir: new
API for creating temporary writable databases, 2021-12-06) which changed
the default name and allows gc to clean up these temporary directories.

Signed-off-by: John Cai <johncai86@gmail.com>
john-cai added a commit to john-cai/git that referenced this pull request Sep 30, 2022
In the tmp-objdir api, tmp_objdir_create will create a temporary
directory but also register signal handlers responsible for removing
the directory's contents and the directory itself. However, the
function responsible for recursively removing the contents and
directory, remove_dir_recurse() calls opendir(3) and closedir(3).
This can be problematic because these functions allocate and free
memory, which are not async-signal-safe functions. This can lead to
deadlocks.

One place we call tmp_objdir_create() is in git-receive-pack, where
we create a temporary quarantine directory "incoming". Incoming
objects will be written to this directory before they get moved to
the object directory.

We have observed this code leading to a deadlock:

	Thread 1 (Thread 0x7f621ba0b200 (LWP 326305)):
	#0  __lll_lock_wait_private (futex=futex@entry=0x7f621bbf8b80
		<main_arena>) at ./lowlevellock.c:35
	#1  0x00007f621baa635b in __GI___libc_malloc
		(bytes=bytes@entry=32816) at malloc.c:3064
	#2  0x00007f621bae9f49 in __alloc_dir (statp=0x7fff2ea7ed60,
		flags=0, close_fd=true, fd=5)
		at ../sysdeps/posix/opendir.c:118
	#3  opendir_tail (fd=5) at ../sysdeps/posix/opendir.c:69
	#4  __opendir (name=<optimized out>)
		at ../sysdeps/posix/opendir.c:92
	#5  0x0000557c19c77de1 in remove_dir_recurse ()
	git#6  0x0000557c19d81a4f in remove_tmp_objdir_on_signal ()
	#7  <signal handler called>
	git#8  _int_malloc (av=av@entry=0x7f621bbf8b80 <main_arena>,
		bytes=bytes@entry=7160) at malloc.c:4116
	git#9  0x00007f621baa62c9 in __GI___libc_malloc (bytes=7160)
		at malloc.c:3066
	git#10 0x00007f621bd1e987 in inflateInit2_ ()
		from /opt/gitlab/embedded/lib/libz.so.1
	git#11 0x0000557c19dbe5f4 in git_inflate_init ()
	git#12 0x0000557c19cee02a in unpack_compressed_entry ()
	git#13 0x0000557c19cf08cb in unpack_entry ()
	git#14 0x0000557c19cf0f32 in packed_object_info ()
	git#15 0x0000557c19cd68cd in do_oid_object_info_extended ()
	git#16 0x0000557c19cd6e2b in read_object_file_extended ()
	git#17 0x0000557c19cdec2f in parse_object ()
	git#18 0x0000557c19c34977 in lookup_commit_reference_gently ()
	git#19 0x0000557c19d69309 in mark_uninteresting ()
	git#20 0x0000557c19d2d180 in do_for_each_repo_ref_iterator ()
	git#21 0x0000557c19d21678 in for_each_ref ()
	git#22 0x0000557c19d6a94f in assign_shallow_commits_to_refs ()
	git#23 0x0000557c19bc02b2 in cmd_receive_pack ()
	git#24 0x0000557c19b29fdd in handle_builtin ()
	git#25 0x0000557c19b2a526 in cmd_main ()
	git#26 0x0000557c19b28ea2 in main ()

Since we can't do the cleanup in a portable and signal-safe way, skip
the cleanup when we're handling a signal.

This means that when signal handling, the temporary directory may not
get cleaned up properly. This is mitigated by b3cecf4 (tmp-objdir: new
API for creating temporary writable databases, 2021-12-06) which changed
the default name and allows gc to clean up these temporary directories.

In the event of a normal exit, we should still be cleaning up via the
atexit() handler.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: John Cai <johncai86@gmail.com>
gitster pushed a commit that referenced this pull request Oct 2, 2022
In the tmp-objdir api, tmp_objdir_create will create a temporary
directory but also register signal handlers responsible for removing
the directory's contents and the directory itself. However, the
function responsible for recursively removing the contents and
directory, remove_dir_recurse() calls opendir(3) and closedir(3).
This can be problematic because these functions allocate and free
memory, which are not async-signal-safe functions. This can lead to
deadlocks.

One place we call tmp_objdir_create() is in git-receive-pack, where
we create a temporary quarantine directory "incoming". Incoming
objects will be written to this directory before they get moved to
the object directory.

We have observed this code leading to a deadlock:

	Thread 1 (Thread 0x7f621ba0b200 (LWP 326305)):
	#0  __lll_lock_wait_private (futex=futex@entry=0x7f621bbf8b80
		<main_arena>) at ./lowlevellock.c:35
	#1  0x00007f621baa635b in __GI___libc_malloc
		(bytes=bytes@entry=32816) at malloc.c:3064
	#2  0x00007f621bae9f49 in __alloc_dir (statp=0x7fff2ea7ed60,
		flags=0, close_fd=true, fd=5)
		at ../sysdeps/posix/opendir.c:118
	#3  opendir_tail (fd=5) at ../sysdeps/posix/opendir.c:69
	#4  __opendir (name=<optimized out>)
		at ../sysdeps/posix/opendir.c:92
	#5  0x0000557c19c77de1 in remove_dir_recurse ()
	#6  0x0000557c19d81a4f in remove_tmp_objdir_on_signal ()
	#7  <signal handler called>
	#8  _int_malloc (av=av@entry=0x7f621bbf8b80 <main_arena>,
		bytes=bytes@entry=7160) at malloc.c:4116
	#9  0x00007f621baa62c9 in __GI___libc_malloc (bytes=7160)
		at malloc.c:3066
	#10 0x00007f621bd1e987 in inflateInit2_ ()
		from /opt/gitlab/embedded/lib/libz.so.1
	#11 0x0000557c19dbe5f4 in git_inflate_init ()
	#12 0x0000557c19cee02a in unpack_compressed_entry ()
	#13 0x0000557c19cf08cb in unpack_entry ()
	#14 0x0000557c19cf0f32 in packed_object_info ()
	#15 0x0000557c19cd68cd in do_oid_object_info_extended ()
	#16 0x0000557c19cd6e2b in read_object_file_extended ()
	#17 0x0000557c19cdec2f in parse_object ()
	#18 0x0000557c19c34977 in lookup_commit_reference_gently ()
	#19 0x0000557c19d69309 in mark_uninteresting ()
	#20 0x0000557c19d2d180 in do_for_each_repo_ref_iterator ()
	#21 0x0000557c19d21678 in for_each_ref ()
	#22 0x0000557c19d6a94f in assign_shallow_commits_to_refs ()
	#23 0x0000557c19bc02b2 in cmd_receive_pack ()
	#24 0x0000557c19b29fdd in handle_builtin ()
	#25 0x0000557c19b2a526 in cmd_main ()
	#26 0x0000557c19b28ea2 in main ()

Since we can't do the cleanup in a portable and signal-safe way, skip
the cleanup when we're handling a signal.

This means that when signal handling, the temporary directory may not
get cleaned up properly. This is mitigated by b3cecf4 (tmp-objdir: new
API for creating temporary writable databases, 2021-12-06) which changed
the default name and allows gc to clean up these temporary directories.

In the event of a normal exit, we should still be cleaning up via the
atexit() handler.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: John Cai <johncai86@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
rudyrigot pushed a commit to rudyrigot/git that referenced this pull request Oct 28, 2022
In the tmp-objdir api, tmp_objdir_create will create a temporary
directory but also register signal handlers responsible for removing
the directory's contents and the directory itself. However, the
function responsible for recursively removing the contents and
directory, remove_dir_recurse() calls opendir(3) and closedir(3).
This can be problematic because these functions allocate and free
memory, which are not async-signal-safe functions. This can lead to
deadlocks.

One place we call tmp_objdir_create() is in git-receive-pack, where
we create a temporary quarantine directory "incoming". Incoming
objects will be written to this directory before they get moved to
the object directory.

We have observed this code leading to a deadlock:

	Thread 1 (Thread 0x7f621ba0b200 (LWP 326305)):
	#0  __lll_lock_wait_private (futex=futex@entry=0x7f621bbf8b80
		<main_arena>) at ./lowlevellock.c:35
	#1  0x00007f621baa635b in __GI___libc_malloc
		(bytes=bytes@entry=32816) at malloc.c:3064
	#2  0x00007f621bae9f49 in __alloc_dir (statp=0x7fff2ea7ed60,
		flags=0, close_fd=true, fd=5)
		at ../sysdeps/posix/opendir.c:118
	#3  opendir_tail (fd=5) at ../sysdeps/posix/opendir.c:69
	#4  __opendir (name=<optimized out>)
		at ../sysdeps/posix/opendir.c:92
	#5  0x0000557c19c77de1 in remove_dir_recurse ()
	git#6  0x0000557c19d81a4f in remove_tmp_objdir_on_signal ()
	#7  <signal handler called>
	git#8  _int_malloc (av=av@entry=0x7f621bbf8b80 <main_arena>,
		bytes=bytes@entry=7160) at malloc.c:4116
	git#9  0x00007f621baa62c9 in __GI___libc_malloc (bytes=7160)
		at malloc.c:3066
	git#10 0x00007f621bd1e987 in inflateInit2_ ()
		from /opt/gitlab/embedded/lib/libz.so.1
	git#11 0x0000557c19dbe5f4 in git_inflate_init ()
	git#12 0x0000557c19cee02a in unpack_compressed_entry ()
	git#13 0x0000557c19cf08cb in unpack_entry ()
	git#14 0x0000557c19cf0f32 in packed_object_info ()
	git#15 0x0000557c19cd68cd in do_oid_object_info_extended ()
	git#16 0x0000557c19cd6e2b in read_object_file_extended ()
	git#17 0x0000557c19cdec2f in parse_object ()
	git#18 0x0000557c19c34977 in lookup_commit_reference_gently ()
	git#19 0x0000557c19d69309 in mark_uninteresting ()
	git#20 0x0000557c19d2d180 in do_for_each_repo_ref_iterator ()
	git#21 0x0000557c19d21678 in for_each_ref ()
	git#22 0x0000557c19d6a94f in assign_shallow_commits_to_refs ()
	git#23 0x0000557c19bc02b2 in cmd_receive_pack ()
	git#24 0x0000557c19b29fdd in handle_builtin ()
	git#25 0x0000557c19b2a526 in cmd_main ()
	git#26 0x0000557c19b28ea2 in main ()

Since we can't do the cleanup in a portable and signal-safe way, skip
the cleanup when we're handling a signal.

This means that when signal handling, the temporary directory may not
get cleaned up properly. This is mitigated by b3cecf4 (tmp-objdir: new
API for creating temporary writable databases, 2021-12-06) which changed
the default name and allows gc to clean up these temporary directories.

In the event of a normal exit, we should still be cleaning up via the
atexit() handler.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: John Cai <johncai86@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
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

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载