From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mathieu Desnoyers Subject: Re: [RFC PATCH for 4.15 09/14] Provide cpu_opv system call Date: Sat, 14 Oct 2017 14:22:10 +0000 (UTC) Message-ID: <112864193.41278.1507990930227.JavaMail.zimbra@efficios.com> References: <20171012230326.19984-1-mathieu.desnoyers@efficios.com> <20171012230326.19984-10-mathieu.desnoyers@efficios.com> <20171013145710.4430583f@alans-desktop> <854849583.40647.1507906233368.JavaMail.zimbra@efficios.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <854849583.40647.1507906233368.JavaMail.zimbra-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org> Sender: linux-api-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: One Thousand Gnomes Cc: "Paul E. McKenney" , Boqun Feng , Peter Zijlstra , Paul Turner , Andrew Hunter , Andy Lutomirski , Dave Watson , Josh Triplett , Will Deacon , linux-kernel , Thomas Gleixner , Andi Kleen , Chris Lameter , Ingo Molnar , "H. Peter Anvin" , Ben Maurer , rostedt , Linus Torvalds , Andrew Morton , Russell King , Catalin Marinas List-Id: linux-api@vger.kernel.org ----- On Oct 13, 2017, at 10:50 AM, Mathieu Desnoyers mathieu.desnoyers-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org wrote: > ----- On Oct 13, 2017, at 9:57 AM, One Thousand Gnomes > gnomes-qBU/x9rampVanCEyBjwyrvXRex20P6io@public.gmane.org wrote: > >>> A maximum limit of 16 operations per cpu_opv syscall invocation is >>> enforced, so user-space cannot generate a too long preempt-off critical >>> section. >> >> Except that all the operations could be going to mmapped I/O space and if >> I pick the right targets could take quite a long time to complete. > > We could check whether a struct page belongs to mmapped I/O space, and return > EINVAL in that case. > >> It's >> still only 16 operations - But 160ms is a lot worse than 10ms. In fact >> with compare_iter I could make it much much worse still as I get 2 x >> TMP_BUFLEN x 16 x worst case latency in my attack. That's enough to screw >> up plenty of things. > > Would a check that ensures the page is not mmapped I/O space be sufficient > to take care of this ? If happen to know which API I need to look for, it > would be welcome. I think is_zone_device_page() is what I was looking for. Let me know if I missed something, Thanks, Mathieu > Thanks, > > Mathieu > > >> >> Alan > > -- > Mathieu Desnoyers > EfficiOS Inc. > http://www.efficios.com -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com