From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AD03BC07E9D for ; Mon, 26 Sep 2022 14:03:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=QwOhvYtQPZOfqhk5havNN0DZjfLw3Jan5iqj1Sv5yHk=; b=2fqqzfNyasAKoz l63WezbAgbpcIHM8f7xvDzQgdjeX8erwh+FukBgxZ1RjYl4UKQ5emMKGisavH2rjY8ttD//vHIk06 hmkCvk3KwMpI+p81fvanvAS29GBFOLM0R/v/LSAThPS4Xh06Fvkiql8AZkKYZuhimB+X4YvKdSCK2 RjJljaLihNe4PHpUhriSR1JUgIN3h/FX8oUcZJjNVXrgeag0TjE5DE3doYdVc45OCqlqg412ZDkR6 yi2uiLVgFsvUK6MxUw4Bvi/mPMFDqP7qrUMox45B3K1SGwVHSn4GsgBnHKN9U/xegApO8cR0m+yR1 bL0OYRoZyo/AfhFoFyog==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ocogP-005G0A-83; Mon, 26 Sep 2022 14:02:05 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ocogL-005Fzc-Ns for linux-arm-kernel@lists.infradead.org; Mon, 26 Sep 2022 14:02:03 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9C9BB60DCF; Mon, 26 Sep 2022 14:02:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED66AC433D6; Mon, 26 Sep 2022 14:01:58 +0000 (UTC) Date: Mon, 26 Sep 2022 15:01:55 +0100 From: Catalin Marinas To: Sergey Shtylyov Cc: Will Deacon , linux-arm-kernel@lists.infradead.org, Oleg Nesterov , lvc-project@linuxtesting.org Subject: Re: [PATCH] arm64: ptrace: user_regset_copyin_ignore() always returns 0 Message-ID: References: <4c678cd1-7e75-5c73-0de8-2ffaa3a96e0e@omp.ru> <20220922115902.GB11505@willie-the-truck> <21919615-c075-006b-1730-50043f344f83@omp.ru> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <21919615-c075-006b-1730-50043f344f83@omp.ru> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220926_070201_850771_37EC16DD X-CRM114-Status: GOOD ( 25.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Sep 22, 2022 at 08:37:57PM +0300, Sergey Shtylyov wrote: > On 9/22/22 2:59 PM, Will Deacon wrote: > [...] > >> user_regset_copyin_ignore() always return 0, so checking its result seems > >> pointless -- don't do this... > >> > >> Found by Linux Verification Center (linuxtesting.org) with the SVACE static > >> analysis tool. > >> > >> Signed-off-by: Sergey Shtylyov > >> > >> --- > >> This patch is against the 'for-next/core' branch of the ARM64 repo... > >> > >> arch/arm64/kernel/ptrace.c | 16 ++++------------ > >> 1 file changed, 4 insertions(+), 12 deletions(-) > >> > >> Index: linux/arch/arm64/kernel/ptrace.c > >> =================================================================== > >> --- linux.orig/arch/arm64/kernel/ptrace.c > >> +++ linux/arch/arm64/kernel/ptrace.c > >> @@ -514,9 +514,7 @@ static int hw_break_set(struct task_stru > >> > >> /* Resource info and pad */ > >> offset = offsetof(struct user_hwdebug_state, dbg_regs); > >> - ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, 0, offset); > >> - if (ret) > >> - return ret; > >> + user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, 0, offset); > >> > >> /* (address, ctrl) registers */ > >> limit = regset->n * regset->size; > >> @@ -543,11 +541,8 @@ static int hw_break_set(struct task_stru > >> return ret; > >> offset += PTRACE_HBP_CTRL_SZ; > >> > >> - ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, > >> - offset, > >> - offset + PTRACE_HBP_PAD_SZ); > >> - if (ret) > >> - return ret; > >> + user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, > >> + offset, offset + PTRACE_HBP_PAD_SZ); > >> offset += PTRACE_HBP_PAD_SZ; > >> idx++; > >> } > >> @@ -939,10 +934,7 @@ static int sve_set_common(struct task_st > >> > >> start = end; > >> end = SVE_PT_SVE_FPSR_OFFSET(vq); > >> - ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, > >> - start, end); > >> - if (ret) > >> - goto out; > >> + user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, start, end); > > > > I think it would be better to have user_regset_copyin_ignore() return void > > so that we don't run the risk of missing an error code if it starts > > returning one in future. > > That's the plan! But I need to convert the users 1st, right? Right, though normally we'd like to see the full series that does the arch clean-up followed by the user_regset_copyin_ignore() return changed to void. If for some reason the last patch is rejected by the maintainer because there are plans to actually return some non-zero value, we'd have to revert the above. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel