From patchwork Thu Apr 22 06:44:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marco Elver X-Patchwork-Id: 12217731 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55567C433ED for ; Thu, 22 Apr 2021 06:47:07 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9E4D561448 for ; Thu, 22 Apr 2021 06:47:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9E4D561448 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Cc:To:From:Subject:References:Mime-Version: Message-Id:In-Reply-To:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=INqWa/17fvzzgWBFNf4w+46dgEmXZXpekyxFkvXLi8Y=; b=kXrnUpMH5E6IcS FdtRy003nOZHY9WVkO3KTv3FuFFDEz6CUEO4nOTToOD2U9//stvSbP/ATLalJUbjeG4gvfhSJKMF2 kefmD4kQKeE0TrNv2AqRzGXPX5ig4TVc/Meb9KxRKvi7V21MLCarVDyTBka3Lu3RWWaNmoHXr0bgg bxaDJ8v6e1uDHR+jPAQsXmZzVW0/TrtD2SjWMKE2jrfZXX8DCLOyjyj0exH1KVJFG4dhnyNFMxsa+ 36WSmAk+6Toj6LAjRNpzKsBY000Jcauk+gqIBQbTIAnxAoOraZ5dNgj3P7mU1WTBriZq3EoQrir82 9yuk9uF3WYrsDznl56PQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lZT5N-00G33Y-Rw; Thu, 22 Apr 2021 06:45:14 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lZT5H-00G336-1M for linux-arm-kernel@desiato.infradead.org; Thu, 22 Apr 2021 06:45:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type:Cc:To:From:Subject: References:Mime-Version:Message-Id:In-Reply-To:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Sugwskr8rXy42pZ1xDG6/Yn9grQzLU2kaW/tniDjvCM=; b=oGxi3e82gMiNxR64eht3Uvmzxd 4vErvUpa7kkTL1wM+JRsm0ogpXU9kKwCbWvhgHCtIn8TnuTH8cRCvjej4edF1qPLeVU5yExnryRfu bby+gfHB/SJLkugRe8ak1Cwmi5hLGLNBZuvoxRMfp6KipW9ekknwTazb4VhXLzEV6A0K9K/GHT3kc dTqL4Fr8q7XC3HnD/tP89zeelWQ9SoZKBQ2KiVOhClaOGjPoA8DjblgE9bxt03HH6TzMx9cIjq1pM EtOvG1mVx8KH+OokNTJpCT+RDUkSpomERvSbsU78VAmZ6NNQ/qlwPOf98RI8wb7ieC9c5VeJ+FoA7 yTmPTKuA==; Received: from mail-wr1-x44a.google.com ([2a00:1450:4864:20::44a]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lZT5E-00DQ7D-Ky for linux-arm-kernel@lists.infradead.org; Thu, 22 Apr 2021 06:45:05 +0000 Received: by mail-wr1-x44a.google.com with SMTP id y13-20020adfdf0d0000b02901029a3bf796so13378917wrl.15 for ; Wed, 21 Apr 2021 23:45:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=Sugwskr8rXy42pZ1xDG6/Yn9grQzLU2kaW/tniDjvCM=; b=rlmZAOT4B8TFqAZfZ08hCQP6c8Lo5iDRtrCmUNvvQfPE2MM8TQVihWTTmzMuSendWu yX+RaWI3/1avKzx9airDR9aL48aJWg8GIWMZcHboD9GKsYqKNJkl1Sd8UbVlDroUbRxT B6+HRfVChEHZtk9KTA1SSqpw+ZHUQvGm1Uz1fY6Rz2kq/qq6GvJzN/41hCtme7AQ5rsp PodsoHWH/gfa1Fbt9QmGwRjIM04KLoBHQpmiECbBz3g+6LRJ4YfkGhpRTe7QZIFbLGH+ JKqayl8XPz7Stk7eXLPT/KB6A163xlvaydZwEuEw5tln8PZfuCouXuz3CO5LpRH2KTE8 fKVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=Sugwskr8rXy42pZ1xDG6/Yn9grQzLU2kaW/tniDjvCM=; b=miKFrEux9Zr3JPVKmBXd7mq3tHxPeRIn9TMW2Qop4S4Ygxp5qyND0rM8eITSEjodd5 jcaLY1YdPMJ3XKz9zMMzTY/23bKWb/yaPJRB4TYqoPsRyqcUPf/Gr9hn89OuyogIYQmA sMChMgMwiorpfL/QtaFO5nXa5Q8XRVCfZXYQSrWgPP7yRta7bTCi7yyjhCy905s6dsnO Hks8FpmCyc1c8mDc9ic/yTZkKmj5tunZsvO/5r5ymHfq5HN4r7bq1cOEIfW202NECyI5 4ZCG6WiOWYHLYWvRze+buiSZfh3W0BACc9Uk+S1hbOfvxBSHH6IWwvaqL569Gz0uay8l kxgw== X-Gm-Message-State: AOAM531ZO3a15qmFArpW5P7BvufuEpqwe7Y72+pWxHJf9t4cSweWzrK2 DUDLql+HHHQWsKZgHsFJr3MUtlHO4w== X-Google-Smtp-Source: ABdhPJy+hre1G5RN1jq0nJSfzX61loPh+welwRzkqIFqp7alxaEk/o/Xx49s2TFsWZg2yfvXi5JrJ0YSHg== X-Received: from elver.muc.corp.google.com ([2a00:79e0:15:13:6273:c89a:6562:e1ba]) (user=elver job=sendgmr) by 2002:a05:600c:35cf:: with SMTP id r15mr12248413wmq.183.1619073899334; Wed, 21 Apr 2021 23:44:59 -0700 (PDT) Date: Thu, 22 Apr 2021 08:44:37 +0200 In-Reply-To: <20210422064437.3577327-1-elver@google.com> Message-Id: <20210422064437.3577327-2-elver@google.com> Mime-Version: 1.0 References: <20210422064437.3577327-1-elver@google.com> X-Mailer: git-send-email 2.31.1.498.g6c1eba8ee3d-goog Subject: [PATCH tip 2/2] signal, perf: Add missing TRAP_PERF case in siginfo_layout() From: Marco Elver To: elver@google.com, peterz@infradead.org, mingo@redhat.com, tglx@linutronix.de Cc: m.szyprowski@samsung.com, jonathanh@nvidia.com, dvyukov@google.com, glider@google.com, arnd@arndb.de, christian@brauner.io, axboe@kernel.dk, pcc@google.com, oleg@redhat.com, kasan-dev@googlegroups.com, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210421_234504_706441_80C39AB3 X-CRM114-Status: GOOD ( 11.80 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add the missing TRAP_PERF case in siginfo_layout() for interpreting the layout correctly as SIL_PERF_EVENT instead of just SIL_FAULT. This ensures the si_perf field is copied and not just the si_addr field. This was caught and tested by running the perf_events/sigtrap_threads kselftest as a 32-bit binary with a 64-bit kernel. Fixes: fb6cc127e0b6 ("signal: Introduce TRAP_PERF si_code and si_perf to siginfo") Signed-off-by: Marco Elver --- kernel/signal.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/signal.c b/kernel/signal.c index 9ed81ee4ff17..b354655a0e57 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -3251,6 +3251,8 @@ enum siginfo_layout siginfo_layout(unsigned sig, int si_code) else if ((sig == SIGSEGV) && (si_code == SEGV_PKUERR)) layout = SIL_FAULT_PKUERR; #endif + else if ((sig == SIGTRAP) && (si_code == TRAP_PERF)) + layout = SIL_PERF_EVENT; } else if (si_code <= NSIGPOLL) layout = SIL_POLL;