Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp743595imm; Fri, 28 Sep 2018 06:11:54 -0700 (PDT) X-Google-Smtp-Source: ACcGV63FQnPNiVGV/FFtQRzD+m7Dr+WR0wM7a5Jpwn+qag7jugkpvUqc5byrBsyhl4194QByTk8g X-Received: by 2002:a63:2dc5:: with SMTP id t188-v6mr2355600pgt.362.1538140314222; Fri, 28 Sep 2018 06:11:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538140314; cv=none; d=google.com; s=arc-20160816; b=OouS4Pp384+J4OG8E5fqlGrPyEg19X2AG2Yqf9E3hHOWkBrKPqg2XSHLEi89ZcA+4j l51rSmFcu99Mn3XpB6jFHfUUZFTT+JWn1zkH72s0xoy4vmH4dpJ1b4/+FYyxeJzJ/oEE CRgGTQcPFExF2LVr/vKRbocYLYWFblgVxzmvFqd+z7hdgMtxmaIgcrvfZaecqkXk/Whw spgNSEWIBm98EeOv3IMUg/t8qS78ZIl4wmbya1NPnMldOTs4oOh1NpXeXgyIKoBojd3h h+5FHVBC2vUB+wp9Avf29zSKsAy46JwW6CJ4f9PZGCbp1aPuI9+kha6en+celVMj16Ao kMKg== 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=NqIGrLHZFEUWfhKxXJWCGd7ttfdc+6GZMn8CeAUcsCE=; b=fOFqNtYr2V5X/vYKwaB2ZgMX75oEhg1jQ4qKrGWS+8xA+/SQJQRo+5YAazswTXTUKj d49A1U9tJ6TAgoFVQARU+fNS5OEqqjSCst/hhPRy46tYScAaXsq5+TYEqwCKs8CVAh4p 692CVMBCCC7zUS/etO/Hmb0yc1iPOSnBiuWu7qmTQxYiimmS/CLpGDmLm7HzZaCCZ4NZ JskoFwXQpDOsTPhdIwzPy8AUfjLT0E64JzWdqZGn2NVMlzZReCK54QI3T6Q0iK+LFHYz 3EgNeQVZGHvDCoq1OQOULBOCAHwT+MzPG6/1xq/nrYN92hm3UZnAZ4dB8V2wBcQEB5gD mSdg== 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 f88-v6si5205741pfh.33.2018.09.28.06.11.37; Fri, 28 Sep 2018 06:11: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 S1729044AbeI1TfD (ORCPT + 99 others); Fri, 28 Sep 2018 15:35:03 -0400 Received: from smtp2200-217.mail.aliyun.com ([121.197.200.217]:52605 "EHLO smtp2200-217.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726068AbeI1TfD (ORCPT ); Fri, 28 Sep 2018 15:35:03 -0400 X-Alimail-AntiSpam: AC=CONTINUE;BC=0.2170682|-1;CH=green;FP=0|0|0|0|0|-1|-1|-1;HT=e01e01542;MF=ren_guo@c-sky.com;NM=1;PH=DS;RN=18;RT=18;SR=0;TI=SMTPD_---.Cx.jpG7_1538140248; Received: from localhost(mailfrom:ren_guo@c-sky.com fp:SMTPD_---.Cx.jpG7_1538140248) by smtp.aliyun-inc.com(10.147.40.200); Fri, 28 Sep 2018 21:10:48 +0800 Date: Fri, 28 Sep 2018 21:10:47 +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: <20180928131047.GC2082@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. Ok, thx for the tips. I'll fix it up in next patch-set. > 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, got it. Thx Best Regards Guo Ren