Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2872786lqz; Wed, 3 Apr 2024 10:54:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUB9IeCNjluyOwDIQJpcNSR2BhAuSzkKnsWZLKrncEMRVRvfQhz159JTOZQKI/sgdfEvYmIqCPEujTqWWbrUtlvsGCT4GMPk4f7epbzCw== X-Google-Smtp-Source: AGHT+IEC3Q+DCnpr3vZawNYgvxd6GHkqCjgBlck0vV7zI5zURkEaKEqOJnw4tQvEerlF7WCNh/P+ X-Received: by 2002:a50:9998:0:b0:56b:d15b:6dc1 with SMTP id m24-20020a509998000000b0056bd15b6dc1mr104455edb.23.1712166894906; Wed, 03 Apr 2024 10:54:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712166894; cv=pass; d=google.com; s=arc-20160816; b=drTCoW6OUKJevbwBROOvA4EaqSaToN8bbgvcbUt4qfj8Ey1kYdU5u24zxZatMqTTlb RlhY544Y9AM4gce1Ot/zti/2sQQKE5A1zrDIZHVFSBxR07tpk1zOobeJ8bqjO5rXQCX3 XAGBZJyxBKhw6oWuVDgJRkK+BvDL+jrZEXsTpnZnW6TnmFBwVJ8DcvztInzwI8KCqxQO rJ5ydEZhRNg39BV9Td4zmYeQEd//1WZlhyiFhhYtNaYZX6pIFuN8fGz+9ljN3fw6r6cv lwL9K5YXWJ0eyBgFEEOIoRUkboNtSSghgd5xDDDXekXoIKTjDeERfZFTMZpzMKgLddDp 0tjQ== 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=JqrURadVh6bfrB2uLbLqnbQWG9RW9Mp6NnYEctBPd/0=; fh=ZbbF6qZTFyfMNDp12ZTN2Qau/ZPPrVUXDxLWvEKqiV0=; b=g4xtDGlEVU7+yZ9FevzxjM3luETZrCuqwRElu72XFQdRWF4geRUcjav6pNKKiBE4eO q/vQ2h6PLLlCKxdvKexpGiIe7gfY+pDIVu539pVZOI0eyaeWjIsh/tTGoTxaqg1OHeZj pI87yW/ln2KPzqOA20nPXMM87o2kzzY6q8CDvKlKpxZ0OoeBSvbds3E3JS3CYZ1dnUF/ rofAigdXfyqhZWVV3bp54+sI6yaL/oXm56c20odkGgEz3S7gRiQUz4WrvpLsTIMBFYHK q/8YZWr1ufN25n6u2One6Sb4NniN88j2DHGYwywEcyd+xGehRMn6tyEpBhHOgk2CRPp7 uKBA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=OGC9k7vD; 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-130389-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130389-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 v7-20020a056402348700b0056def6999afsi1929213edc.314.2024.04.03.10.54.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 10:54:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-130389-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=OGC9k7vD; 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-130389-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130389-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 A0E1D1F32663 for ; Wed, 3 Apr 2024 17:54:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 71A98152DF0; Wed, 3 Apr 2024 17:47:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="OGC9k7vD" Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) (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 2105C1DFD6 for ; Wed, 3 Apr 2024 17:47:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712166426; cv=none; b=jWfDzlawL/oLTWLLAr8cM5pfCvnJgFB8+xJ/JjwHk6rkAw3Zb+T2tqDNlq5xejxT8YcxMsoD/wxKR9qnqacDpaZ/fsok85WZVEFcNZjw9XUgWI45kHFClBlAFyVlA9JkLfg8xb9tgH1Gts9JuvAONioIoPRcrBRsMiCf09UC9q8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712166426; c=relaxed/simple; bh=2JeOLqt6iFkrlIcYwbpDrQbQoAoYiMHND8+3QmCr6qo=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=CyJRRj6gESwwrGzw72bfMIcU8i+Y1gjTJrwSKQSAFk/hoDJQ874JNhA7+lxNlFefUv0aIjv9KNELkpY2ZGozIFdG2wQCHhVwf09BHLgcedozcAP1GJml67GqEl0YKVb7VNpp/S6HueAOmAvQC8ZuJnBvhb/wynHSWm1leb2YkV4= 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=OGC9k7vD; arc=none smtp.client-ip=209.85.218.43 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-ej1-f43.google.com with SMTP id a640c23a62f3a-a517a492055so21205766b.1 for ; Wed, 03 Apr 2024 10:47:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1712166423; x=1712771223; 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=JqrURadVh6bfrB2uLbLqnbQWG9RW9Mp6NnYEctBPd/0=; b=OGC9k7vD778aAa5ZsyGKYQntGnNcYoEoBo0bLXUPQh+y8Q24/HMc+w/8cVM46cO3cp ugV0wo+hwY99pD2rNxKVxO6+bcs3uRDkgzAr/4Rv2VFZ8ZLaviYJNaAYgmgSPJwIHHbq R2oeNe1n01wScP3PJp1fxu/ALO09Z4tZDg0+ESDcpP9TcQHxEY/21lBiuPTi8vZVoR1U 9JLDo4ZKLEBhAy7oWG9vxkFnlVRSa6nEBQ8eZFC7DFdjQFcvyZ2jJvdtxCt0QyfkzUhc rb0tTcLeUi8xHnUGE8vRogTTwYBTe5yRV6NfFj0IqqpI6F646Kb0ov8zcvsz4+prUnKd 64WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712166423; x=1712771223; 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=JqrURadVh6bfrB2uLbLqnbQWG9RW9Mp6NnYEctBPd/0=; b=l8guc1bKZ7mrtakRRAR+vPx0NXr6P2aYoupK8LziBeXTsHRfr6bYsxXgfkqwps/tIM LfF4lGlhlGfm/F5QyMgsi7lZ9ICDTfiOhwpjcmVx8ac2imjUpNzeReTmelSJSTSilfyN +egyro0dTU+/lkWFLM+kzfax9ULyOTgz5lmUQjJSGA0cJXhzlyn/Xt+ronxLezten5+v cGWBK5Fx0lVFnpH18LmCcbRqQRza+CTyV8P0XIcCSl526Fiq0TxeipTpLhaC9IF9NNTx oNScBmTl28p9fmxzgLt+hSqgd8cZ/NfT0RY0USJfd7228M6xSnBBKU0CofA7z5gpYj/M kxIQ== X-Forwarded-Encrypted: i=1; AJvYcCWcpf1LfAaH9HFA2KHYtcJclrtn8IyYbGZf8lJu9hFM+RIDQCjl9eGaSAUVvV1AaxMN4jsFbiPM90M8kr7/7ioW6uW0yLlGNgqYBSx5 X-Gm-Message-State: AOJu0Yxs3+oo2chsKK3JJc7khXVALQEKsQZiO2E6hl8BWZHJeYBvSjed RGmxbPLbzZEPW0mHNobxOIHj9UK8tPYOO1rkcyR7rWZmPloQ0VtowKuSpSkgLr+2ocWRwBcPsC7 iYPAQxpcd3km16kn2QiyStwyx2HZvWLhm57lCOt6ggaWrXJyHDxUK X-Received: by 2002:a17:906:aadb:b0:a4d:ffcb:1f4e with SMTP id kt27-20020a170906aadb00b00a4dffcb1f4emr11402ejb.75.1712166423477; Wed, 03 Apr 2024 10:47:03 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240403-strncpy-kernel-debug-kdb-kdb_io-c-v1-1-7f78a08e9ff4@google.com> <20240403112336.GD25200@aspen.lan> In-Reply-To: <20240403112336.GD25200@aspen.lan> From: Justin Stitt Date: Wed, 3 Apr 2024 10:46:50 -0700 Message-ID: Subject: Re: [PATCH] kdb: replace deprecated strncpy To: Daniel Thompson Cc: Jason Wessel , Douglas Anderson , kgdb-bugreport@lists.sourceforge.net, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Apr 3, 2024 at 4:23=E2=80=AFAM Daniel Thompson wrote: > > - strncpy(cp, p_tmp+len, len_tmp-len + 1); > > + memcpy(cp, p_tmp+len, len_tmp-len + 1); > > Roughly the same question here. The original coded is obviously wrong > so trusting it did the boundary checks properly seems unwise. > > Are you sure it is OK to make this copy with checking against bufend? > I am going to revisit this and find a better solution. Thanks Daniel. > > Daniel.