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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 252DCE67808 for ; Sat, 2 Nov 2024 20:05:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9CB086B0088; Sat, 2 Nov 2024 16:05:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 953E26B0089; Sat, 2 Nov 2024 16:05:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7F44D6B008A; Sat, 2 Nov 2024 16:05:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 603DC6B0088 for ; Sat, 2 Nov 2024 16:05:12 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 03D24814E4 for ; Sat, 2 Nov 2024 20:05:11 +0000 (UTC) X-FDA: 82742233140.23.6FAD9A5 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf20.hostedemail.com (Postfix) with ESMTP id 5DA341C002D for ; Sat, 2 Nov 2024 20:04:33 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=gmSPfQO0; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf20.hostedemail.com: domain of kees@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=kees@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730577853; a=rsa-sha256; cv=none; b=bvWJRgP5fPtrWiSfOMRYmaoWVG3peP0dEFvyW71k33pu3HyYL+SvMlYMeORWcbZsRPfDyE Su9R9cbCIenyj0bgeBDd/DsWmOq4jwrU3wShpO8iUd61WQLUYbpPiitRFkgpRqk7/I4/2e 1p+aFUzU4HQ4G20bMf+fKLPnN0EGOlA= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=gmSPfQO0; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf20.hostedemail.com: domain of kees@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=kees@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1730577853; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=9LQEwugKk7DT5aUFREzmMj8SmRTJ3Ko7yBDbhTETBD8=; b=8PgXeYGSmeH+YxWzRCsXJFEmy0sJ1t1GyFsUHJrZVBN112IVMc+fnE5B4hwrOWnb12mbCL mD7xuq9sUc5EMWOdwnjAS0iTlHOVSUshUrStum8dVYLM1fMTUknwK75rHHkse8QdSCDwnO WTPEMGEW4j2i6o48glNBV+jxyta7j9U= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 4E37BA41501; Sat, 2 Nov 2024 20:03:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C267C4CEC3; Sat, 2 Nov 2024 20:05:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1730577909; bh=og5/86guEHpjoFP2YlMCVaTKnP4xAWzMQlf3A7a6Eh0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gmSPfQO0EnQiXyPxCzWf85/qh/j4fXOnbVG9PJS6Q70+5R/nwUA9NnByvjVCjVv2c s6uLYR+7f6FUoERsA+YmpJ5qcmMNf+WUiF/8z+iuuHky99enZ7zFIreeQeAIA2yzTn opKFirQHCJnpEOu/6mBb5oN8NROhG5ZBHkCWUZic1QXnIQLKs3cuXM0C3MU+rFx3S8 uHjwNDC+uSi7TqqizPpTaHyaUhnhbN2w9ln7Odjd1lpu8z49Y1C1QoJ+mXH8UtD2vQ Wzn7vCnh/+ztxfpVCq7uSQlj2ti58EizeVcFSIChP69d4mtB58Y0etWuchXlWsqsuj X3KdKFvHcN02w== Date: Sat, 2 Nov 2024 13:05:06 -0700 From: Kees Cook To: nir@lichtman.org Cc: ebiederm@xmission.com, viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] exec: move warning of null argv to be next to the relevant code Message-ID: <202411021304.1B1E0DBD@keescook> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspam-User: X-Rspamd-Queue-Id: 5DA341C002D X-Rspamd-Server: rspam01 X-Stat-Signature: 79ykuz5twwsu6nzyh165ub1f3ztukqgd X-HE-Tag: 1730577873-908731 X-HE-Meta: U2FsdGVkX182Exyz2d5VxWetL7csRfqk6FbaU1uJnp1ofJ3xHQSciisDjIr2xrDhmsTBHEjJTgZUmoNrzU7I13j7POQsK9fZrpKbTFAW5MZcxI0KD5II0BOPxX6judCjDYxUN9qSG0N0hGIka0t+wq3hdJ21hhMifgFUhJp0rpzknPZ1Zxmm50qVfN8P7lxRmfyO8rGCVcb5idnR6wNZ6VG73Oq6XFEoRnne4PAsHMKBs1WDWUEDML0+/TgyCyM+zAaS3wwai7auYL4wp4XtjkKwApHF1mfn2lIDxJZYSyflUXEROFN4R6T3J2VZWDEEz3WKx4giZJM0PjfLA9sy8KkoPuSkNhprKtu+FD8gP+GmLtAjvukEwQjk5n0JOlxRgPPBvn4FY2zxnLhkyDobD5W/gsHeM9saR3jkxVmQjuxur7N54RpXcaRsL3IUPARZfmsteQqN5KaGYI3zLMhTxT7RdqNl5hCjmxOqibKauzAJmjhTW5n5qFsPzuEfb5U4/L0Ab2ixLABDNwrgtx2oKt3kXhZSSC15+UnVuJznvl8uLegLEQNUzKy7LOBbhAWedzhuzS+fsFClP6eTZg7R2OPYR6awhPgfYkDpJEtLJuDzAYwElwe3ozRLCnWq9BOsW2mLXtgZwLYn20sZtLEMawgDdfLE0fypWTSGVQcAEQlJgFqIaD5I+924sY/kaMtxQLkVz4+hN/QNeT+1b4dhA4nMpalP5YBRvdIfqWNsAVK0PXcDmCwxpZlwofacL7g2e0EoOybBgiuN5biDFKnunkXuC/tYsE8y+EWEAK+3UZjfgEC0pmH9uuRoXp8r5k5HqSYr3YXY1LLmKBcuZDpyZLuqF7ree/jSrQbIIoirIVxIsVqYocuAQ3FB55RnfiEoQ3KG0ah+MPmz2ObLgcD8T2qUTJpeqfM47jWgSvx9yNOEuwC0Mnr/Mf2G9QQOP0sxGjxsmnjfKFsjcsLCjBN aAnGVou2 JPuKSEH+He7L2Wxpa4uZfo7AXXZ2laVScUN7AqsuZApZ6pWgq34mD14dHxjJTIP4Gy+bYYMugwJpRsSD1OqHXShujt9VD+wtC138Ts3vnrGG0hD/u+jL4/xUS/zZ7tY5NmsFnFS6Lq+TqHQfPKxZOSuIRLylckSnKTMKfz7XbRcIwlM7Vyq4MkrA7lBldGg+U9bu9Q8MEtITFkF+AxWduLQGRs0PxWUH9ur1jOoZVbucr7LsZyuZkwuXdQi8QASvIY+ogPuJRHyhLBTarvkyoDGuK9xMJs6+mlGnI02Glcdjcvpx/Da0jPWj7aoTMv2EkBPoZEE74vbP/4yr8I2lFsIpkpw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Sat, Nov 02, 2024 at 02:01:22PM +0200, nir@lichtman.org wrote: > Problem: The warning is currently printed where it is detected that the > arg count is zero but the action is only taken place later in the flow > even though the warning is written as if the action is taken place in > the time of print > > This could be problematic since there could be a failure between the > print and the code that takes action which would deem this warning > misleading > > Solution: Move the warning print after the action of adding an empty > string as the first argument is successful > > Signed-off-by: Nir Lichtman > --- > > Side note: I have noticed that currently the warn once variant is used > for reporting this problem, which I guess is to reduce clutter that > could go to dmesg, but wouldn't it be better to have this call the > regular warn instead to better aid catching this type of bug? We try to avoid having trivial ways to allow userspace to spam the kernel dmesg log, so pr_warn_once() tends to be sufficient to catch this relatively unlikely case. -- Kees Cook