Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2156801rda; Tue, 24 Oct 2023 14:19:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFzdXDXFWv5KnvlzgTag+DAuvogQORNaeZcTU4+LojwjHetJEg3oC4AM7lyR/4Zl+NNFQiy X-Received: by 2002:a05:6a21:3e07:b0:15a:f4e:620d with SMTP id bk7-20020a056a213e0700b0015a0f4e620dmr3537505pzc.4.1698182362498; Tue, 24 Oct 2023 14:19:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698182362; cv=none; d=google.com; s=arc-20160816; b=v9D/SiV90rx0U5FwuugI+jaCDHyE24fsXh9VI1fvRkOfGyERAdkAuyZqCe45JCiXiO C11/Yrx5E6FQE6nwz+HPczOYfK1erueJsrubdj7F/V5jaJgvzmIbBEkn6bZiUrL/2L1h xXLfvbwq3uCgTpYMdUdEoUrv2+X++0F0sR2SOzdThCZFbRpGh1bLQDzodfhcGEQVYXg1 owA/yMezEuo9RYho3bjUoqET7cbkgbE/0UmSa+2vlzj95bpb6P9rE1Ty2nljD9OfAgH3 NOkWjvT+8k4035WVuOqpVT7dQtAig9+Ci1j6e3/MZEtUcjme6kwGlSneNkVVGcwgOi6W Bczg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0bKh+O/PANGlG/qak+LU04NiuPPv63eV7oLEVO+FPPs=; fh=ECm0sWxuqPMPJrOvbl8BCdoHgHcK7uYeFF2VkdZd0Co=; b=g3BHyEeLPfERO6dmytLQvEyej3qIc7cTWvpuK5as747vKU8krQQB34Fm337zcYSSz4 Ni+nmtsBm3dNjAN+CEnmquLhtwZ3bbeJiGqSHXZ2TbXxgxOGmCtsH3XSq+gOG/l3Zgn9 eJSyw4Y55m6X7oaZJPCgI0Cyq5M5Q03H9XKD4DM99MGGET42juE6lX5aix9ndDGSgLdX XVaBe7MXD6qhXpqXwhb9vcNaoM10yVYk0HfP3RA/CeBMAUl4dhnAVn7yfxu5uj7h5LNr /fcYDzVFp0xT/Qfoe8PWvGxWDzC1gI0Fk0Y2fn6yNIAvhk/2eOEMy084d3Jvxtl5dyPt yc/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Yiof7WKc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id ck20-20020a056a02091400b005b01279150fsi8752344pgb.528.2023.10.24.14.19.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 14:19:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Yiof7WKc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 6EEAE8028A71; Tue, 24 Oct 2023 14:19:21 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344338AbjJXVTS (ORCPT + 99 others); Tue, 24 Oct 2023 17:19:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344348AbjJXVTK (ORCPT ); Tue, 24 Oct 2023 17:19:10 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E37C610DC for ; Tue, 24 Oct 2023 14:19:08 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6b497c8575aso4922966b3a.1 for ; Tue, 24 Oct 2023 14:19:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1698182348; x=1698787148; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0bKh+O/PANGlG/qak+LU04NiuPPv63eV7oLEVO+FPPs=; b=Yiof7WKcSesV4TPDXHLle0fc1vLms8bvGTLEUXUyHxmwaVh9GnJqYmfcIOgvz7QxF4 jpJIwuNbY1FGCV/N9DetRk44AUYSTUJ17Tm8e5ScyTI1Vpi4rjCVGLSASc37+KyzuBD/ 5RkIKUfKk03Fx8si3MPfiTSQm6+3Gx34ouEH0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698182348; x=1698787148; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0bKh+O/PANGlG/qak+LU04NiuPPv63eV7oLEVO+FPPs=; b=SjdvBAtN1CZSpR75imdxfQsM6DWP/y3utf+NbMHJ3UX0ThdnwnkWyYpEJ0b3ZfJ1fJ k+3GRRZf3dlQmjwk7R66mDS5WZYyTIwWDyHm2vYsMn1OUPDNxvF2NJoEMi+q0m3n04PH rGto7PQIftgb1mIZuqOWVCmNT1ljTAljZRDJkInx7Eme/BnqV4HgT/VjqO6wLG4FZwls 83sruCYJHWfi+c/TkLCd2q+q99rH62gfBdZeYIwe+LFEsT+DjASIm9T4wYV5VTODyc88 k+1Xwyv6H73f3j0SlWSqJe66M9NwFnr4pH5+gz2ajFV+7YvFn4zQzipy6yE4eOcCP5MB y9cQ== X-Gm-Message-State: AOJu0YweWLa+HHYAATyWSpd2inrAW+fq5nwCurrZdAhkQ3t1ye/TBZPu k9xl8AEDmmA43F70uSotchxEYg== X-Received: by 2002:a05:6a20:3951:b0:16b:79b3:2285 with SMTP id r17-20020a056a20395100b0016b79b32285mr4216060pzg.56.1698182348320; Tue, 24 Oct 2023 14:19:08 -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 g12-20020aa79dcc000000b006b24b99afd4sm8349691pfq.176.2023.10.24.14.19.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 14:19:04 -0700 (PDT) From: Kees Cook To: Alasdair Kergon , Mike Snitzer , dm-devel@redhat.com, Justin Stitt Cc: Kees Cook , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] dm ioctl: replace deprecated strncpy with strscpy_pad Date: Tue, 24 Oct 2023 14:18:51 -0700 Message-Id: <169818232969.2100071.3919289615593947459.b4-ty@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230925-strncpy-drivers-md-dm-ioctl-c-v1-1-f0bfa093ef14@google.com> References: <20230925-strncpy-drivers-md-dm-ioctl-c-v1-1-f0bfa093ef14@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit 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 autolearn=unavailable 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 24 Oct 2023 14:19:21 -0700 (PDT) On Mon, 25 Sep 2023 06:54:51 +0000, Justin Stitt wrote: > `strncpy` is deprecated for use on NUL-terminated destination strings > [1] and as such we should prefer more robust and less ambiguous string > interfaces. > > We expect `spec->target_type` to be NUL-terminated based on its use with > a format string after `dm_table_add_target()` is called > | r = dm_table_add_target(table, spec->target_type, > | (sector_t) spec->sector_start, > | (sector_t) spec->length, > | target_params); > ... wherein `spec->target_type` is passed as parameter `type` and later > printed with DMERR: > | DMERR("%s: %s: unknown target type", dm_device_name(t->md), type); > > [...] Applied to for-next/hardening, thanks! [1/1] dm ioctl: replace deprecated strncpy with strscpy_pad https://git.kernel.org/kees/c/0f3f34ea3798 Take care, -- Kees Cook