From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934589AbcIPPbx (ORCPT ); Fri, 16 Sep 2016 11:31:53 -0400 Received: from merlin.infradead.org ([205.233.59.134]:55302 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751520AbcIPPbo (ORCPT ); Fri, 16 Sep 2016 11:31:44 -0400 Date: Fri, 16 Sep 2016 17:31:31 +0200 From: Peter Zijlstra To: Andy Lutomirski Cc: Josh Poimboeuf , Andy Lutomirski , X86 ML , Borislav Petkov , "linux-kernel@vger.kernel.org" , Brian Gerst , Jann Horn , Ingo Molnar , live-patching@vger.kernel.org Subject: Re: [PATCH 08/12] x86/dumpstack: Pin the target stack in save_stack_trace_tsk() Message-ID: <20160916153131.GG5016@twins.programming.kicks-ass.net> References: <7cd5e328dc75d8ccd912e5783665de34503f7c63.1473801993.git.luto@kernel.org> <20160914145556.5whqcpzys7c23nib@treble> <20160914183501.cknjhsbkzxg6m6pl@treble> <20160915183741.wka5dzdsvbn53drp@treble> <20160915191938.mm2k7ccv6d2o622t@treble> <20160916074730.GJ5012@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 16, 2016 at 08:12:40AM -0700, Andy Lutomirski wrote: > On Fri, Sep 16, 2016 at 12:47 AM, Peter Zijlstra wrote: > > On Thu, Sep 15, 2016 at 02:19:38PM -0500, Josh Poimboeuf wrote: > >> My idea was to use task_rq_lock() to lock the runqueue and then check > >> tsk->on_cpu. I think Peter wasn't too keen on it. > > > > That basically allows a DoS on the scheduler, since a user can run tasks > > on every cpu (through sys_sched_setaffinity()). Then doing while (1) cat > > /proc/$PID/stack would saturate the rq->lock on every CPU. > > > > The more tasks the merrier. > > Is this worse than it would be if this code used preempt_disable() > (which I think it did until very recently)? Much worse, since the proposed task_rq_lock() not only disables preemption, it also disables IRQs and takes 2 locks. And hogging the rq->lock affects other tasks their ability to schedule.