Received: by 10.192.165.148 with SMTP id m20csp1481616imm; Wed, 25 Apr 2018 20:04:37 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqenOUcLfjekJNlY16kB9PbfkoUTHD5yq8/qJkS/+WVeCxDpc4Rit3DuehN8de3MkzfQKmP X-Received: by 2002:a17:902:7283:: with SMTP id d3-v6mr10035346pll.308.1524711877256; Wed, 25 Apr 2018 20:04:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524711877; cv=none; d=google.com; s=arc-20160816; b=fJdsn81dyl2JvRGLM1Dei7K/mi0fVYIRm9v9CUK/U8ccn6mL9m0GiSprYdpYycX5WN zjFGKyJFmOQN3QwF9L+ZdXSP6FyRu3dvDaz78NFVndxJnRAXWdkgg8fmooJkTMLfuC/x 6QNK1jj74dDIsKHdacCM1/I9B+9+9doCZe5JBqb1zoUIE9KV/N4B1qXzDSaAcZaFr76m NRrTJ+2yWWZsXanWiSwtmea4oINzmZSdmrOKFuEQnSPOO0C7MaFOCTFVUvwpDNEWLXel FBdTiiWrCPnndR2yWOIUCYjpQqwDtQKpHd/iKMi9bckNqmGzeR6pTeYjBhq9/12AY8hX 89CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=/CWMIdywIeW27BjSmJDuSxPaaohqmLVyCLQmmfJv42I=; b=vqTFmudpi1nKflBK0/TryT/PPK+9pchJQ7vlHZoVMIpVAbcXkq+kKHoKj/rM1yM9A5 9ZX9jSReSa0kpNTvGlPfdCSI40ZiCAkwIy5e8C+weqGAQZfVMw6IvZfznabLlDVx1SUF 9SffitKv77S2LGuiMjnp6I0/BaPy/kJ/74ea+na8CvBmfiJMnST1XdFtnPz9R/o9gDaQ 50xwq9o98Qykj2VU1QZ0CKiplPmeOADQrATWVzCIv3jtPK5++G6Wp3uj+5Z+yIzL12Ve koTtAtlXZdzq503t/mNWoKX3v/txlJbmPyH+W3fdKJY1S/K0vQyYpCotNetB3LSNHUtM XV7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gKrAvNJI; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t184si1590128pfb.98.2018.04.25.20.04.22; Wed, 25 Apr 2018 20:04:37 -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=@gmail.com header.s=20161025 header.b=gKrAvNJI; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752570AbeDZDC7 (ORCPT + 99 others); Wed, 25 Apr 2018 23:02:59 -0400 Received: from mail-io0-f195.google.com ([209.85.223.195]:46404 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751910AbeDZDC4 (ORCPT ); Wed, 25 Apr 2018 23:02:56 -0400 Received: by mail-io0-f195.google.com with SMTP id f3-v6so29275357iob.13; Wed, 25 Apr 2018 20:02:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=/CWMIdywIeW27BjSmJDuSxPaaohqmLVyCLQmmfJv42I=; b=gKrAvNJIKnmyks2UIlMywL/4XdPHmGPxunvNli9Ny6ew82A3LSdIGcvHzmMGNoKARc GBRtPh3HKkJkNxWQ7WD/TzNbUAT3sQ+56hdT22qA5UDWZJ11+7nh5NQ3y/W6l3wA6HSO lrRpKSzpPUSQIOKIpkhqnMfDTDb+arQfaRx0cYElK4qkqXmssXgJdNKcmI0E8jFnAtDw +si+ch4iVkpXg8WHvXfh7FCLQSF/bJqlWMn3E/o+8srSbO04AtNXsEIr1TInaxYuyaDP NDIxYlinHD3SO95gsY1Cz0nOVP8/ymWgUWerkII1L+Nn5oiWcApiltZScCnnNxNYQRt7 pPqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=/CWMIdywIeW27BjSmJDuSxPaaohqmLVyCLQmmfJv42I=; b=Vz/GlhVqO35G3Eir/cofaQi0TtJHbbuaW3Mi2NGgo1bLZ0LYymDKKRf7j+agBtQBS8 4XrgM/lh0GZNXXG7WDKnntSnzA7cnaiTUI3tIdN8ZMl7eb7MQ4Z1mpFSgQFFpNy+FMtG gG1VwNZPkQdTpfwU8/Ucda9pyKLOcgz1gSth0CEA9GyxMhKLhhaw/T8//b3yJy1ku0X6 /07sY1GJVuP4KhNFA2/4g+EIf9ebVAMquyicigB15vFZadm/XXuLQ/581JXjrSO28qHo 7hE0WW9JvqK2iMQWa8BAAQAK0WIUpW1xd4lpXwOfRxB7EUPxBCOculwHtvf0foapjwuO qRbA== X-Gm-Message-State: ALQs6tDZD7wxkVMF4n3phSWXj45tG0mOd5O4PuilTjZCfnrJyNbz8HNK I9GXk/CsaKpYwOTHlINo5YBzvnXmkLWAJNzwlpU= X-Received: by 2002:a6b:a4cb:: with SMTP id d72-v6mr11758028ioj.34.1524711775284; Wed, 25 Apr 2018 20:02:55 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.29.132 with HTTP; Wed, 25 Apr 2018 20:02:54 -0700 (PDT) In-Reply-To: <87in8fuuva.fsf_-_@xmission.com> References: <878t9ilmhv.fsf@xmission.com> <20180420010408.24438-5-ebiederm@xmission.com> <87in8fuuva.fsf_-_@xmission.com> From: Vincent Chen Date: Thu, 26 Apr 2018 11:02:54 +0800 Message-ID: Subject: Re: [PATCH] signal/nds32: More information in do_revinsn To: "Eric W. Biederman" Cc: linux-arch , Linux Kernel Mailing List , linux-api@vger.kernel.org, Vincent Chen , Greentime Hu , Arnd Bergmann Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2018-04-26 0:13 GMT+08:00 Eric W. Biederman : > > 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. > I think error code is set as ILL_ILLOPC is a good choice for normal reserved instruction but it seems a little bit inappropriate for nds32. For nds32 reserved exception, It is possibly triggered by illegal opcode, operand and immediate. Unfortunately, do_revisn() can not identify the actual reason now. Therefore, I chose ILLTRAP to avoid confusing user when the reserved exception is cauesd by wrong immediate or operand. > 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? > It is fine to commit this change along with the others. Vincent Chen > 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 >