iamrootbug / iamroot

Iamroot study
0 stars 0 forks source link

2020.08.29.Meeting Sync #4

Open iamrootbug opened 3 years ago

iamrootbug commented 3 years ago

.config vs menuconfig

text vs gui

wraparound

config TMPFS_INODE64
    bool "Use 64-bit ino_t by default in tmpfs"
    depends on TMPFS && 64BIT
    default n
    help
      tmpfs has historically used only inode numbers as wide as an unsigned
      int. In some cases this can cause wraparound, potentially resulting
      in multiple files with the same inode number on a single device. This
      option makes tmpfs use the full width of ino_t by default, without
      needing to specify the inode64 option when mounting.

https://www.google.com/search?q=wraparound+integer+overflow&oq=wraparound+integer+overflow&aqs=chrome..69i57j0l3.5622j0j7&client=ubuntu&sourceid=chrome&ie=UTF-8

cgroup

프로세스들이 사용할 수 있는 컴퓨팅 자원들을 제한하고 격리 memory, cpu, network, device, I/O

https://access.redhat.com/documentation/ko-kr/red_hat_enterprise_linux/6/html/resource_management_guide/ch01 https://hwwwi.tistory.com/12

엑사바이트

10006 = 1018 https://ko.wikipedia.org/wiki/%EC%97%91%EC%82%AC%EB%B0%94%EC%9D%B4%ED%8A%B8

make vs make modules

module -> .ko (-> ismod로 띄우기?)

user virtual map, heap manager

mmap threshold = 128KB. glibc - malloc() mmap() http://jake.dothome.co.kr/user-virtual-maps-brk/

mmap 옵션

https://linux.die.net/man/2/mmap

디버깅 팁

fork() -> 자식 프로세스도 디버깅 (gdb) set detach-on-fork off

fork()

성공할경우 자식 프로세스의 PID가 부모에게 리턴되며, 자식에게는 0이 리턴된다. 실패할경우에는 -1 이 리턴되며, 절적한 errno 값이 설정된다.

https://www.joinc.co.kr/w/man/2/fork

clone()

int clone(int (*fn)(void *), void *child_stack,
          int flags, void *arg, ...
          /* pid_t *ptid, struct user_desc *tls, pid_t *ctid */ );

두번째 인자가 새로운 task가 사용할 스택 주소이다.

https://linux.die.net/man/2/clone

warning: implicit declaration of function ‘clone’;

해결방법

#define _GNU_SOURCE  

https://stackoverflow.com/questions/23579354/clone-function-implicit-declaration

fork vs vfork

vfork -> clone과 비슷하고 자원 복사가 이뤄지지 않는다. 공유. http://jake.dothome.co.kr/do_fork/

fork and pipe 기법

부모 프로세스와 자식 프로세스가 fd를 공유하고 이를 pipe()로 활용한다.

https://www.geeksforgeeks.org/c-program-demonstrate-fork-and-pipe/

what is Mach?

Unix 계열의 freebsd와 MacOS의 전신.

https://en.wikipedia.org/wiki/Mach_(kernel)

do_fork() flow

long _do_fork(struct kernel_clone_args *args)
->
static __latent_entropy struct task_struct *copy_process(
->
p = dup_task_struct(current, node);

NPTL

https://www.cs.utexas.edu/~witchel/372/lectures/POSIX_Linux_Threading.pdf

참고사이트

[예제 다운로드] http://www.atio.co.kr/bbs/download.php?bo_table=sub0301&wr_id=21&no=0

A. 6시20분 ~ 7시20분 : 휴식.식사

B. 7시20분 ~ < 10시 : 60~70 페이지

iamrootbug commented 3 years ago

[gdb helper 사용법] https://sjp38.github.io/ko/post/qemu_kernel_debugging/

iamrootbug commented 3 years ago
sudo apt install cscope ctags
make O=. cscope tags