|
Message-ID: <CA+55aFxHyKwu4RnP2AU5YDtzmNGvQZvywYZg1iJWQsJt4VvJqA@mail.gmail.com> Date: Wed, 9 Mar 2016 13:26:44 -0800 From: Linus Torvalds <torvalds@...ux-foundation.org> To: Andy Lutomirski <luto@...capital.net> Cc: Ingo Molnar <mingo@...nel.org>, Andy Lutomirski <luto@...nel.org>, "the arch/x86 maintainers" <x86@...nel.org>, Linux Kernel Mailing List <linux-kernel@...r.kernel.org>, Borislav Petkov <bp@...en8.de>, "musl@...ts.openwall.com" <musl@...ts.openwall.com>, Andrew Morton <akpm@...ux-foundation.org>, Thomas Gleixner <tglx@...utronix.de>, Peter Zijlstra <a.p.zijlstra@...llo.nl> Subject: Re: Re: [RFC PATCH] x86/vdso/32: Add AT_SYSINFO cancellation helpers On Wed, Mar 9, 2016 at 12:57 PM, Andy Lutomirski <luto@...capital.net> wrote: > > How safe would this be in a multithreaded process? For example, if > open() gets canceled in the "killable" sense, is it guaranteed that no > file descriptor will be allocated? Not all system calls can be killed, we only do the usual cases. A system call has to have the proper EINTR logic in place, so it's not like we kill system calls at any random point. > Let me try to summarize my understanding of the semantics. > > Thread A sends thread B a signal. Thread B wants to ignore the signal > and defer handling unless it's either in a particular syscall and > returns -EINTR or unless the thread is about to do the syscall. Note that for the kernel, we don't actually have to use a signal for this at all. Our existing "cancel system calls" code only works for fatal signals, but that's just a trivial implementation issue. We could add a system call that just sets a cancel flag in another thread, and we'd just use that cancel flag to say "abort the currently executing system call with EINTR" - in all the same places we currently dot hat "fatal_signal_pending()" thing. You'd still have to have all the user-space logic to do the cancellation cleanup etc. But now you could actually cancel a write() system call in the *middle*, which is currently just not an option. Linus
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.