Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp1097565pxy; Sat, 1 May 2021 03:47:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhX7CwtC6qLLgKFAzMiqEjHGb1LihBiyiOoL4pIQ+Zb6xSMXkS6IjUZKCdJ5Tp2muVhuPZ X-Received: by 2002:a65:590a:: with SMTP id f10mr9002238pgu.358.1619866049064; Sat, 01 May 2021 03:47:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619866049; cv=none; d=google.com; s=arc-20160816; b=n+9wLx8VsCbISbngmddudQBHb6JCFAJ5HC7hbCnT6tq1yjCCwQv8Od7Ev02tlxuhyu VNp/SCBBHkwXa8TiJOfG2otfLuYT/jQyDkGgBMztM4zuJBT8hVWkgdSUwr+46quJm3B1 3lMpa4TSsN7pciQihjD1H+QTh1El+jjPXQHBXxeXF0FA1uiCfY6hXJ3Wa29lLx2sEXjd BebSdUujHsBHmRW7Xu57rxyCXFnsQMFM00a3MyvxmyKCsyjmACuyTlZ9Q9LBt9infQEu WC0nKff0R9Z6MGqqxKIimmWMeZcn45mNgatlRWsHagnH04p598ijLoXeeSmo9Eo+egxb CuHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=dER8WYp4YE8meKl/Etoz17guMOCTTHD//33hX1fp/nc=; b=SqWSILA7sFdVjsYhOL4dG1ldwGkMmOnFH9xoPm96IKBvqqRJkN/QA616j634AQLdFp yVVkOkVeRjNiYZf/lkvkTUJbPbekxh3kmlHR5FvwZPNIs2bwTyNGQeMBx9NU1fCF+Rvt g5Y6Y9DdVD6S3ue911d1JzWh1i/bL6qtPzi8loNw5YLudvdsl05fH3nieu1N+f2N7+aL 50/Kyigs5CXAu+gNQqz3ThD/pqa2GYZjDuBc7L49Px5KUqslTu/qllArsdFA5lwb4F8u mPL0PtjHc9L4M9wg4d4k3zt9cVpwHI64DjJPS/NIwYyxsga4mSo25t3UtOA3jAyv0F1G J6Bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=IMwXPYTH; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x7si7327788plr.325.2021.05.01.03.47.02; Sat, 01 May 2021 03:47:29 -0700 (PDT) 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=@google.com header.s=20161025 header.b=IMwXPYTH; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231912AbhEAKqw (ORCPT + 99 others); Sat, 1 May 2021 06:46:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231252AbhEAKqv (ORCPT ); Sat, 1 May 2021 06:46:51 -0400 Received: from mail-oo1-xc2e.google.com (mail-oo1-xc2e.google.com [IPv6:2607:f8b0:4864:20::c2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B16E0C06174A for ; Sat, 1 May 2021 03:46:01 -0700 (PDT) Received: by mail-oo1-xc2e.google.com with SMTP id e9-20020a4ada090000b02901f91091e5acso208795oou.0 for ; Sat, 01 May 2021 03:46:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=dER8WYp4YE8meKl/Etoz17guMOCTTHD//33hX1fp/nc=; b=IMwXPYTHlYOoD5VsAO4X3ijzUYSqjzTkipTMXSJAa4Ec/Z91vBXmKGZpM1LZjGeTfi A2o8QHkEc0HHPO6HcyVHnWNCcxhjLYl8fWYOkaGxOeT4X9gjXlrseEIRapNH06M1B6X4 qgtgd/nxRmuOBVpKTW2uycdyqLuBlpjyjlEjbIeY+HjuqazrkOFRppFAukWodMJjucbM bS37OSIMjLyekZH3aBAYORVOonEqHQJMQIxfJsX8ODMCx0YvN3l6Kgrsb+eVbO+XZehq 2cPOsLocLN9qX2CesXNgiS8rbKeuUPpSsvSo9ixyAf/4Fgs9AhVmnYqvR6B5Spba4fhd hucQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=dER8WYp4YE8meKl/Etoz17guMOCTTHD//33hX1fp/nc=; b=mC70ZlWL8M/TzlrQwCMmWDP39v5QZjbUiIs9Yz60EfpKJhuDlIFlzxAVDzSTgUxuO0 4gQdzdwdZk0WcT3rrsSXeSYpGp8o9N+SGMYcox8PZ8cx99QgUiDeyc0TNRXS7b5KraU/ C05EWV1snHv1nONWF9E0jdtwxyY19WC7d+yG7N99XL8S1ae8beBr5cYfkrA6Gsj5s5TL +aIS5V6dsyjwM5exfQJ44M+cD7WH+/jsc3jOjGquxAMNJE+aTwpVZGfLjbfppgX0NgBq fMROaGjJcEJFZw7OdjFfpaMMGqnSOBu0DmbgQqJEinjBvL2g/vTHJi5EnPe0RcP9nDoH ph+g== X-Gm-Message-State: AOAM531VE1eV2rQ8RgB9djh7pP7nknbncUUdO3r/EUJh+u5zWEV0TUTu sPFYInZO9yWqQHIUciuiT5n16hIPefKT5BGq79aZqg== X-Received: by 2002:a4a:3511:: with SMTP id l17mr7963113ooa.36.1619865960952; Sat, 01 May 2021 03:46:00 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Marco Elver Date: Sat, 1 May 2021 12:45:49 +0200 Message-ID: Subject: Re: [PATCH 6/3] signal: Factor force_sig_perf out of perf_sigtrap To: "Eric W. Biederman" Cc: Arnd Bergmann , Florian Weimer , "David S. Miller" , Peter Zijlstra , Ingo Molnar , Thomas Gleixner , Peter Collingbourne , Dmitry Vyukov , Alexander Potapenko , sparclinux , linux-arch , Linux Kernel Mailing List , Linux API , kasan-dev Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 1 May 2021 at 01:43, Eric W. Biederman wrote: > > Separate generating the signal from deciding it needs to be sent. > > Signed-off-by: "Eric W. Biederman" > --- > include/linux/sched/signal.h | 1 + > kernel/events/core.c | 11 ++--------- > kernel/signal.c | 13 +++++++++++++ > 3 files changed, 16 insertions(+), 9 deletions(-) > > diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h > index 7daa425f3055..1e2f61a1a512 100644 > --- a/include/linux/sched/signal.h > +++ b/include/linux/sched/signal.h > @@ -318,6 +318,7 @@ int send_sig_mceerr(int code, void __user *, short, struct task_struct *); > > int force_sig_bnderr(void __user *addr, void __user *lower, void __user *upper); > int force_sig_pkuerr(void __user *addr, u32 pkey); > +int force_sig_perf(void __user *addr, u32 type, u64 sig_data); > > int force_sig_fault_trapno(int sig, int code, void __user *addr, int trapno); > int send_sig_fault_trapno(int sig, int code, void __user *addr, int trapno, > diff --git a/kernel/events/core.c b/kernel/events/core.c > index 928b166d888e..48ea8863183b 100644 > --- a/kernel/events/core.c > +++ b/kernel/events/core.c > @@ -6394,8 +6394,6 @@ void perf_event_wakeup(struct perf_event *event) > > static void perf_sigtrap(struct perf_event *event) > { > - struct kernel_siginfo info; > - > /* > * We'd expect this to only occur if the irq_work is delayed and either > * ctx->task or current has changed in the meantime. This can be the > @@ -6410,13 +6408,8 @@ static void perf_sigtrap(struct perf_event *event) > if (current->flags & PF_EXITING) > return; > > - clear_siginfo(&info); > - info.si_signo = SIGTRAP; > - info.si_code = TRAP_PERF; > - info.si_errno = event->attr.type; > - info.si_perf = event->attr.sig_data; > - info.si_addr = (void __user *)event->pending_addr; > - force_sig_info(&info); > + force_sig_perf((void __user *)event->pending_addr, > + event->attr.type, event->attr.sig_data); > } > > static void perf_pending_event_disable(struct perf_event *event) > diff --git a/kernel/signal.c b/kernel/signal.c > index 690921960d8b..5b1ad7f080ab 100644 > --- a/kernel/signal.c > +++ b/kernel/signal.c > @@ -1753,6 +1753,19 @@ int force_sig_pkuerr(void __user *addr, u32 pkey) > } > #endif > > +int force_sig_perf(void __user *pending_addr, u32 type, u64 sig_data) s/pending_addr/addr/ to match force_sig_perf() declaration. > +{ > + struct kernel_siginfo info; > + > + clear_siginfo(&info); > + info.si_signo = SIGTRAP; > + info.si_errno = type; > + info.si_code = TRAP_PERF; > + info.si_addr = pending_addr; > + info.si_perf = sig_data; > + return force_sig_info(&info); > +} > + > #if IS_ENABLED(SPARC) > int force_sig_fault_trapno(int sig, int code, void __user *addr, int trapno) > { > -- > 2.30.1