Received: by 10.192.165.148 with SMTP id m20csp3780666imm; Mon, 23 Apr 2018 12:13:21 -0700 (PDT) X-Google-Smtp-Source: AIpwx49TdCRqS4vLvgnyZ0NfRgv3IbenPs4AkcwOT6bJC3vte0AJhNmJK9aGFsYEWqykbN0W5GwP X-Received: by 10.98.12.202 with SMTP id 71mr20961314pfm.61.1524510801571; Mon, 23 Apr 2018 12:13:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524510801; cv=none; d=google.com; s=arc-20160816; b=uSsr4XlxtIeThwl6Wf40CIqYItrnOClkZuVcesFqzBPwY1nS07SbEnBVWa2fH7hBcg EFGR7N1soCDW2LFmZsVJplNZH62kR4khQCTcdC+LDVMiV0uZ9tLsKdNXIwj4DFZG+H0E XCBOWFlf8dg/YGxHPXRz41WZv+ULmDdGplTp6ogU4mETnHzjh9If6Z1LTIKB+D8fUatA 32Y6RiyZk0hbKI63AgsMHnh3T9U4AZe0zhGHx54Kcm5smCNiJB4JO6HkNB4lskM/wdhB dcPk36hVJnXHpyYdeXITxmsLyqfG0F3508ZBihi2/aHtUXIeEY8dDD64PENNyCGodW6r 0f5g== 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 :message-id:to:from:cc:in-reply-to:subject:date:dkim-signature :arc-authentication-results; bh=bp0/ph0k+rCJlOoA9PtJFnT/AoTCWVeVn60T/gqjdOI=; b=MwQ5g8m17TXMopR5IFiSdDzqUG6cNiliAZASMwEQF3K98PRITRXSr7GkAh6qS9oKFL qUDRzYkY5DM1XB31/bsj0C55bz87ODI11DiEVmc+OGeNnB9wBn1NfY04Zgf0DhOy8G2u wfRh1swhBccJBlqb+ahytRWnF0P73GqHGQmBRSl2MwSMWESu7x3CPv9HE+rkV9n9aNll K6g/CrPQlEpvh8EMa+RAfRRZhG2rw0UsKTu6UPZ5KNtj+0cjz4oUuFFtxc89AeavOM+G iPsvwrDyTALPObQf1tS0ERNfL4fp5K7Z+DnbwanRH7UQubcLdviZUHlglSMaRzx9Ho8W UkuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=KfvOxjHy; 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 b89-v6si12148242plb.262.2018.04.23.12.13.07; Mon, 23 Apr 2018 12:13:21 -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=@sifive.com header.s=google header.b=KfvOxjHy; 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 S932484AbeDWTLe (ORCPT + 99 others); Mon, 23 Apr 2018 15:11:34 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:39046 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932453AbeDWTLZ (ORCPT ); Mon, 23 Apr 2018 15:11:25 -0400 Received: by mail-pf0-f196.google.com with SMTP id z9so10096145pfe.6 for ; Mon, 23 Apr 2018 12:11:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=date:subject:in-reply-to:cc:from:to:message-id:mime-version :content-transfer-encoding; bh=bp0/ph0k+rCJlOoA9PtJFnT/AoTCWVeVn60T/gqjdOI=; b=KfvOxjHyC9kEv70xvsQk/RB7iG9fqV98bLQwCqvgITtglYhgzlh8bWWfOezZmggUAR cmIW+MBJVQkacd27WQ4ZMhmZBdBZ1PpCQZ04CRp6DjPwqXcssU1cEwFPHme8seULDaWs S9yHLlppPBrKfcmKAPS7zLPMDBAtiuMX4MQT+dD2PDH+jSM09d3s+UsqEyqap3JI7tJy oTTypLShXD0S9eBj+2cZVz6KtgY4XA51K9oKpvQZXoLSiKVDV504viE4J4dEccoVEMOm 1ykl/AOqRVOprnq4L9oyAEiZ64IWNPAXuy6luu0tGGCjU+GXstruKnBu862YSSFHdY2A Azpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:subject:in-reply-to:cc:from:to:message-id :mime-version:content-transfer-encoding; bh=bp0/ph0k+rCJlOoA9PtJFnT/AoTCWVeVn60T/gqjdOI=; b=VksW0SAJ5nIWj6HvqKJw/dLYUzUPQ7xeBY4suztego5N2mVXf7tPV55fT/7E+CQm62 VTYyRrSeGvFbn6+7740M6jSCVXb8LDOizlEuaUJCnNWaWEzF2eJaw/NpqwKfAV+IASUb A+OMsK/mTdOfgZnwtT9+TGJHH9rcG+D0psv+lxNVdF79KAtdrJBz3A/T6vKN2TMIhHFB MykBXNRx1Nu1skUaiXTrORWsCDGnDOti/qFnTdQm+2tMbL2Utu3tCod1dXlM/ZuS7k5M Bflc7rezuJSkKg2UYpfcaMWlmdjWWOFVC4eGYwag89d9Fa5NLAVLUM0GBXfQV8/NPAEf mkBQ== X-Gm-Message-State: ALQs6tC+Pqp5fUqKQ0whh/UWo6H4myb3+S6cmosN8+0PZyQReb546j6I q2OlX2Wbk62oHVDPLXXRRO7iPw== X-Received: by 2002:a17:902:d24:: with SMTP id 33-v6mr21635569plu.22.1524510684228; Mon, 23 Apr 2018 12:11:24 -0700 (PDT) Received: from localhost ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id x81sm27892360pgx.68.2018.04.23.12.11.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Apr 2018 12:11:23 -0700 (PDT) Date: Mon, 23 Apr 2018 12:11:23 -0700 (PDT) X-Google-Original-Date: Mon, 23 Apr 2018 11:57:00 PDT (-0700) Subject: Re: [REVIEW][PATCH 14/22] signal/riscv: Use force_sig_fault where appropriate In-Reply-To: <20180420143811.9994-14-ebiederm@xmission.com> CC: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, ebiederm@xmission.com, albert@sifive.com, linux-riscv@lists.infradead.org From: Palmer Dabbelt To: ebiederm@xmission.com Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 20 Apr 2018 07:38:03 PDT (-0700), ebiederm@xmission.com wrote: > Filling in struct siginfo before calling force_sig_info a tedious and > error prone process, where once in a great while the wrong fields > are filled out, and siginfo has been inconsistently cleared. > > Simplify this process by using the helper force_sig_fault. Which > takes as a parameters all of the information it needs, ensures > all of the fiddly bits of filling in struct siginfo are done properly > and then calls force_sig_info. > > In short about a 5 line reduction in code for every time force_sig_info > is called, which makes the calling function clearer. > > Cc: Palmer Dabbelt > Cc: Albert Ou > Cc: linux-riscv@lists.infradead.org > Signed-off-by: "Eric W. Biederman" > --- > arch/riscv/kernel/traps.c | 9 +-------- > 1 file changed, 1 insertion(+), 8 deletions(-) > > diff --git a/arch/riscv/kernel/traps.c b/arch/riscv/kernel/traps.c > index 48aa6471cede..3087940008f4 100644 > --- a/arch/riscv/kernel/traps.c > +++ b/arch/riscv/kernel/traps.c > @@ -66,14 +66,7 @@ void die(struct pt_regs *regs, const char *str) > static inline void do_trap_siginfo(int signo, int code, > unsigned long addr, struct task_struct *tsk) > { > - siginfo_t info; > - > - clear_siginfo(&info); > - info.si_signo = signo; > - info.si_errno = 0; > - info.si_code = code; > - info.si_addr = (void __user *)addr; > - force_sig_info(signo, &info, tsk); > + force_sig_fault(signo, code, (void __user *)addr, tsk); > } > > void do_trap(struct pt_regs *regs, int signo, int code, If I understand this correctly, any change in behavior this causes would have been a bug on our end not filling out siginfo correctly? In that case then feel free to add an Acked-by: Palmer Dabbelt Thanks!