Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp575342rdb; Fri, 8 Sep 2023 09:21:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH53cEXMshKnTOa1FZcH05kQc3bh5mO7ZNWFzNBI06cpytrykKFeQQfNTlxtl4K0gXodQWL X-Received: by 2002:a05:6512:3146:b0:500:79a9:d714 with SMTP id s6-20020a056512314600b0050079a9d714mr2238071lfi.65.1694190103609; Fri, 08 Sep 2023 09:21:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694190103; cv=none; d=google.com; s=arc-20160816; b=mo08a6raXrLXzH2WJCHuU7eij0cn5EJFCODQejhGk0EffRgAnESek6VXF4wmrd+UjR uDOivBQsXY0m8HvOqcSmDu8OmUaabuhtZj4RIKJVyRQNGlN5Z3LzOvZko2D9SCA9lgZf vCFFJI4qyjMdJ/g6OW1sFCgq5bBlkQoQ031NHDCjWL6+xAIk4/+zSFhQA4WXCntctpjL FMja4XC8sZytEsXDKks+6vL3PeOiRqtoQWMWKITeCA93+jvZawXk2bejzPZIrMc3o53j R9TeTmVwsaJpRTp+mKaS+GWBEcf6f5wvWYat/HpdAxErBszxiYsgiKoZb0F8VG51BAJc EiGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=AtTZqdumDMTm+JG5jYmU8mysRTfJ7gnCkRN+QIqVDGU=; fh=LzpPybKgs/06XVfoMAm33XgvAcLIAcBilu9ICifTSUQ=; b=kql5qeB3e0JHUkEgTzBfWPDN+IWh8gEzaoW8BihMjX2MoRY7YJINQ6ZMkyIGvNcEfM L/CTGzML76CCOIZUV/eSJ7fsI+RgSag+88iJ1v8n8SDvdwgvHc0+e+PLQRVatr7ofNVr JJz0NuzMVwDyDiSHPGF5NY8DpehOCL/fLpArNnbQZO2tGkToL2ORdtiUoZrIL8bxipev 9HAReHUmWSwgYbUF8Kcpgl6BzyJYY9ewVBE+knb2iHYohtFOzhXbCZxsM9VhH2SlXe9N IJlW3KvhuGKJZDmyEtLVdiBPJK6wK5fxOMS0VTG/UXvfPnACrKKNuGcml6g0zkC3Gl0Y PP4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tA7OJMJz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w6-20020a056402128600b005255d1088ffsi1696239edv.671.2023.09.08.09.21.08; Fri, 08 Sep 2023 09:21:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tA7OJMJz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235512AbjIHKWE (ORCPT + 99 others); Fri, 8 Sep 2023 06:22:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231464AbjIHKWD (ORCPT ); Fri, 8 Sep 2023 06:22:03 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BFF21FDC; Fri, 8 Sep 2023 03:21:31 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7D63C433C8; Fri, 8 Sep 2023 10:20:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694168428; bh=W1z1FcuoUvbcfJlaQ1NbkHr76Xrqb6ArX/tD4jLMv24=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tA7OJMJz/w3RSDB8V1crqrYVCsA60kepxdSZ6gZRUMc6m6yZbp+JJ1rkxvbEkIv/G V3OpEki3O0IUZo8+pvPsezPFgXGI+vlRQ7sOjIwgU+tkosDRlxJ3xdYue2yr/FPXqa OOl4wS5pD005jNgLrym8+Dui8+6Vb8obrKT9Vmuig0dpRiEqCOOMDKb3VWUB+577pF GC3WD7EDG3W1rRUF1ccEtJN2yZDIJPV8vpiDt8huNj5/ZAVzfhy2RToXXAgSAt9gFm Np3pTdNGfmkg8cwDVcXQYlxw1fs5AL4ikllZ0+G/T7YRZD4pxvj/tOokBucC9P0mrk vJf6f40QaTfQQ== Date: Fri, 8 Sep 2023 11:20:23 +0100 From: Will Deacon To: Bjorn Andersson Cc: Justin Stitt , Catalin Marinas , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Kees Cook , linux-hardening@vger.kernel.org, Konrad Dybcio Subject: Re: [PATCH v2] arm64/sysreg: refactor deprecated strncpy Message-ID: <20230908102022.GB6849@willie-the-truck> References: <20230811-strncpy-arch-arm64-v2-1-ba84eabffadb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 07, 2023 at 02:28:05PM -0700, Bjorn Andersson wrote: > On Fri, Aug 11, 2023 at 04:33:51PM +0000, Justin Stitt wrote: > > `strncpy` is deprecated for use on NUL-terminated destination strings > > [1]. Which seems to be the case here due to the forceful setting of `buf`'s > > tail to 0. > > > > A suitable replacement is `strscpy` [2] due to the fact that it > > guarantees NUL-termination on its destination buffer argument which is > > _not_ the case for `strncpy`! > > > > In this case, we can simplify the logic and also check for any silent > > truncation by using `strscpy`'s return value. > > > > This should have no functional change and yet uses a more robust and > > less ambiguous interface whilst reducing code complexity. > > > > I'm sorry, but this patch is wrong. > > __parse_cmdline() is supposed to match the command line against a set of > keywords, one word at a time. The new implementation ignores the > word-boundaries and matches the whole command line once and then breaks > the loop, typically without having found a match. (See below) > > Can we please have this patch dropped, Will? Yup, this was fixed yesterday so please take linux-next 20230908 for a spin and let us know how you get on. Cheers, Will