Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp971472pxb; Wed, 3 Mar 2021 23:02:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJyXl/8/UWFLOKApCpULudjcEcIHuAFl3LnWHwjOmAwKEiDvURb68JK2MjNNi7ZUO/2eleqB X-Received: by 2002:a17:907:20e4:: with SMTP id rh4mr2702099ejb.369.1614841361772; Wed, 03 Mar 2021 23:02:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614841361; cv=none; d=google.com; s=arc-20160816; b=oiD2N+fIhe+cC8OX51/uaabLA8JrFhL11+TYEkKf0O9eRzip4s3ryDytH82sfwnu2+ hgbEKjpD9noZykNZnFkMfRfRqKjgn/WaL13SGgX/eElw48jvSSfpvQfMCgh4v5MXL+dg EFPm2WQlUbnd/GCdRuHZESlXJltz39+9QVgjxDYo7NpvJ1U47vBFWoCQiMIRzl+w6XcA XQhjSlGB7Es2n6GIaLGV1ygJIWYjPaVn0EfSZzJzwsgZ94/bMpo99qgqZEMtPjMyAMAt y6/ReKPjOz9X7u/3yd0m4vQuLQKKihZOht58Cbtn7exkSJsj0i6clkaBWBZobOkRf8Kn 05Yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :newsgroups:to:subject:sender:dkim-signature; bh=wht29kUAgkDTBmrHaW1q6XJ3NXEO35xEuxud/bR3ziE=; b=0Q4QQPG+502qei7j+iSuiNp6QOtE6xqLIU/rO5WeqFvj6/K1eXFDb2pJ+JTFZBq440 7pPK8+pNyPXJpBh+OqtNhdmj4dZoDPCMt4h2WJ6oTMUhvedK9eok3aYnE4O2QnYVDFVD 8nROT0Co8qgWFSCNXAgC9P3MnbGDxI/IiW4K7rVCw5SGMl8WrjSmYyNvvcHJh1tqnQRX qX68oBkwHnolAw8b0v0qeXHqRd9UTTwiJy4PunLGvkINrGFnjaN1qBTFepSYebAaJAVq OddRPSvG1AK88S60aVu7tZWKM3lquVwaHonrhq/OS1LIF/HYFZJWqjgO6KljXlDOId+b wlow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AZrrmzli; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jg13si17579797ejc.210.2021.03.03.23.02.19; Wed, 03 Mar 2021 23:02:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AZrrmzli; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1837820AbhCBV7T (ORCPT + 99 others); Tue, 2 Mar 2021 16:59:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1835346AbhCBTCw (ORCPT ); Tue, 2 Mar 2021 14:02:52 -0500 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0AA71C06178C for ; Tue, 2 Mar 2021 11:01:15 -0800 (PST) Received: by mail-pf1-x435.google.com with SMTP id 201so14442534pfw.5 for ; Tue, 02 Mar 2021 11:01:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:newsgroups:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=wht29kUAgkDTBmrHaW1q6XJ3NXEO35xEuxud/bR3ziE=; b=AZrrmzliYKd1I2bdE1uPjy6MzgCQYn94j+rrwAbHdfT3faZtrRh0wbfaDLNVvtb2qt nQaiXureHZxB8+QeqHQXy2X7UiCopVHmJxQd0Tq3jOiFpt3isgYaVZq9xWfn+jY/wrt+ DJEd6A/bDeZbMJCIigCLzlZA7nHZE2PDIcYqQlcakuxPG+BwYeuA6EbVTkdEuhxJ8q06 2z/6QTTRESwT3FwsLoeLM1YJFu0fQXoDnhpa7nWKycx9Ky5khf3L7OC7/+uqguXUNSyD OF5RABsitB65mU1xlpVZSuBxZCuPJj0w4FEnC4ZR/j8tpfSAecZkr+f1mXSqqSwVGjVm 26xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:newsgroups:references:from :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=wht29kUAgkDTBmrHaW1q6XJ3NXEO35xEuxud/bR3ziE=; b=BgWp1vg1278j90tMpzvxHOJ9WS5GyLLm/yLqpTA/jDvxGHxW6Pn1s0o60XqW0E9Zzo QsPpgPJJ6pOt97QVv8mwwe8rVLOuLRM2a5EPa4YmWdRhwblyrw+9qM17JCZ6s3+suWi4 1qbAq/WdIzJ3xGnu9Y5rIAeezvYPHl/CrrQxugr6oMHjSIzqajFl6puW71096i48MHwd QeZiHWO8oNu/lVstdavgJ8nE7yn8FlPp2BrxSRbVpmq80cyo8Qe6U4AUbvfS87CCEims hdMOM3+1RKF64TDc2VA++3rUVW9UHyVCLxeUp2RD82BGtWuJWX0ny7usZIRnidKqF5ER UQgg== X-Gm-Message-State: AOAM533RO0WJ4FYDqD69XKtQ9uB8/m8Acqjcl20Scfd7T3CLSBjdckTt NnlYD/Mb9Vd0Gzsdsn55+0a5oo3clxlE2A== X-Received: by 2002:a63:1021:: with SMTP id f33mr1065584pgl.409.1614711674219; Tue, 02 Mar 2021 11:01:14 -0800 (PST) Received: from [192.168.50.50] (c-24-4-73-83.hsd1.ca.comcast.net. [24.4.73.83]) by smtp.gmail.com with ESMTPSA id e22sm18629680pgk.56.2021.03.02.11.01.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 02 Mar 2021 11:01:13 -0800 (PST) Sender: Vineet Gupta Subject: Re: [PATCH] arc: kernel: Return -EFAULT if copy_to_user() fails To: Wang Qing , Jens Axboe , Thomas Gleixner , "Gustavo A. R. Silva" , linux-snps-arc@lists.infradead.org, linux-kernel@vger.kernel.org Newsgroups: gmane.linux.kernel,gmane.linux.kernel.arc References: <1614600349-15662-1-git-send-email-wangqing@vivo.com> From: Vineet Gupta Message-ID: Date: Tue, 2 Mar 2021 11:01:11 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <1614600349-15662-1-git-send-email-wangqing@vivo.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/1/21 4:05 AM, Wang Qing wrote: > The copy_to_user() function returns the number of bytes remaining to be > copied, but we want to return -EFAULT if the copy doesn't complete. > > Signed-off-by: Wang Qing Acked-by: Vineet Gupta Do you want me to pick this up via ARC tree ? Thx, -Vineet > --- > arch/arc/kernel/signal.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/arch/arc/kernel/signal.c b/arch/arc/kernel/signal.c > index a78d8f7..fdbe06c > --- a/arch/arc/kernel/signal.c > +++ b/arch/arc/kernel/signal.c > @@ -96,7 +96,7 @@ stash_usr_regs(struct rt_sigframe __user *sf, struct pt_regs *regs, > sizeof(sf->uc.uc_mcontext.regs.scratch)); > err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(sigset_t)); > > - return err; > + return err ? -EFAULT : 0; > } > > static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf) > @@ -110,7 +110,7 @@ static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf) > &(sf->uc.uc_mcontext.regs.scratch), > sizeof(sf->uc.uc_mcontext.regs.scratch)); > if (err) > - return err; > + return -EFAULT; > > set_current_blocked(&set); > regs->bta = uregs.scratch.bta; >