Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp4563959rwi; Mon, 17 Oct 2022 07:53:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7laLuV0WV/ANx3LjxjApCvedZQ/pI9IE4nvw8/evdAKS9SbI4A/6ZJMJjGK1ESvf7GM64S X-Received: by 2002:a17:90a:fa85:b0:20a:ddd3:d431 with SMTP id cu5-20020a17090afa8500b0020addd3d431mr34019439pjb.210.1666018430849; Mon, 17 Oct 2022 07:53:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666018430; cv=none; d=google.com; s=arc-20160816; b=BoQ1E6vmTVNVYLJlgnvR+Jzo61C3jOA1ty88a33C6TYemeeVPKsiqHeZEuFjy99BQn BId/8H9q1gvGIPB8K/csJSzypyS0XpFgmLCRx0yeYvb+JeqtEMe53O9SRmm3sMN/UWZI ABYEOzJmUquI1jiUJpGkz/DuL4d2/CIa5ohlSQQMqJYK0Of/SRYP7OgZtez5oqAIw5ci MEx9AopS/XKCDGdwmZ9ys+rGqQlKLft5Rrli/Iov9DBMuE+iaVD1JKQfUKnnyTyYTAes 4f2fL7sWkwAw32WQAbx4AOqcZY8fcV2mbGlKjTk2RyON7Buqo/cQsf2vLuMESpiKwSLr CzHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=F9QpAqs6GyUJEi3LXVbk4btEPF2HufReWPHZpghC9FY=; b=WEjbWxVl9D+G6jWl2jqmAXSTJXg3Q4wiApqmaUDcktr6cIa3joZvaaZFLIvfypvKid fnvh765rFX4wdAhzeiPhnvAcip0Kl510743rHSh1gGzn9F6efC2gehrHwZLEbot0eOGY v+0EGIzd/1sxPZKaVB2/lR9ncgafl53r+FjXJJZJzXWLI3bvRdCff0SMK2H/c6psw4UQ x1l4s6/WEwAm8JniqNqQMgBamAiYKqh593H3eRtkPb+kvs6VtNhL7/V7F8RvWZyJGL/D /jmKR4tosrBJomksMCgyP4S+0C0aeqFSTJWpJt70nKGTQU101taWjgIIOc3J9MhFea2U kTzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=WCxycd4D; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j30-20020a63231e000000b0043c1481a835si12718230pgj.267.2022.10.17.07.53.37; Mon, 17 Oct 2022 07:53:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=WCxycd4D; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230048AbiJQOpg (ORCPT + 99 others); Mon, 17 Oct 2022 10:45:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230520AbiJQOpc (ORCPT ); Mon, 17 Oct 2022 10:45:32 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F3A42F65E; Mon, 17 Oct 2022 07:45:30 -0700 (PDT) Date: Mon, 17 Oct 2022 14:45:27 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1666017929; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=F9QpAqs6GyUJEi3LXVbk4btEPF2HufReWPHZpghC9FY=; b=WCxycd4DgNHnbQFpQWAhIxkbwZsNCWJ/C29nq17PHPxihtOAREqI28Uij/A13ypQnMjQjz PjC/hcrNFuSl07WqiG7kMjgSLU2q0rxRhfdRSu/uYj7csk+uJaRO5/8KBC+NQ2P3n10gUZ gjKaSlBnxB47JDXnObnKC1eueZzSMaVNJftXV9gtxX2DT/SX/IStKSQK+s2KD8lJvnZLED l4pUW+Pqwmua0M/JvImxuZnqvviaR0pRXBi+OnNnUeoFTivMl4Y3Ea/vssbzqFyrgRygWU ZJ3Nk4gDV2GMc8HxGzOOyoWqMzqeh/vv0Jr28KB3ZcGoZ+RRJ20X4H42bHzi9Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1666017929; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=F9QpAqs6GyUJEi3LXVbk4btEPF2HufReWPHZpghC9FY=; b=YNc+pHLGOPHw6egVEbDMffAEHjmNuIc75GsP74HsaSvqE9eMspoy+1MIlDZp39zSDwObiO 0LFHrC+wlgMC+xBw== From: "tip-bot2 for Sumanth Korikkar" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/urgent] bpf: Fix sample_flags for bpf_perf_event_output Cc: Sumanth Korikkar , "Peter Zijlstra (Intel)" , Namhyung Kim , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20221007081327.1047552-1-sumanthk@linux.ibm.com> References: <20221007081327.1047552-1-sumanthk@linux.ibm.com> MIME-Version: 1.0 Message-ID: <166601792750.401.18306154915385335790.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the perf/urgent branch of tip: Commit-ID: 21da7472a040420f2dc624ffec70291a72c5d6a6 Gitweb: https://git.kernel.org/tip/21da7472a040420f2dc624ffec70291a72c5d6a6 Author: Sumanth Korikkar AuthorDate: Fri, 07 Oct 2022 10:13:27 +02:00 Committer: Peter Zijlstra CommitterDate: Mon, 17 Oct 2022 16:32:06 +02:00 bpf: Fix sample_flags for bpf_perf_event_output * Raw data is also filled by bpf_perf_event_output. * Add sample_flags to indicate raw data. * This eliminates the segfaults as shown below: Run ./samples/bpf/trace_output BUG pid 9 cookie 1001000000004 sized 4 BUG pid 9 cookie 1001000000004 sized 4 BUG pid 9 cookie 1001000000004 sized 4 Segmentation fault (core dumped) Fixes: 838d9bb62d13 ("perf: Use sample_flags for raw_data") Signed-off-by: Sumanth Korikkar Signed-off-by: Peter Zijlstra (Intel) Acked-by: Namhyung Kim Link: https://lkml.kernel.org/r/20221007081327.1047552-1-sumanthk@linux.ibm.com --- kernel/trace/bpf_trace.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c index 49fb9ec..1ed0896 100644 --- a/kernel/trace/bpf_trace.c +++ b/kernel/trace/bpf_trace.c @@ -687,6 +687,7 @@ BPF_CALL_5(bpf_perf_event_output, struct pt_regs *, regs, struct bpf_map *, map, perf_sample_data_init(sd, 0, 0); sd->raw = &raw; + sd->sample_flags |= PERF_SAMPLE_RAW; err = __bpf_perf_event_output(regs, map, flags, sd); @@ -745,6 +746,7 @@ u64 bpf_event_output(struct bpf_map *map, u64 flags, void *meta, u64 meta_size, perf_fetch_caller_regs(regs); perf_sample_data_init(sd, 0, 0); sd->raw = &raw; + sd->sample_flags |= PERF_SAMPLE_RAW; ret = __bpf_perf_event_output(regs, map, flags, sd); out: