Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3817746pxb; Mon, 1 Feb 2021 05:39:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJwgx4qrg0fnWkFujDbXU8VCtQJl4wUxkqofLRtDBCLhosXZ2Okonxj875uKUWOTMTqlgo9h X-Received: by 2002:a17:906:c453:: with SMTP id ck19mr17995684ejb.440.1612186751045; Mon, 01 Feb 2021 05:39:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612186751; cv=none; d=google.com; s=arc-20160816; b=mUlYy7EP7jVkTRVCXqLlUzv5NmF9/UROSHDG7Bkh5l/lt30BL3EuI6gdVJWANhSSXk eqsLidxgTzVIZ67q/RleRnoSOWxikz5tNBCDfH8k/NziZDfdxEjOl+8TM71q7ECZE0Nr z4qtmRx+me8NaDNZYj4vazxY2P4xKmWmRHu1dGv9ays0ldO1u8s9k7NeDdsCnE0nbu4z yIk1rzxl3yuDjr+GtVzcTBDvHAjhItVTfAANISSITVLO0B2Sva/SbgaeV8A9vSm+z4zl Vv8fRpEIbVrn+tPbRdGuMBB/a0YEtKDzohkEUVlT+MnK6zXyrJKqtRjRqaBqFZfXcI22 1uJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=eu7VX8JvvszySJwHZVTokupuwHECVWP055L+vUMCliY=; b=AR+ODqs/cYHnzK3cLD5hCXhdeijWcFPWuWXokVQipMBOm2kq+TaLRZ+2/71s1P+h+7 efrVW+syg/F1O/DCHlCJnsct9+KLjbVPDoJ5COTyDFvZEklz4YSzWb488xzN5wgbHj/K ZmlDS6SUxkEFa0RoIpsDfAy4WRiDfSgykRwOasb+P4SbhlcbxbyA6vYql6tUJUzUvYT4 JBarOmd92A4hJ9fBcHHwBMScPq2DC0lZh2UkLZR0pY5qCZO0HtmxwMmukS8qXlS81bIm ppfmlpXjOUxxrFR0Cg/CxRRTm34zBdhxgT79sgIbw4PlI0zqPMDytI5QCgXRgKhBaEHp UOug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b="kqNV/MnP"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m6si13460273ejl.643.2021.02.01.05.38.23; Mon, 01 Feb 2021 05:39:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b="kqNV/MnP"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231838AbhBANe5 (ORCPT + 99 others); Mon, 1 Feb 2021 08:34:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231575AbhBANev (ORCPT ); Mon, 1 Feb 2021 08:34:51 -0500 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FAB9C06174A; Mon, 1 Feb 2021 05:34:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=eu7VX8JvvszySJwHZVTokupuwHECVWP055L+vUMCliY=; b=kqNV/MnPMGMuePTDqne9Tb7qUx 22kFtr3q5TR4oQmDl0ZZCik4Fj0OTwXfR7Qspzv8IOCAruTq8HYub/ibswiukXiTXYCBeDS6Bfqf0 LfUvM3DtejdPryUgo+MSS1kt57QBIuXVFjyWM5D/zGTSzGRwfUgnbqsIpOAbTV0YRzqyow2tG1gQr C+AUDpwFDFDkT4WXcAruB3h76YZmIjS1uu2pLracRfrR55pvzTo4gFOpJLbxTMljKXkjW5iB6RgOJ naL8Mtm2Eg7pEMFnuqeZfbc3tCSJPcG6V4Npt3FNWXsSPYYYZyBUxauMeP9F+Uj4teK28TaYq8Nit SvfuAAig==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1l6ZKv-00017P-Mk; Mon, 01 Feb 2021 13:33:49 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 15B943011FE; Mon, 1 Feb 2021 14:33:46 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id BA97E2B802295; Mon, 1 Feb 2021 14:33:46 +0100 (CET) Date: Mon, 1 Feb 2021 14:33:46 +0100 From: Peter Zijlstra To: Dmitry Vyukov Cc: Steven Rostedt , Ingo Molnar , Alexei Starovoitov , Daniel Borkmann , andrii@kernel.org, Martin KaFai Lau , David Miller , kpsingh@kernel.org, John Fastabend , netdev , bpf , LKML Subject: Re: extended bpf_send_signal_thread with argument Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 01, 2021 at 10:42:47AM +0100, Dmitry Vyukov wrote: > On Mon, Feb 1, 2021 at 10:22 AM Peter Zijlstra wrote: > > > > On Sun, Jan 31, 2021 at 12:14:02PM +0100, Dmitry Vyukov wrote: > > > Hi, > > > > > > I would like to send a signal from a bpf program invoked from a > > > perf_event. There is: > > > > You can't. Sending signals requires sighand lock, and you're not allowed > > to take locks from perf_event context. > > > Then we just found a vulnerability because there is > bpf_send_signal_thread which can be attached to perf and it passes the > verifier :) > https://elixir.bootlin.com/linux/v5.11-rc5/source/kernel/trace/bpf_trace.c#L1145 > > It can defer sending the signal to the exit of irq context: > https://elixir.bootlin.com/linux/v5.11-rc5/source/kernel/trace/bpf_trace.c#L1108 > Perhaps this is what makes it work? Yes.