리눅스 커널 for_each_process 와 ps 질문

declspec의 이미지

안녕하세요

아래와같이 task_struct 의 연결리스트중에 특정 태스크에 대해서
포인터를 조작해서 숨기는, process 를 감추는 작업을 리눅스에서 테스트했습니다.
그런데 분명 제대로 했고, 아래의 작업을 거친후에 for_each_process 를 돌리면
더이상 숨겨진 task 는 나타나지 않습니다.
하지만 ps x 를 해보면 해당 프로세스가 여전히 계속 나타나네요
왜그런걸까요?

ps 가 내부적으로 커널의 task_struct 의 리스트를 순회하는거로 알았었는데
이게 아닌가요??

			if(p->tasks.prev != p->tasks.next){
				printk("original p->tasks.prev->next : %p\n", p->tasks.prev->next );
				p->tasks.prev->next = p->tasks.next;
				printk("manipulated p->tasks.prev->next : %p\n", p->tasks.prev->next );
 
				printk("original p->tasks.next->prev : %p\n", p->tasks.next->prev);
				p->tasks.next->prev = p->tasks.prev;
				printk("manipulated p->tasks.next->prev : %p\n", p->tasks.next->prev);
			}
 
			printk("process victim is hided\n");
Stand Alone Complex의 이미지

RTFM!
터미널에서 man ps 그리고 엔터 치는게 그렇게 어렵나요?

RET ;My life :P

익명 사용자의 이미지

시간이 남아 도냐 이딴 싸가지 없는 답글은 왜 다는거야 대체

ㅈㅅㅇㄴ ㅅㄲ

jick의 이미지

man ps|grep -C2 task_struct

The SIZE and RSS fields don't count some parts of a process including the page tables,
kernel stack, struct thread_info, and struct task_struct. This is usually at least 20 KiB
of memory that is always resident. SIZE is the virtual size of the process
(code+data+stack).

뭐 어쩌라구요.

ymir의 이미지

ps 는 /proc filesystem 을 읽어들입니다. (ps man page 의 NOTES 참조)

되면 한다! / feel no sorrow, feel no pain, feel no hurt, there's nothing gained.. only love will then remain.. 『 Mizz 』