Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6156295rwd; Wed, 24 May 2023 11:30:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6zqX9IuZBVHUDLm2CwFN3ymO1dXrXRI/w9VTR1bjCh+lRGyQo4zfjGwYY2IB6WxQG9VYiJ X-Received: by 2002:a05:6a20:1453:b0:f2:ad27:f98a with SMTP id a19-20020a056a20145300b000f2ad27f98amr21054104pzi.14.1684952999824; Wed, 24 May 2023 11:29:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684952999; cv=none; d=google.com; s=arc-20160816; b=WYTJWDBCgyuDIXMG8NoUOlQaPG94udmYvI1VJQ3iX3kv4kSazdydUavx2+Ap2x5Zzt /Axz2pDGE9OJm39up6JDG/iwvTjOqKg17CO4s9/XDQ/xZ2pfgGvGm8mXwEsIbY/XcqDl 62o4nRIQjVNyJ8C6srcFyP2GEoUhzwVwDCzhMHJi16AicYBVaI8ZI/Z2R+JZrzOBoPOL wSFBLqLjFs4LG+CwksUTbA9QCBhVeZicAhmSjzOuJTfwBfMVDy2cc6bHPEyCXNNsWcYx XrpU8uLrlJeagKnz2qbfLmCnhHkS3efeRM0oet/BFvaTkDniK78zmSEKVnwek02OslTk xXDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=rlPBaeyzlXrf/1ID6O8EEwBqTqJMpkMnDn/pRjEQSJc=; b=V13OeF5eZ6eIfKn0CGzw33XcgOZQV+zNzBZg+34c2k40Szk8s7/rHtJN+5uSoAb9QJ e7DzigonvfiW//sVlmRiDwtXHY7FmQO9fN0wA/F+pDIbLTCFBhOIvEyLc3gPomp6ahlq 6mfIiv/J+nWTb3iqFhAX+V0f0AqlfoZt95BVzlLgzLn13deIclUv9UWK5ugzVrepnUzb +6ae/VMIcs5NHxM2X1mSck4JEfvpWCeMJODBR6ne2IazZtgVohEC4B7DDSd6zfolCN+2 zCTrmek2s6BOXmikzf/OWT8fT2qbBsd5IhDPb73bW8j6WqWgu7QtqgmQfmGEvXav5tkS MJKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=e3S66VMK; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v22-20020a636116000000b0052c5d7f0109si2168254pgb.456.2023.05.24.11.29.45; Wed, 24 May 2023 11:29:59 -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=@gmail.com header.s=20221208 header.b=e3S66VMK; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229489AbjEXSBj (ORCPT + 99 others); Wed, 24 May 2023 14:01:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236522AbjEXSBa (ORCPT ); Wed, 24 May 2023 14:01:30 -0400 Received: from mail-ua1-x935.google.com (mail-ua1-x935.google.com [IPv6:2607:f8b0:4864:20::935]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C24C180; Wed, 24 May 2023 11:01:29 -0700 (PDT) Received: by mail-ua1-x935.google.com with SMTP id a1e0cc1a2514c-783f88ce557so25634241.3; Wed, 24 May 2023 11:01:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684951288; x=1687543288; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=rlPBaeyzlXrf/1ID6O8EEwBqTqJMpkMnDn/pRjEQSJc=; b=e3S66VMKx/tiNL1kyczRErSQ+xgBRlykj2JtCBWYSPt3r1L4MT5QNHMVG5sV7GK/q8 sHEejcNn1/lp9YZpkogxedGXI04mcqS22B57/2/EOpNryDdY+Lmt5x0FNXPPrrBD/DYA 5Bma1m0Y+4Zk/wIdDvJqrW3hz5C/lLx1b9FkLjydcHzh17F8CtBEuipF2RkRn/PYElf5 nheW219I/0GqHduhfuU+Jt0xhubNqXWhRK1XU8E2CkgYmsCFkGCkUIPGrJ9nt+D3mXrI 4Evhe80dYCAN/zuKuGDk0hbpS294U54DEDn/Dj/1CMBseoLs88Kux+IduqfP5Fp2dRtZ Oo2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684951288; x=1687543288; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rlPBaeyzlXrf/1ID6O8EEwBqTqJMpkMnDn/pRjEQSJc=; b=crEEZOqkiE9ACz25trjxhOwedDBfCRf3q5UWwROC6aJDtXts3m86DhyHgrwJHeHXv+ ND2IEhVfZxW1WNNCvk3kQ7ST3YpvwKkFr8e4pGJ0vTtPYcR4QgagqoZM8aqewo1MJMR/ 1BOXwqwDvEnhBpGq5a5x0/AeOElEoV00sWoQylltzCzp4XSPo2pnb+WKuKOWHexCYDXP zQ886760tRcq7IsEjdPcAomHlEoiJGo6dMF5fz8PaTzRL/Qxo2OrffIowPP+BA/EzNTL gyRFGPEI9ODRdzrnrp2I5SZb9+BcmeV8vsoJ4wzzWxRIMls7OfqCIMpr9iyyM1NEHnof xcAg== X-Gm-Message-State: AC+VfDzxERy1Ag56yrX0rvKtsoKgSCSJCxmcPUP5klV3Xy4nmKYsKBJh +d2Pnt0vCk7aeJTDz9ZhTaxJbdby5pjlWqE1UU0= X-Received: by 2002:a05:6102:3a44:b0:430:2b7b:a4e9 with SMTP id c4-20020a0561023a4400b004302b7ba4e9mr6014224vsu.20.1684951288614; Wed, 24 May 2023 11:01:28 -0700 (PDT) MIME-Version: 1.0 References: <20230523223944.691076-1-Kenny.Ho@amd.com> <01936d68-85d3-4d20-9beb-27ff9f62d826@lunn.ch> <5b1355b8-17f7-49c8-b7b5-3d9ecdb146ce@lunn.ch> In-Reply-To: <5b1355b8-17f7-49c8-b7b5-3d9ecdb146ce@lunn.ch> From: Kenny Ho Date: Wed, 24 May 2023 14:01:17 -0400 Message-ID: Subject: Re: [PATCH] Remove hardcoded static string length To: Andrew Lunn Cc: Marc Dionne , Kenny Ho , David Howells , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-afs@lists.infradead.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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, May 24, 2023 at 1:43=E2=80=AFPM Andrew Lunn wrote: > > The other end of the socket should not blow up, because that would be > an obvious DOS or buffer overwrite attack vector. So you need to > decide, do you want to expose such issues and see if anything does > actually blow up, or do you want to do a bit more work and correctly > terminate the string when capped? Right... I guess it's not clear to me that existing implementations null-terminate correctly when UTS_RELEASE causes the string to exceed the 65 byte size of rxrpc_version_string. We can of course do better, but I hesitate to do strncpy because I am not familiar with this code base enough to tell if this function is part of some hot path where strncpy matters. Regards, Kenny