Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2084053imm; Sat, 29 Sep 2018 10:03:54 -0700 (PDT) X-Google-Smtp-Source: ACcGV60dqqjKTKuug6AoRyq0VAh+4GoWxtDQ/cAkmX2KtV0T6GUHh1cvNbKBnlRszLJyOXoAY2Oi X-Received: by 2002:a63:c608:: with SMTP id w8-v6mr3632772pgg.16.1538240634149; Sat, 29 Sep 2018 10:03:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538240634; cv=none; d=google.com; s=arc-20160816; b=tIOxQTY9d/rstEU/HygcvgGyZgu0jSl80LeDDBcTfqYIwMBOC+hHsDjpdvEwBuPJpz kpDWjJ8GZBV4+3mCH7zcaUvTqid5J0K7U6kCatYSq5hSx6VxAI5F4110g+navBtLfAzd 4ez2PkL4/VQxPt3heKn6VFPY8UKyJU9PQNAeXc38DF+aKVln8kVJKM+nNu6159Dh/ZEl nXLFwe2W5gEL4RTnJpFyitguUotUk3XBXIR9tT417Nyh9ccw/OoyhpOGuvDURLAGmouz ioEk1Nf26gfskzZTlVfFiNUWV1fEnEzoj4XI+Y1A80b4yMAh4UnL/TGcnqUinba1vc5G pHDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=CU5J3YluS2DEYPjKv9vvEs9jcMk8B8qUGRBeAtWgd/I=; b=dM1GLTcUwSRMyaspNkXBZgXN9G8ncM0XDpOiOGBSpMVNgGMCC3djHTUv+KOP86pC3f TJeI8UG3roKdPAvdqgMCgvHxx4gKBUjQLvSuA0sh2YnOtPR6bbjzK6ugN5W011XejO/6 AUWcc5XthSnCtSg2bP/QrdQpMVPTrSgp2DYld7s8/RtzR05WutllmT8zo6ppt9G7Z5CI rNgfRoj4tASaZPXKrKXQ8VCPFhcBUQagadOr9EcuoFyptN4cCrt97mtNwKOmm+wQ6XoP S7Ye2/NpHuejdiDGIxE/i72wS2v1Z10AjO3N+apnRpFXFWaZoa/T8WGwWgS7Peq2EVVw iQMA== 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 6-v6si1216128plb.230.2018.09.29.10.03.39; Sat, 29 Sep 2018 10:03:54 -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 S1728552AbeI2XbL (ORCPT + 99 others); Sat, 29 Sep 2018 19:31:11 -0400 Received: from smtp2200-217.mail.aliyun.com ([121.197.200.217]:44178 "EHLO smtp2200-217.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728419AbeI2XbL (ORCPT ); Sat, 29 Sep 2018 19:31:11 -0400 X-Alimail-AntiSpam: AC=CONTINUE;BC=0.2412168|-1;CH=green;FP=0|0|0|0|0|-1|-1|-1;HT=e02c03278;MF=ren_guo@c-sky.com;NM=1;PH=DS;RN=18;RT=18;SR=0;TI=SMTPD_---.CxVVe8F_1538240509; Received: from localhost(mailfrom:ren_guo@c-sky.com fp:SMTPD_---.CxVVe8F_1538240509) by smtp.aliyun-inc.com(10.147.44.145); Sun, 30 Sep 2018 01:01:49 +0800 Date: Sun, 30 Sep 2018 01:01:48 +0800 From: Guo Ren To: "Eric W. Biederman" Cc: akpm@linux-foundation.org, arnd@arndb.de, daniel.lezcano@linaro.org, davem@davemloft.net, gregkh@linuxfoundation.org, jason@lakedaemon.net, marc.zyngier@arm.com, mark.rutland@arm.com, mchehab+samsung@kernel.org, peterz@infradead.org, robh@kernel.org, robh+dt@kernel.org, tglx@linutronix.de, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, devicetree@vger.kernel.org, green.hu@gmail.com Subject: Re: [PATCH V6 08/33] csky: Process management and Signal Message-ID: <20180929170148.GC27796@guoren-Inspiron-7460> References: <87h8iaoh2k.fsf@xmission.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87h8iaoh2k.fsf@xmission.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 27, 2018 at 09:50:43PM +0200, Eric W. Biederman wrote: > Guo Ren writes: > > > --- /dev/null > > +++ b/arch/csky/abiv2/fpu.c > > +void fpu_fpe(struct pt_regs * regs) > > +{ > > + int sig; > > + unsigned int fesr; > > + siginfo_t info; > > + > > + fesr = mfcr("cr<2, 2>"); > > + > > + if(fesr & FPE_ILLE){ > > + info.si_code = ILL_ILLOPC; > > + sig = SIGILL; > > + } > > + else if(fesr & FPE_IDC){ > > + info.si_code = ILL_ILLOPN; > > + sig = SIGILL; > > + } > > + else if(fesr & FPE_FEC){ > > + sig = SIGFPE; > > + if(fesr & FPE_IOC){ > > + info.si_code = FPE_FLTINV; > > + } > > + else if(fesr & FPE_DZC){ > > + info.si_code = FPE_FLTDIV; > > + } > > + else if(fesr & FPE_UFC){ > > + info.si_code = FPE_FLTUND; > > + } > > + else if(fesr & FPE_OFC){ > > + info.si_code = FPE_FLTOVF; > > + } > > + else if(fesr & FPE_IXC){ > > + info.si_code = FPE_FLTRES; > > + } > > + else { > > + info.si_code = NSIGFPE; > > + } > > + } > > + else { > > + info.si_code = NSIGFPE; > > + sig = SIGFPE; > > + } > > + info.si_signo = SIGFPE; > > + info.si_errno = 0; > > + info.si_addr = (void *)regs->pc; > > + force_sig_info(sig, &info, current); > > +} > > > This use of sending a signal is buggy. It results in undefined values > being copied to userspace. > > Userspace should never be sent NSIGXXX as a si_code. You can use > FPE_FLTUNK for this default case. > > In new code please use force_sig_fault instead of force_sig_info in new > code. That saves you the trouble of messing with struct siginfo. Ok, I'll check and USE FPE_FLTUNK and force_sig_fault instead. Best Regards Guo Ren