Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4813628yba; Tue, 30 Apr 2019 04:57:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqwLpyzggvec8NLreKP4VmhEPuqeNwoVZuFY+vkV6BZB2jcQzRMf9kfWMr4EyZVvNqhe7wOP X-Received: by 2002:a62:5a42:: with SMTP id o63mr72855196pfb.170.1556625457087; Tue, 30 Apr 2019 04:57:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556625457; cv=none; d=google.com; s=arc-20160816; b=EYkFa4FoVl3IcSPo1EodijYhAq2yhhFW6F6EMt6NHlOsZeL1XwBFhkGCYmG+LuqJhX KPBz9iBcl0K3GBPBGOS+Eymi9TiYBTKl6pZJy0TUXSjpOFDmMzxfmtoiPUi4+Rm1NgP5 3GKhXCcwRdD9HPmAKBDtuOZ5dv35eNyF1mfaeOoeYVWkHdg+QEhKoUnk2xet/8xg88OB ZpB0y3aLe+ngEWDDHQSyXCStZvBDPZTiL464itnjQEBJlVBZBTBjNEEM0QZUiiY2o0fD 1C7BZ4W7KsGqpd7cIO6fsCgkKBQoYPw39iUnEqDdAJc+FAsQGh9fclczjpyZNqe3D6tc UV6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tMOfqiTOKk1uxJ0akkkabcN0glLeZVzEF/C5AynyOVQ=; b=sqCRUR/x2fUkgtf2GkoRec4nxWoV5kEZqVrAYx5mRfhIEb2eTauZw49zGzjh2gGP6S L0DH51SeudZwlIeIwnFTa2Ja2Y1qX04ulcArzHMIYCOr5ZCH1SR3UZnRIcQU9GoeDDxA NpV4INnMLBmUzl7HzWRR4tW+ZNeWVoi9T6oh6U12fjJz9qBlL+BWLQtmnELaJoxA/5zn SkiWT6eAmRjQfbwP2RIfez/lPM7EkqZGrx0LcVq0XOVpiXWx+xpW4b5yXBUdR/WIUkNC 0wr/k52vRNl7/aUOvqD64OkF/bXxYoH5CQSg+F+NIXD0OhesFHZQhvW/XFPMuPT6ZG+B bMkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kFL7VuMI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f12si235316pgh.591.2019.04.30.04.57.21; Tue, 30 Apr 2019 04:57:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kFL7VuMI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731125AbfD3LuF (ORCPT + 99 others); Tue, 30 Apr 2019 07:50:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:36820 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731117AbfD3LuC (ORCPT ); Tue, 30 Apr 2019 07:50:02 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3419221707; Tue, 30 Apr 2019 11:50:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556625001; bh=qbLCJNg0D11LxC1eJ3fp26o5Cig2xtZy+vtQ0WHfRbc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kFL7VuMIMVOcY2Df4X8qBixtIJmoZGAL7UgkeT7oYjuoaqS0UjKtV2OVX7WbTJd6R h/4eZONrdSjPgUnhF8QgFEdfGrAul4RRaL4v7Mn/FyXvhIoh0UFGBsHfelA3x3JvE1 diRmbgv3n1uCzdpmC15qlg4+1Y/C7DIwUlKI3710= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Waiman Long , Linus Torvalds , Ingo Molnar , Will Deacon , Thomas Gleixner , the arch/x86 maintainers , Davidlohr Bueso , Tim Chen , huang ying , Roman Gushchin , Alexei Starovoitov , Daniel Borkmann , "Peter Zijlstra (Intel)" , "Steven Rostedt (VMware)" Subject: [PATCH 5.0 19/89] trace: Fix preempt_enable_no_resched() abuse Date: Tue, 30 Apr 2019 13:38:10 +0200 Message-Id: <20190430113610.964519574@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190430113609.741196396@linuxfoundation.org> References: <20190430113609.741196396@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peter Zijlstra commit d6097c9e4454adf1f8f2c9547c2fa6060d55d952 upstream. Unless the very next line is schedule(), or implies it, one must not use preempt_enable_no_resched(). It can cause a preemption to go missing and thereby cause arbitrary delays, breaking the PREEMPT=y invariant. Link: http://lkml.kernel.org/r/20190423200318.GY14281@hirez.programming.kicks-ass.net Cc: Waiman Long Cc: Linus Torvalds Cc: Ingo Molnar Cc: Will Deacon Cc: Thomas Gleixner Cc: the arch/x86 maintainers Cc: Davidlohr Bueso Cc: Tim Chen Cc: huang ying Cc: Roman Gushchin Cc: Alexei Starovoitov Cc: Daniel Borkmann Cc: stable@vger.kernel.org Fixes: 2c2d7329d8af ("tracing/ftrace: use preempt_enable_no_resched_notrace in ring_buffer_time_stamp()") Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Greg Kroah-Hartman --- kernel/trace/ring_buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -776,7 +776,7 @@ u64 ring_buffer_time_stamp(struct ring_b preempt_disable_notrace(); time = rb_time_stamp(buffer); - preempt_enable_no_resched_notrace(); + preempt_enable_notrace(); return time; }