From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8BAC9C77B73 for ; Tue, 30 May 2023 23:17:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=siDyMVu7QVlPfy+o7FqYloQSH+9W8BtjMUVWwUnmeK4=; b=p+JEH2N17a4rNd LkbNog2qMEZ3MklwGbRLW+X9eeOLGio8D3ZMZqwA6+3JQW/EE5F5UISvHeXikt/hn2XLgFwQFVXHn MT8gaTvEKY3TOMoYKfBOEGY0ngyrU4vgVofRBSlasdtwaA4oZfCEGepeFhN4TgsrTqSkSSyWMSJBW akIQJlhmXwDlSXOxRo1iCMNwt6m7w+z37eflTk3VfM0xJkqfXKKY8UaqE27CGi2aXQQ3uzPSGG2+U 3HdCvxaCfSg+PQIb/18KT9ChHw5TqwKHVllq7hSmzY1M0duUu02KPOl9H5nVGCtM4ZxxK/PxbRFam ACRcx2KrC6Fu/D2PSSfw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q48an-00FS69-0S; Tue, 30 May 2023 23:17:29 +0000 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q48ak-00FS5K-1C for linux-arm-kernel@lists.infradead.org; Tue, 30 May 2023 23:17:27 +0000 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-64f47448aeaso3740261b3a.0 for ; Tue, 30 May 2023 16:17:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1685488643; x=1688080643; 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=On+FQfGbR+8Ii8Eys7nptg115kLyMdrhpZBqAuKx0+A=; b=GKpRmVNc9L0TDMOju0I9bvnRlrNJw43AMPsnzVHZeEP1yyQVupwi+w0ysa9vUvyG6/ wcig/og16wFMUHJjuRIvwyV+SCZK4yqf0UO0xpsIxJtMBpSQynjTHvJNeVrJq+9ElFg/ +BdB0zomT3Uypxw6HssDmild0/uud4HJtR5zA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685488643; x=1688080643; 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=On+FQfGbR+8Ii8Eys7nptg115kLyMdrhpZBqAuKx0+A=; b=EU/WUyKJXWX8XJZvT/CO1Z6G/x4Op/f7tRoHJ1vcY8GlXBip0xUzdOsiqqVTFQ5tcv mXF5zQHwKXQ2oF8x+Jd519JfyIZBj7fccx9STAQVc26mVyI0DqMTBIkMTqg+14VQbZtk 60Ovrooshj+MrG2QYAu71AYgCxXmBfS20Gf9pkzsbdhYGQpWi5R7FJfat2bh8ar2DIZW Qh8BY492n4h26x+HqYmvtJqjqGXT1ODaR8nABmabk8XckS3Z+iTGjCQQfet2uWA59Oma PnDjm0Uw9Rz3lKQ36PRmn4L5Q7BJWvry7sw0cwn3M0YGFU8ZVl3WmxxAjsIi3+PWl1GY BKbQ== X-Gm-Message-State: AC+VfDxGkuBglhG6qcS5whuJItJM+C3OPpG590OXf8A+L0450dNxKaLY S58Qup+Qwf+fJkOKttvZv4a4tSEEcKJSxFcK2+Y= X-Google-Smtp-Source: ACHHUZ7ko2RUUKseYSndQOTaEGaqJHscWF8CwX3Qf9+d+6/JHqGs0Dfy+X614hMfGmWpEyOaxb/iZA== X-Received: by 2002:a17:903:32d1:b0:1ac:7260:80a7 with SMTP id i17-20020a17090332d100b001ac726080a7mr4793068plr.43.1685488643322; Tue, 30 May 2023 16:17:23 -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 y18-20020a1709027c9200b001a9bfd4c5dfsm10741486pll.147.2023.05.30.16.17.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 May 2023 16:17:22 -0700 (PDT) Date: Tue, 30 May 2023 16:17:22 -0700 From: Kees Cook To: Azeem Shaikh Cc: Russell King , linux-hardening@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, "Russell King (Oracle)" , Linus Walleij , Amit Daniel Kachhap , Ard Biesheuvel Subject: Re: [PATCH] ARM: Replace all non-returning strlcpy with strscpy Message-ID: <202305301617.FD31A8E9B1@keescook> References: <20230530155501.222213-1-azeemshaikh38@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230530155501.222213-1-azeemshaikh38@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230530_161726_411019_F84C33B4 X-CRM114-Status: GOOD ( 13.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, May 30, 2023 at 03:55:01PM +0000, Azeem Shaikh wrote: > strlcpy() reads the entire source buffer first. > This read may exceed the destination size limit. > This is both inefficient and can lead to linear read > overflows if a source string is not NUL-terminated [1]. > In an effort to remove strlcpy() completely [2], replace > strlcpy() here with strscpy(). > No return values were used, so direct replacement is safe. > > [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy > [2] https://github.com/KSPP/linux/issues/89 > > Signed-off-by: Azeem Shaikh Reviewed-by: Kees Cook -- Kees Cook _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel