Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp1497755rwo; Wed, 2 Aug 2023 15:23:48 -0700 (PDT) X-Google-Smtp-Source: APBJJlHhKJgDqxPoWgymoU2EMa1Ir4LH0wHDOOXYzOq4BLFVUu3dQwfINpGxGFQMG16/i2iWIQtK X-Received: by 2002:a05:6402:2d2:b0:51e:2a1b:6de with SMTP id b18-20020a05640202d200b0051e2a1b06demr5360293edx.40.1691015028490; Wed, 02 Aug 2023 15:23:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691015028; cv=none; d=google.com; s=arc-20160816; b=qOb20ezXPhxwDOMMA7aeGaHhSL6wPIqdJBiK07xTfIrhYiYXB8noCMBlvr49iOtNid 2ekrhByZdDZ+u/7vVZ5+pf6YmO8bA5StxbRobQF2B0UG1pVBad2mOYUuuMbt0H/z+731 qVy7dfZiqmjO0W4nw3Nqe7l0KsPPwry405B7A8H+LhGnOJiav03jbeGbHYQZWA6UIru2 EXzz7khDlxFp0Bd39/cQiAGsq1TTpDMRy3XLeQQH5v/cvOHpUVJBlTsdwAOLZ0pJV7eH U7/r24mrCtCPyN4Q31NlMYPhskjnrnYoU5+oSOYoPDQfHgYeyAy/rJyd/qbMCcimAdJZ 0/QA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=bWr3jcRSEU+gA9r0PBD80WJbMi+ArPrQmYYMKJHmB6U=; fh=KBT8mMMG3bvs5FhLaArIUzmXp+Z8aM1mK/DrflSkAmU=; b=eIZhK6d5wZkMowhNg2beMh5JS8pQsXmlP9kzyyl4KWNEpBpBIWvoKmtam6llklQghJ YP65ZrvtAoT66tFcupsvYjY5GiCWZx/b4/FiScWapCW3rXPDlQE70eafuD1cmJ2u77Gh 1RN2oOZz5IRVvA72JuYUQZkS1pywxID8Gqzgfv8HpaRHbeWn+Lmj+bvPKmBhzP4RD4lM XQfb2BcmGCE2iKMEWKDuU0p9+fUblFEgwRmUcAIbvEPlWEQh+VTFi5bX9mZO33eTrvA5 Jpy+G3av6I/6mr1982kxIIdWEpsukhV0BZ+V2s5tEZN9diL59IWRmiCd2v1RQP0VEk1g aJrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=nzPAChC0; 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=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o11-20020aa7d3cb000000b00522c1367415si1280213edr.658.2023.08.02.15.23.22; Wed, 02 Aug 2023 15:23:48 -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=@chromium.org header.s=google header.b=nzPAChC0; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231766AbjHBUgM (ORCPT + 99 others); Wed, 2 Aug 2023 16:36:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231690AbjHBUgL (ORCPT ); Wed, 2 Aug 2023 16:36:11 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BA3C2701 for ; Wed, 2 Aug 2023 13:36:05 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1bbc06f830aso2018575ad.0 for ; Wed, 02 Aug 2023 13:36:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1691008564; x=1691613364; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=bWr3jcRSEU+gA9r0PBD80WJbMi+ArPrQmYYMKJHmB6U=; b=nzPAChC03qv+JjeCfHD3Xsgh7kOt1lPa9r4xyzDxMcstE90i2vukMw/8sXH/02aje3 2otS1qRbhNkAjWyhIbAU++WUZ6yCQqFvvwE0SM4I+99qUJEqDvwnleDRCjb4+gIWskpm kT/uFCmzfT6YzJ6Qh64mXRXv8r01SRYwdq9n8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691008564; x=1691613364; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=bWr3jcRSEU+gA9r0PBD80WJbMi+ArPrQmYYMKJHmB6U=; b=kU9ioCxeOQ5TQW0F2a/yUxjEbrk0fJZBzePwdSn2LwnD9QREQbYT1I+4NLZnNTGfAL rT0oIiY5msXLHSeUHC6QqRnlPUOCEUKTo2qFOW9URCb6VibKGKN7vrAxJ/kkJ2UVfJkU /r0xksnOBSmKuI8ciP+aJI6jE8SGXRpQXHJMZozZuzl5OP/SLyYY3A7arj2/j/kLeiFb +n/KhFbuVt5hER2kwCwaeEqAdax7fNVYl736QT7xw/wOohA6PNjosSxAzSGXP5+GvKsZ q3AZaov4tdtpWz3gTNwvFeDQZlVhwcbQMl3iqGAABSqDWa/vLzChnHtxAnhubcyqiy4B Eo8g== X-Gm-Message-State: ABy/qLYv43LHb6l0dSZ/cxKxB7TY1UqUmqT95+ADdOaCY7N6WZ6uN/Tf mmIIUOR5njdvQBQXyrLY11j3HA== X-Received: by 2002:a17:902:c404:b0:1b9:c61c:4c01 with SMTP id k4-20020a170902c40400b001b9c61c4c01mr23391628plk.9.1691008564550; Wed, 02 Aug 2023 13:36:04 -0700 (PDT) Received: from www.outflux.net (198-0-35-241-static.hfc.comcastbusiness.net. [198.0.35.241]) by smtp.gmail.com with ESMTPSA id jn13-20020a170903050d00b001b895a18472sm12772104plb.117.2023.08.02.13.36.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Aug 2023 13:36:04 -0700 (PDT) Date: Wed, 2 Aug 2023 13:36:03 -0700 From: Kees Cook To: Justin Stitt Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Nick Desaulniers , linux-hardening@vger.kernel.org Subject: Re: [PATCH v2] RISC-V: cpu: refactor deprecated strncpy Message-ID: <202308021335.8010D08B@keescook> References: <20230802-arch-riscv-kernel-v2-1-24266e85bc96@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230802-arch-riscv-kernel-v2-1-24266e85bc96@google.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED 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 Wed, Aug 02, 2023 at 12:21:58AM +0000, Justin Stitt wrote: > `strncpy` is deprecated for use on NUL-terminated destination strings [1]. > > Favor not copying strings onto stack and instead use strings directly. > This avoids hard-coding sizes and buffer lengths all together. > > Link: https://github.com/KSPP/linux/issues/90 > Cc: linux-hardening@vger.kernel.org > Suggested-by: Kees Cook > Signed-off-by: Justin Stitt I like it! ;) Reviewed-by: Kees Cook -- Kees Cook