{"action":"created","issue":{"url":"https://api.github.com/repos/SerenityOS/serenity/issues/309","repository_url":"https://api.github.com/repos/SerenityOS/serenity","labels_url":"https://api.github.com/repos/SerenityOS/serenity/issues/309/labels{/name}","comments_url":"https://api.github.com/repos/SerenityOS/serenity/issues/309/comments","events_url":"https://api.github.com/repos/SerenityOS/serenity/issues/309/events","html_url":"https://github.com/SerenityOS/serenity/issues/309","id":468445287,"node_id":"MDU6SXNzdWU0Njg0NDUyODc=","number":309,"title":"Interrupted syscalls don't work properly with signal handlers.","user":{"login":"DrewStratford","id":7435343,"node_id":"MDQ6VXNlcjc0MzUzNDM=","avatar_url":"https://avatars0.githubusercontent.com/u/7435343?v=4","gravatar_id":"","url":"https://api.github.com/users/DrewStratford","html_url":"https://github.com/DrewStratford","followers_url":"https://api.github.com/users/DrewStratford/followers","following_url":"https://api.github.com/users/DrewStratford/following{/other_user}","gists_url":"https://api.github.com/users/DrewStratford/gists{/gist_id}","starred_url":"https://api.github.com/users/DrewStratford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DrewStratford/subscriptions","organizations_url":"https://api.github.com/users/DrewStratford/orgs","repos_url":"https://api.github.com/users/DrewStratford/repos","events_url":"https://api.github.com/users/DrewStratford/events{/privacy}","received_events_url":"https://api.github.com/users/DrewStratford/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2019-07-16T04:45:58Z","updated_at":"2019-07-20T18:37:53Z","closed_at":null,"author_association":"NONE","body":"Most blocking syscalls don't properly handle interruptions when a signal handler also calls a blocking syscall.\r\n\r\nConsider the following program, which should output something like:\r\n```\r\nin sighandler\r\n999\r\n```\r\nbut instead causes a kernel panic after failing the assertion `ASSERTION FAILED: current->m_was_interrupted_while_blocked`.\r\n\r\n```cpp\r\n#include <unistd.h>\r\n#include <signal.h>\r\n#include <stdio.h>\r\n#include <sys/wait.h>\r\n\r\nint main(void){\r\n\tsignal(SIGCHLD, [](int){\r\n\t\tint i = 0;\r\n\t\twait(&i);\r\n\t\tputs(\"in sighandler\");\r\n\t});\r\n\r\n\tif(fork() == 0){\r\n\t\treturn 0;\r\n\t}\r\n\r\n\tint r = sleep(1000);\r\n\tprintf(\"%d\\n\", r);\r\n\treturn 0;\r\n}\r\n```\r\n\r\nOther examples don't always end in a kernel panic, I just feel that this is the most illustrative example."},"comment":{"url":"https://api.github.com/repos/SerenityOS/serenity/issues/comments/513489909","html_url":"https://github.com/SerenityOS/serenity/issues/309#issuecomment-513489909","issue_url":"https://api.github.com/repos/SerenityOS/serenity/issues/309","id":513489909,"node_id":"MDEyOklzc3VlQ29tbWVudDUxMzQ4OTkwOQ==","user":{"login":"rburchell","id":125863,"node_id":"MDQ6VXNlcjEyNTg2Mw==","avatar_url":"https://avatars1.githubusercontent.com/u/125863?v=4","gravatar_id":"","url":"https://api.github.com/users/rburchell","html_url":"https://github.com/rburchell","followers_url":"https://api.github.com/users/rburchell/followers","following_url":"https://api.github.com/users/rburchell/following{/other_user}","gists_url":"https://api.github.com/users/rburchell/gists{/gist_id}","starred_url":"https://api.github.com/users/rburchell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rburchell/subscriptions","organizations_url":"https://api.github.com/users/rburchell/orgs","repos_url":"https://api.github.com/users/rburchell/repos","events_url":"https://api.github.com/users/rburchell/events{/privacy}","received_events_url":"https://api.github.com/users/rburchell/received_events","type":"User","site_admin":false},"created_at":"2019-07-20T18:37:53Z","updated_at":"2019-07-20T18:37:53Z","author_association":"MEMBER","body":"Still crashes after the recent blocker changes. block() complains that the thread is already blocked (on sleep) now. Hmm... That's interesting :)"}}
{"actor":{"display_login":"rburchell"}}