Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp704245lqp; Thu, 21 Mar 2024 12:57:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCURk1bq5JGBX/xnx6xgi5u8Yeat7zUzJ0DEWjsILtxEbObEew2FSiur3JAR8lkHYNSPSmNT3Ea7OdWipz1hd/hHzMtNMSNVtTJbhnKgcw== X-Google-Smtp-Source: AGHT+IFkgS8O6B4KQNj7vvw4tnhYABs8dreRMu5ZsG7ZhBQ7Q8Dx1V50lVcapevGLGskbGGMEn/s X-Received: by 2002:a17:907:9809:b0:a46:ef14:7d76 with SMTP id ji9-20020a170907980900b00a46ef147d76mr374058ejc.12.1711051069082; Thu, 21 Mar 2024 12:57:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711051069; cv=pass; d=google.com; s=arc-20160816; b=uRdP1KekCz/wcMC+NIvWOQhfnmYA0hPEB5szxcRnj627rWe4BX8z8U6B2ZOb/Mr2gA aoIgDEA5d9Wh5VYMqo346njGkouygUIlzcSr2mdnYYG5tunKmeG5gAHtJBRiI62dqLz+ GUUzuQDxgP4B2GcS4Wv/ifG3hPVSV8mjbYWvG0Q+ZNOXe004pcRU717GLDQAnagDQb+P rWiOAuBo/SN1RB663WQDQv4mQIxsRIEoylq06jnmRhRJ/32LD9zWaIJNDPvYU6OQCoJ8 hxQnGQet7+w5Z0GEfLaORqCf2RFytg/VZfZhEFbzJKBTL0GCGGNDTlR2KrHLewTvYkxb vyLw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=ck9XtKTBgRiwFDSQngG8cInr2uoxIAAWioBX8TmAnyo=; fh=y2sfmCfXiQ9Yk0Su7fLbYFWsGGarh6gND0MakL72+Ls=; b=tGvS348RpwND4Oj2gHMDUrsY0ywGNZpKthEzAHNTRikNim8CJWDcJe1qdgOjctv3yq D9PDuFVZ30L3MRUWvlloAPa46vrq8yRX1R5k4w7CRDCKTz9IYb4pnDNfDDWJVBSAM0aK X7zChJmF878AzWGtGrS2Nx7CK9e5KkbjdY+5uxMixoF5xC+QVenVbAquJPr43DXZvwAm /apG4eEb78uQb6fECqO4zlB8cPoGnoIH1RhYXG2kMAXJMMaU9dJi3NcwVDAscWk1GYhS VRyFBOyoZan+gijL8hXJCI58D9lbOao0LPGlOPTxk/2gmkyBmLo+Ke6l6bZhgdfHpgjZ YEqA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=EUKc5GZ0; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-110620-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-110620-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id bq14-20020a170906d0ce00b00a4657faa831si207115ejb.399.2024.03.21.12.57.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Mar 2024 12:57:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-110620-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=EUKc5GZ0; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-110620-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-110620-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id C71BA1F2232B for ; Thu, 21 Mar 2024 19:57:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 70CD113443A; Thu, 21 Mar 2024 19:57:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="EUKc5GZ0" Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0BEDA86254 for ; Thu, 21 Mar 2024 19:57:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711051057; cv=none; b=oTtmi2fLteEfLnKXA6QMUWc6X5kOpVPQdJ6vbd+1PjOStzprKf3lMK4+S1+itrEbVQYPPKiT2ePbM7AEb+f6Do8KuZwKNgWg8tQWy/+wziQL20hOiE4O0793L995lW246tiYeZejm2wnas3/N1qzUbMzIQsNUDtHL17qwtV6S6E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711051057; c=relaxed/simple; bh=ACQEgjHXrHrKmVUN1e84w9K08GUoD7rvTF7AzK/2oLU=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=cMeHaGdMZ074F1jUJYTPwGabvTNAi+mno/+CPknJQE1MZmGQp2yk6LHKluH+fi7EPBK1niTNqw57A8T+eqS0nz73c814xEiOxXsO16mhE3kyUT+fhFT6mqFXOWb6oW0IO63MiS7OssFujlGbSyPdImJIRmrMsWr8JruWT5rAurw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=EUKc5GZ0; arc=none smtp.client-ip=209.85.167.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-5101cd91017so1583629e87.2 for ; Thu, 21 Mar 2024 12:57:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1711051054; x=1711655854; darn=vger.kernel.org; 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=ck9XtKTBgRiwFDSQngG8cInr2uoxIAAWioBX8TmAnyo=; b=EUKc5GZ0tCVMydYn4Zjgc59pIQW6FtI3oUrKP4tTiXmoc4Wf7NYzII4ZrHP4zdeKJP 4ztu6DX4lhWEeF9WTMioGrhUhtLIhYI/UZNeSY4V1BsqVecn881JdG71Cw1ORYnXx7Fw oozS2IzoiNesxe8stXlvIE93EKHi8/yS//19piK1S62M5nZQzuU3dBLCTxQSDez193lH zvsmtvlnqsMAjDRwaLkV/PKjSmPuGJgvGip9fV1lw+tkxMPjyqJuhViNWrureVqF/B1p BuGryC1FS8bW+O2zzKxHesVlgNNFZFKur3Z/HSI8JAPbbVxYnSeEPQnkMabrmvCrn+aN txOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711051054; x=1711655854; 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=ck9XtKTBgRiwFDSQngG8cInr2uoxIAAWioBX8TmAnyo=; b=JI+X/vLr4rdZIdcxmpqyoIbT4GV4W5G0T9TYeSPMX6nog79S15Zh7x5A0t5ZLhmZ0c wB/YYZF6LpwtJVxo7lJKp8Mk7rccxZgWH6Q0EoYcxUCXWLurIrwMALx6yRvk11LkKlF+ 0l32LxEFmaWarE+o0KPd9lgIl1wbQTxHLTqvUpSWBq/2dRF7trfZgb11ddWXUv8eWZGw 06TB8M+l/Ti52+mwwCUEkT81ZnlHk+fzjKLlB0e1pcdfgKmPPrKAwiEEr+ycUAkAVL7T 4hNyVEIkyIdwx0MTS/2AVyxWKqQ0BiYgRuZuBTQDbVO247UMD4/iilvwRoFKcWwrNmug iT0w== X-Forwarded-Encrypted: i=1; AJvYcCXElDw6S3NYjQ8S722APHxnm1ewBHBx2miYD1Bn1311EbS0uTtx712BcIhjUpKAbf4NW2wEKzEqL0PNKNIkfl1j6fQ7aS6X7SMJan14 X-Gm-Message-State: AOJu0YzDPxezKoEYKibvVaKAt+WgBcbcpGxpHZVe7olaQDg5I6gS2a18 LVdgDu8OnmKYATxgyOHnC2JoBWQocEYSVWEf6V+j7g6GklVY97DHXQtwmJNEO/MD2BqTFjiC19C bJEqkTA63WS7ry/hG4yFUybzaVAuTTPDL0j8Y X-Received: by 2002:a19:ca13:0:b0:513:da24:fc0b with SMTP id a19-20020a19ca13000000b00513da24fc0bmr247849lfg.33.1711051053968; Thu, 21 Mar 2024 12:57:33 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240321-strncpy-fs-binfmt_elf_fdpic-c-v1-1-fdde26c8989e@google.com> <871q83eepl.fsf@email.froward.int.ebiederm.org> In-Reply-To: <871q83eepl.fsf@email.froward.int.ebiederm.org> From: Justin Stitt Date: Thu, 21 Mar 2024 12:57:21 -0700 Message-ID: Subject: Re: [PATCH] binfmt: replace deprecated strncpy with strscpy_pad To: "Eric W. Biederman" Cc: Alexander Viro , Christian Brauner , Jan Kara , Kees Cook , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, On Thu, Mar 21, 2024 at 9:23=E2=80=AFAM Eric W. Biederman wrote: > > I am perplexed. Why not use get_task_comm fill_psinfo like binfmt_elf > does? > > It seems very silly to copy half the function without locking and then > not copy it's locking as well. > > Given that the more highly tested binfmt_elf uses get_task_comm I can't > imagine a reason why binfmt_elf_fdpic can't use it as well. I am not sure why the original opted for strncpy over get_task_comm but I made the replacement without being aware of the literally identical code present in binfmt_elf.c I'll send a v2. > > Eric Thanks Justin