From 91bb0dc2f471f7fb90d7d5bc08c87805dceac326 Mon Sep 17 00:00:00 2001 From: eunhhu Date: Sun, 4 Oct 2026 11:11:00 +0100 Subject: Say that reading the code found stage 3's two races, and how a host changes apps The use after free in local_done and the owner's lock made after another app's outlet used it were found reading the code, not by the check, which passed with both before it was made to change senders (115, 017). The usage now says changed lines change in place unless their store moved; and 115 names the path no check takes: a module refused while changing in place. --- docs/design/017-apps-on-one-host.md | 4 ++-- docs/research/115-apps-that-change.md | 7 +++++-- serve/serve.c | 3 ++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/docs/design/017-apps-on-one-host.md b/docs/design/017-apps-on-one-host.md index 3f2ce2b..8498477 100644 --- a/docs/design/017-apps-on-one-host.md +++ b/docs/design/017-apps-on-one-host.md @@ -299,8 +299,8 @@ HTTP로 앱을 더하는 길을 두지 않는 까닭은 인증이다. 그 길은 때마다 19 KB가 남는다. 파일을 읽는 스레드가 하나 늘었다(앱 100개에 스레드 넷). 커밋: Pure `14c75d0`(해석한 모듈과 앱의 자리), `1d892e2`(링크 스트림의 입력을 다시 찾기), `12878cf`(SIGHUP과 멈추고 다시 열기), `7daf406`(그 자리에서 바꾸기), `f5e9db5`와 그 뒤(측정). -- **검사가 찾은 것.** 보내는 앱이 멈추는 동안 받는 앱의 차례가 놓인 출구를 읽던 자리, 시작하기 전의 앱의 락을 다른 앱의 출구가 - 쓰던 것. 둘 다 바꾸기 한가운데의 보내는 앱과 받는 앱을 함께 바꿔 보는 검사로 드러났다. +- **코드를 읽어 찾은 것.** 보내는 앱이 멈추는 동안 받는 앱의 차례가 놓인 출구를 읽던 자리, 시작하기 전의 앱의 락을 다른 앱의 + 출구가 쓰던 것. 그때의 검사는 둘이 있는 채로 지났다(보내는 앱을 바꾸지 않았다). 고친 뒤 검사가 그 길을 지나게 넓혔다. ## 3단계의 착수 기준 diff --git a/docs/research/115-apps-that-change.md b/docs/research/115-apps-that-change.md index a76f9dd..5a5ec1d 100644 --- a/docs/research/115-apps-that-change.md +++ b/docs/research/115-apps-that-change.md @@ -98,8 +98,11 @@ B는 5xx를 하나도 받지 않았다. 바꾸는 일은 파일을 읽는 스레 다시 시작하고, 저장소를 만들 수 없던 앱은 고친 뒤의 SIGHUP에 시작하고, 틀린 줄이 있는 파일은 아무것도 바꾸지 않고, `kill -9` 뒤에는 파일 그대로 시작한다. 혼자 10번, CPU 부하 아래 5번, ASan으로 빌드한 `pure-serve`로 6번 지났다. -이 검사가 처음 구현에서 찾은 것: 보내는 앱이 멈추는 동안 받는 앱의 차례가 그 출구를 놓은 뒤에 읽는 자리(`local_done`), 앱이 -시작하기 전에 다른 앱의 출구가 그 소유자의 락을 쓰는 것(락을 자리와 함께 만든다). +처음 구현의 동시성 결함 둘은 이 검사가 아니라 코드를 읽어 찾았다. 보내는 앱이 멈추는 동안 받는 앱의 차례가 놓인 출구를 읽던 +자리(`local_done`)와, 앱이 시작하기 전에 다른 앱의 출구가 그 소유자의 락을 쓰던 것(락을 자리와 함께 만든다)이다. 그때의 검사는 +보내는 앱을 바꾸지 않아 둘이 있는 채로 세 번 지났다. 고친 뒤 검사를 넓혀(보내는 앱을 바꾸기, 바꾸는 동안 보기를 읽기) 그 길을 +지나게 했고, 위의 10번, 5번, 6번은 고친 코드에서 지난 것이다. 그 자리에서 바꾸는데 새 모듈을 거절하거나 읽지 못하는 길(앱이 +까닭을 남기고 멈춘다)은 검사하지 않았다. ## 판정 diff --git a/serve/serve.c b/serve/serve.c index fc1a063..6f7220a 100644 --- a/serve/serve.c +++ b/serve/serve.c @@ -4289,7 +4289,8 @@ usage: " NAME MODULE.pmod STORE [memory=BYTES] [work=N] [queue=N] [send=OUTPUT=URL ...] [seal=OUTPUT=KEY ...]\n" " [reply=OUTPUT=INPUT ...]; its routes start /NAME/, its sends' sources are NAME.OUTPUT, and a\n" " --link-port takes its inputs as NAME/INPUT. On SIGHUP the host reads FILE again: the apps of lines\n" - " gone stop, those of new or changed lines start (again), from their stores; a line out says what it did\n" + " gone stop, those of new lines start, those of changed lines change in place (their states kept in\n" + " memory) unless their store moved; a line out says what it did\n" " --app-slots N: the apps a host of apps holds at most, those started later included\n" " --workers N: the threads the apps' owners take turns on (1 for one app; for apps, one a CPU at most)\n" " --send OUTPUT=pure://host:port/INPUT: to a Pure node's --link-port, the way between nodes (UDP, no\n" -- cgit v1.2.3