Libelektra: cmerge : segfault

์— ๋งŒ๋“  2019๋…„ 11์›” 15์ผ  ยท  7์ฝ”๋ฉ˜ํŠธ  ยท  ์ถœ์ฒ˜: ElektraInitiative/libelektra

๋ฌธ์ œ๋ฅผ ์žฌํ˜„ํ•˜๋Š” ๋‹จ๊ณ„

libelektra๋ฅผ ๊ตฌ์„ฑํ•˜๊ณ  ๋งŒ๋“ญ๋‹ˆ๋‹ค.

make run all

์˜ˆ์ƒ ๊ฒฐ๊ณผ

๋ชจ๋“  ํ…Œ์ŠคํŠธ๊ฐ€ ์„ฑ๊ณตํ•ฉ๋‹ˆ๋‹ค.

์‹ค์ œ ๊ฒฐ๊ณผ

The following tests FAILED:
    210 - testshell_markdown_cmerge (Failed)
    225 - test_cmerge (SEGFAULT)
 valgrind ./bin/test_cmerge
==200629== Memcheck, a memory error detector
==200629== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==200629== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==200629== Command: ./bin/test_cmerge
==200629== 
CMERGE       TESTS
==================

Executing testValuesWithGivenLength with size 59
==200629== Jump to the invalid address stated on the next line
==200629==    at 0x0: ???
==200629==    by 0xF: ???
==200629==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==200629== 
==200629== 
==200629== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==200629==  Bad permissions for mapped region at address 0x0
==200629==    at 0x0: ???
==200629==    by 0xF: ???
==200629== 
==200629== HEAP SUMMARY:
==200629==     in use at exit: 4,388 bytes in 64 blocks
==200629==   total heap usage: 169 allocs, 105 frees, 81,447 bytes allocated
==200629== 
==200629== LEAK SUMMARY:
==200629==    definitely lost: 0 bytes in 0 blocks
==200629==    indirectly lost: 0 bytes in 0 blocks
==200629==      possibly lost: 0 bytes in 0 blocks
==200629==    still reachable: 4,388 bytes in 64 blocks
==200629==         suppressed: 0 bytes in 0 blocks
==200629== Rerun with --leak-check=full to see details of leaked memory
==200629== 
==200629== For lists of detected and suppressed errors, rerun with: -s
==200629== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
[1]    200629 segmentation fault (core dumped)  valgrind ./bin/test_cmerge

์‹œ์Šคํ…œ ์ •๋ณด

  • Elektra ๋ฒ„์ „ : master
  • ํŽ˜๋„๋ผ 31

์ถ”๊ฐ€ ๋กœ๊ทธ ํŒŒ์ผ ๋ฐ ์ถœ๋ ฅ

cmerge.txt

๊ฐ€์žฅ ์œ ์šฉํ•œ ๋Œ“๊ธ€

@ Chemin1 ๋„ˆ๋ฌด ๋นจ๋ฆฌ

๋ชจ๋“  7 ๋Œ“๊ธ€

Linux์— libgit2 0.28.3์ด ์žˆ๋Š”๋ฐ ์ž‘๋™ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์ฝ”๋“œ์—์„œ CMERGE_ON_LINUX ๊ฒ€์‚ฌ๋ฅผ ์ œ๊ฑฐํ•˜๋ฉด segfault๊ฐ€ ์ˆ˜์ •๋ฉ๋‹ˆ๋‹ค.
https://github.com/ElektraInitiative/libelektra/blob/4ee9617186fe053107530624b27ff2825478f257/src/libs/merge/kdbmerge.c#L991

์ด ๋ฌธ์ œ๋ฅผ ์‹ ๊ณ  ํ•ด ์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค!

0.9.1 ์ด์ „์— ํ™•์‹คํžˆ ์ˆ˜์ •ํ•ด์•ผํ•ฉ๋‹ˆ๋‹ค. ์ด ๊ฒฝ์šฐ ๋‹จ์ˆœํžˆ libgit2๋ฅผ ๋น„ํ™œ์„ฑํ™”ํ•˜๋ฉด๋ฉ๋‹ˆ๋‹ค.

@mpranj ๋Š” gdb ์ถœ๋ ฅ์„ ๊ฒŒ์‹œ ํ•  ์ˆ˜๋„

