Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[19' 김민정] 최종보고서 #96

Open
rls1004 opened this issue Oct 18, 2019 · 0 comments
Open

[19' 김민정] 최종보고서 #96

rls1004 opened this issue Oct 18, 2019 · 0 comments

Comments

@rls1004
Copy link

rls1004 commented Oct 18, 2019

Issue & Pull Request

1. --logfile 옵션 사용시 발생하는 segfault 문제 해결

Pull Request namhyung#861
Problem: 파일 열기에 실패할 경우 fd가 NULL이 되어 segfault 발생
Solution: 파일 열기에 실패할 경우 fd를 stderr로 변경하고 예외 상황에 대한 처리
-> 다른 프로젝트에 대한 인생 첫 커밋.. 👍

2. 함수 인자에 대한 로깅 시 발생하는 segfault 문제 해결

Issue namhyung#858
Pull Request namhyung#865
Problem: memory bound 를 벗어난 위치의 인자 요청 시 잘못된 주소를 읽어 segfault 발생
Solution: 메모리 주소에 대한 유효성 검사 추가 / test case 추가
-> 커밋 수정을 통해 reflog, reset, stash, squash, rebase, force push 등 git 의 다양한 기능들을 사용하고 익히게 됨
-> 이후의 커밋들에 많은 도움이 됨.. 👍

3. std::string 포맷으로 인자를 표현 시 발생하는 segfault 문제 해결

Issue namhyung#905
Pull Request namhyung#906
Problem: std::string 타입이 아닌 함수 인자를 std::string 포맷으로 표현하려고 하면 잘못된 주소를 읽어 segfault 발생
Solution: 메모리 주소에 대한 유효성 검사 추가

4. opts 객체에서 발생하는 메모리 누수 문제 해결

Issue namhyung#963
Pull Request namhyung#964
Problem: --signal 옵션 사용 시 opts->sig_trigger 에 메모리가 할당되지만 해제되지 않는 문제 발생
Solution: opts 에 대한 메모리 해제 시 opts->sig_trigger 에 대한 메모리 해제 코드 추가

5. 함수 인자에 대한 데이터 저장 시 발생하는 heap buffer overflow

Pull Request namhyung#937
Problem: 메모리 할당 시 사용된 크기와 메모리를 읽을 때 사용된 크기가 달라져서 문제 발생
Solution: 메모리를 할당하기 전에 적절한 크기로 수정

6. cmdline 을 읽을 때 발생하는 stack buffer overflow

Issue namhyung#939
Pull Request namhyung#946
Problem: fread 함수는 문자열 끝에 NULL 바이트를 삽입하지 않기 때문에 변수의 크기를 넘어간 데이터까지 문자열로 인식하여 읽어올 수 있는 문제 발생
Solution: fread 함수로 읽어온 데이터의 끝에 NULL 바이트 삽입
-> cmdline 이 4096 바이트보다 길어지는 경우에 대해 모든 바이트를 저장할 수 있도록 수정하려 했지만 개발적인 관점에서 이것은 unusual 한 케이스이기 때문에 코드 수정을 최소화하는 방향으로 수정하는 것이 낫다는 것을 알게 됨

7. "list-event" 옵션에 대한 디스크립션 중 오타 수정

Pull Request namhyung#954

8. tui.c 코드 중 주석의 오타 수정

Pull Request namhyung#955

9. record.c 코드 중 주석의 오타 수정

Pull Request namhyung#956

10. dump.c 코드 중 주석의 오타 수정 (open)

Pull Request namhyung#970

11. 문자열 형태의 함수 인자 처리 시 발생하는 heap buffer overflow (open)

Issue namhyung#993
Pull Request namhyung#994
Problem: 4 바이트 보다 작은 문자열이 4 바이트 문자열과 비교될 수 있는 문제 발생
Solution: 문자열 길이가 4 바이트 일 때만 문자열 비교를 수행하도록 수정

12. 여러줄의 커맨드 라인에 대한 저장/읽기 시 발생하는 error (open)

Issue namhyung#996
Pull Request namhyung#998
Problem: 여러줄의 커맨드 라인에 대해 fgets() 로 읽기 때문에 다음 라인을 읽지 못하여 다음 처리 루틴에서 에러 발생
Solution: 여러줄의 커맨드 라인 저장 시 '\n' 을 공백으로 대체하여 저장

13. opts 객체의 run_cmd 메모리를 해제하지 않아 발생하는 메모리 누수 문제 (open)

Issue namhyung#1005
Pull Request namhyung#1007
Problem: --run-cmd 옵션 사용시 opts->run_cmd 에 메모리가 할당되지만 해제되지 않아 문제 발생
Solution: opts 에 대한 메모리 해제 시 opts->run_cmd 에 대한 메모리 해제 코드 추가

Discussion

python function tracing

namhyung#934
-> multiprocessing 모듈을 사용한 runtest.py 에 대해 tracing 할 때 발생하는 무한 루프 문제 분석
---> 프로세스들이 공유하는 shared 객체에 데이터가 제대로 저장되지 않는 문제 발견
---> 이를 재현할 수 있는 POC 코드 작성
---> cpython 의 문제인 것으로 확인, bug reporting 진행중
-----> https://bugs.python.org/issue38511

Wiki

uftrace for RustPython

https://github.com/namhyung/uftrace/wiki/uftrace-for-RustPython
uftrace 를 이용하여 RustPython 을 tracing 하는 방법에 대해 정리
-> 해당 Wiki 를 레퍼런스로 RustPython Wiki 에 uftrace 에 대한 Wiki 가 생성됨
---> https://github.com/RustPython/RustPython/wiki/uftrace

etc.

uftrace 를 이용하여 RustPython 에서 발생하는 문제에 대한 원인 코드 파악 및 해결 (6 Issue, 2 Pull Request)
https://github.com/RustPython/RustPython/issues/created_by/rls1004
RustPython/RustPython#1496
RustPython/RustPython#1393

향후 계획

cpython 에 bug reporting 진행중

https://bugs.python.org/issue38511
python function tracing 중 sys.settrace 로 인한 문제 해결을 위해 진행중

(10/26) sprint seoul 참가 신청

https://www.sprintseoul.org/
cpython 에서 문제가 해결되지 않는다면 RustPython 에 hook 기능을 구현하여 cpython 을 대체할 수 있지 않을까 해서 RustPython 모임 신청

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

No branches or pull requests

1 participant