Received: by 10.192.165.148 with SMTP id m20csp897962imm; Wed, 25 Apr 2018 09:17:45 -0700 (PDT) X-Google-Smtp-Source: AB8JxZokCo4n2lU+dXcY1aHE7wdhQ21UjX9iN1iZzaG6Gw+7wvnEKHtSyFZD8eDS0u/S+UHibBcA X-Received: by 10.98.172.20 with SMTP id v20mr1405158pfe.101.1524673065880; Wed, 25 Apr 2018 09:17:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524673065; cv=none; d=google.com; s=arc-20160816; b=yTgEVuXICaj+dbBMgpvZIxYtM2yNOPbjGo9ZWSRtPpCNeJgi1ngRMi2bJAy2TQXfQZ j1C4QK/fw/ebqwWlmAtbu2z2oYG8A1jxPvhp7i59dJwVZO6xOZIRDkSxnCP3oqnIQlil bWqqYkW9r1xmVFEe7jSIYiCo4CBiQoOYAnIJQjBs8xAfEjhdjBaRe9B8+2aNEG9KX37d 7vRpSqTr7YyUCCXkC6LP32rTwaJLDZ3noOnmNWYb8XhlwA95dAtUu73sdhM9X9pQPP30 X8Am35r+9+PvuuvwE/XxiJwK7IMVwz3ZPeUztrRTYOjmPIRpXYD6o2/+PjPnrSFNfTlr UOyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:mime-version:user-agent :message-id:in-reply-to:date:references:cc:to:from :arc-authentication-results; bh=Dqpv8lUx9rcYB5wcvm31/AKqPCcsjRd20ThWI7bhcgo=; b=CSkOQ8jQfJ+b2x0tw3JGts8BUWbjN3rOkV2HLOz1OUA+lzHQIKVO4OX1iOYEib4EW5 F86BvF65VfN2sqXAvquWjRAASgmGke0RcYBg+7h+Fz/XCjGlzXnzRnNBTACi6mfnmIm1 TvSUMRPHd6Jb6WKnkQKTwQcO+ZpSbx7M3f12Gk5SVUyheunesuPVnDlgfHNZlGkWcQqE bf1z+53SP7uJz4ckJwjY9+GnFUdgJRWg6BgkzwRMiL+667K76zCkjvGL4l25L4xarYBC z87SxwRGkMPznoVoNwZLyzOdUvqDrOkwdxgbSvrzxZuGGzo91aL3rIS0Mla/xiX1oDoW rqbQ== ARC-Authentication-Results: i=1; mx.google.com; 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 s85si16331164pfi.32.2018.04.25.09.17.31; Wed, 25 Apr 2018 09:17:45 -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; 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 S1755501AbeDYQPV (ORCPT + 99 others); Wed, 25 Apr 2018 12:15:21 -0400 Received: from out03.mta.xmission.com ([166.70.13.233]:52605 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755066AbeDYQPR (ORCPT ); Wed, 25 Apr 2018 12:15:17 -0400 Received: from in02.mta.xmission.com ([166.70.13.52]) by out03.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1fBN4e-0000hS-IY; Wed, 25 Apr 2018 10:15:16 -0600 Received: from [97.119.174.25] (helo=x220.xmission.com) by in02.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1fBN4d-0005vW-Li; Wed, 25 Apr 2018 10:15:16 -0600 From: ebiederm@xmission.com (Eric W. Biederman) To: Vincent Chen Cc: linux-arch , Linux Kernel Mailing List , linux-api@vger.kernel.org, Vincent Chen , Greentime Hu , Arnd Bergmann References: <878t9ilmhv.fsf@xmission.com> <20180420010408.24438-5-ebiederm@xmission.com> Date: Wed, 25 Apr 2018 11:13:45 -0500 In-Reply-To: (Vincent Chen's message of "Wed, 25 Apr 2018 20:10:22 +0800") Message-ID: <87in8fuuva.fsf_-_@xmission.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1fBN4d-0005vW-Li;;;mid=<87in8fuuva.fsf_-_@xmission.com>;;;hst=in02.mta.xmission.com;;;ip=97.119.174.25;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX19bzHQGudzCNwPp/JLxSNhX1GL1Bc66W44= X-SA-Exim-Connect-IP: 97.119.174.25 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa08.xmission.com X-Spam-Level: X-Spam-Status: No, score=-0.2 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE,T_TM2_M_HEADER_IN_MSG,T_TooManySym_01 autolearn=disabled version=3.4.1 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.4903] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa08 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa08 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Vincent Chen X-Spam-Relay-Country: X-Spam-Timing: total 452 ms - load_scoreonly_sql: 0.03 (0.0%), signal_user_changed: 5 (1.1%), b_tie_ro: 4.4 (1.0%), parse: 0.58 (0.1%), extract_message_metadata: 16 (3.6%), get_uri_detail_list: 0.93 (0.2%), tests_pri_-1000: 17 (3.8%), tests_pri_-950: 13 (2.9%), tests_pri_-900: 0.93 (0.2%), tests_pri_-400: 49 (10.8%), check_bayes: 48 (10.5%), b_tokenize: 9 (1.9%), b_tok_get_all: 9 (1.9%), b_comp_prob: 1.45 (0.3%), b_tok_touch_all: 13 (2.9%), b_finish: 0.65 (0.1%), tests_pri_0: 331 (73.3%), check_dkim_signature: 8 (1.9%), check_dkim_adsp: 9 (2.1%), tests_pri_500: 12 (2.6%), rewrite_mail: 0.00 (0.0%) Subject: [PATCH] signal/nds32: More information in do_revinsn X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org While reviewing f6ed1ecad56f ("signal/nds32: Use force_sig(SIGILL) in do_revisn") Vincent Chen asked if it was possible to provide more information in do_revinsn with force_sig_fault. That seems reasonable and the appropirate si_code appears to be ILL_ILLOPC (illegal opcode) as the printk indicates this code path is triggered when a reserved instruction is exectured. So update do_revinsn to use force_sig_fault(SIGILL, ILL_ILLOPC, ...). Giving userspace a much better experience when soemone attempts to execute a reserved instruction. Cc: Greentime Hu Cc: Vincent Chen Suggested-by: Vincent Chen Signed-off-by: "Eric W. Biederman" --- Vincent I have updated this from your suggestion to use ILL_ILLOPC as that appears the more appropriate si_code. Normally I expect you could just update your nds32 tree and make this kind of change but since I am touching this code anyway I will be happy to take this change along with the others. Does this look good to you? arch/nds32/kernel/traps.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/nds32/kernel/traps.c b/arch/nds32/kernel/traps.c index a6205fd4db52..5c2f61835ab9 100644 --- a/arch/nds32/kernel/traps.c +++ b/arch/nds32/kernel/traps.c @@ -349,7 +349,8 @@ void do_revinsn(struct pt_regs *regs) show_regs(regs); if (!user_mode(regs)) do_exit(SIGILL); - force_sig(SIGILL, current); + force_sig_fault(SIGILL, ILL_ILLOPC, + (void __user *)instruction_pointer(regs), current); } #ifdef CONFIG_ALIGNMENT_TRAP -- 2.14.1