LibGit์— ๊ด€ํ•œ ๊ฒƒ์ž…๋‹ˆ๋‹ค. ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋Š” ์„ค๋ช…์„œ์— ๋”ฐ๋ผ git_libgit2_init ()๋กœ ์ดˆ๊ธฐํ™”ํ•ด์•ผํ•ฉ๋‹ˆ๋‹ค.

๋นŒ๋“œ ์„œ๋ฒ„์—์žˆ๋Š” ๋ชจ๋“  ๋ฆฌ๋ˆ…์Šค์— LibGit๋ฅผ ์ดˆ๊ธฐํ™”ํ•˜์ง€ ์•Š์„ ๊ฒฝ์šฐ ์šฐ๋ฆฌ๋Š” ์–ด๋–ค ๋ฉ”๋ชจ๋ฆฌ ๋ˆ„์ˆ˜๋ฅผ ์–ป์„. ์ดˆ๊ธฐํ™”ํ•˜๋ฉด๋ฉ๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ FreeBSD ๋นŒ๋“œ๋ฅผ ์ดˆ๊ธฐํ™”ํ•˜์ง€ ์•Š์œผ๋ฉด segfault๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค. ์ด๊ฒƒ์ด ์ด์ƒํ•œ ifdef๊ฐ€ ์กด์žฌํ•˜๋Š” ์ด์œ ์ž…๋‹ˆ๋‹ค. ๋˜ํ•œ ์ด๊ฒƒ์— ๋Œ€ํ•œ ์ฒซ ๋ฒˆ์งธ Stackoverflow ๊ฒŒ์‹œ๋ฌผ ์„ ์ž‘์„ฑํ–ˆ์Šต๋‹ˆ๋‹ค.

# 3221์ด์ด ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ๋ฅผ ๋ฐ”๋ž๋‹ˆ๋‹ค.

Gdb ์ถœ๋ ฅ๋„๋ณ„๋กœ ๋„์›€์ด๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์™œ ๊ทธ๋Ÿฐ์ง€ ๋ชจ๋ฅด๊ฒ ์Šต๋‹ˆ๋‹ค. ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์˜ ๋””๋ฒ„๊ทธ ๊ธฐํ˜ธ๊ฐ€ ์žˆ๊ณ  elektra์˜ ๋””๋ฒ„๊ทธ ๋นŒ๋“œ์ž…๋‹ˆ๋‹ค.

GNU gdb (GDB) Fedora 8.3.50.20190824-24.fc31
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./bin/test_cmerge...
(gdb) r
Starting program: /home/mpranj/workspace/libelektra/build/bin/test_cmerge 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
CMERGE       TESTS
==================

Executing testValuesWithGivenLength with size 59

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) q

#ifndef CMERGE_ON_LINUX ๊ฐ€ ๋‚ด ์‹œ์Šคํ…œ์˜ ๊ทผ๋ณธ ์›์ธ์ž„์„ ํ™•์ธํ–ˆ์ง€๋งŒ ์ด์— ๋Œ€ํ•œ ํœด๋Œ€์šฉ ํŒจ์น˜๋ฅผ ๋งŒ๋“ค ์‹œ๊ฐ„์ด ์—†์—ˆ์Šต๋‹ˆ๋‹ค.

@ Chemin1 ์ž‘์—…์— ๊ฐ์‚ฌ๋“œ๋ฆฝ๋‹ˆ๋‹ค!

@ Chemin1 ๋„ˆ๋ฌด ๋นจ๋ฆฌ

ํ…Œ์ŠคํŠธ ํ•ด์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค, @mpranj !

์ด ํŽ˜์ด์ง€๊ฐ€ ๋„์›€์ด ๋˜์—ˆ๋‚˜์š”?
0 / 5 - 0 ๋“ฑ๊ธ‰

๊ด€๋ จ ๋ฌธ์ œ

markus2330 picture markus2330  ยท  3์ฝ”๋ฉ˜ํŠธ

sanssecours picture sanssecours  ยท  4์ฝ”๋ฉ˜ํŠธ

mpranj picture mpranj  ยท  3์ฝ”๋ฉ˜ํŠธ

mpranj picture mpranj  ยท  4์ฝ”๋ฉ˜ํŠธ

sanssecours picture sanssecours  ยท  3์ฝ”๋ฉ˜ํŠธ