From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 D93FB3203B4 for ; Fri, 22 May 2026 18:48:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779475692; cv=none; b=RzwdZgtpd176z81kN0HQXaALqkBn8e8qp/NzjKwgFoGfgLonCe3aN1hGOLpeEJ1J5jzNMJ527vK7DP84NA9MhlJRYKplzWmNTlhOWIIwoT4fbtHPMw/cxbP4scGsC8dflSTfhg0gahpqm8B7BO5GWpGVyHfAiirSUDc8vEomya0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779475692; c=relaxed/simple; bh=h2YTXKrGFFwGiJXcDJ0pNcVyOHBnHJg+ap0Kbs3337Q=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=p4/XB3cRoQ9pvDSLVXJEeGwqNO9zY4I4XyZ2rIdyRBGHqVQbb1w4genI50gpbjykLQtUlsxUMBxdXlU8bhJtE2rVkAXXKtSkwEpgJJ7yBoUBjBqYhG/CmxqzgPTFQp5QQzrqBz4Q3I6cXhYIVqPg/5tUzdmm2REwKMUq5I5yLzQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=RZtzQvus; arc=none smtp.client-ip=209.85.128.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RZtzQvus" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-48d146705b4so81880075e9.3 for ; Fri, 22 May 2026 11:48:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779475689; x=1780080489; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=e5m2IXHY2xtrF7YVXx8FR4FsXn8Pn+O6FKHwnMZQfXg=; b=RZtzQvuseUH/xWkSVEoxbw5hKz2ZCBY+Cs8LDUdRzVN6xicuIsJ47lT3yuo7AfT8zW wpolr+7cUI+vqU1CgsXv6VWStc9j8M1WbvCWL2YUMPr3j7ndDeXtH2zNssJ+gVPOhqtG U5NE78E2mGXSr7zhCt1TCJR/VbhoeD60glyc1o1BUmvhxYpQ+3vXswzyuDg5vSXIXQVM 6CW8uVm+LKi6rqrSw50Oj3RleWvju7a/CBIzBijauAMDwZvSP9oHdCNyiXRSgFSjyVOU tOS/dGdNOVCHw/QBLWnLZ23bGp3JoSXWvrSIGqIbmO+1SNHa0z0JLu+3yj06JSb3aYWR ylWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779475689; x=1780080489; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=e5m2IXHY2xtrF7YVXx8FR4FsXn8Pn+O6FKHwnMZQfXg=; b=gc/EZQaUHz7sekkm8TkLkdOwd+ibKTYK8VIvM5SwGorm36nykArcfzxzIIjvzGG9FA L/8a4pUV6h3Sr0rZrXryYysit1h75EQwxq5r/aHSvWDMfdP785r/lj0wa8ddihWETobe HFu4bJeZdpD1Ws+m8Jar8RgQfD1wtzVV19RFMKsBm3mjjBo/EudgcntRTWkYIbGTAsO2 5SOrfNuwA3ciibPuFdWTbVi0iZWf+MyY1yeNuJET0/sfluoUgI21Z3xVcmWe6CU0mYQ0 x5IhZbHHdRBvAX1JbZ/KoWGQHHu54WBu3W5MK+vVFRJQwasbSAOBNM3pqHXgSkpV0k+l 0ezw== X-Forwarded-Encrypted: i=1; AFNElJ/xbgF2dLd/T2ElAW5+EG1KmWPKcMnHIfx25+HCj+NO/i8bpwBYRPm5q/M+QK/i5Ffz+bDV+O50HaygrYo=@vger.kernel.org X-Gm-Message-State: AOJu0YzsWkms2jcIGgo/t/goKCoF0PR3muGxmhNEouhE7nshkimkKc0w 1XJrgdvvVNJ+bRu1QhuJCvYDuKm1LYi3Enic3ynoKuxOd+cStlcwex+U37vaBwnT X-Gm-Gg: Acq92OGEjQb0mR3DdmXbF0NhqXtrsC+8s9GXBEMjQo7Vxan28gpmUKtLlYzBgucQ4Z4 /OWot3PYqq+WWD2rxQhouuOaM/bt4gR00nMrromOgpkfgHya54//XxzipU4FUqaKfKCVwuL/Bie 8pwEgrcrxW0bC+yxUWdk0bJmCOegOdt+uYR4niYaO+aQaJ8Lz09x5e/VPu3QlFXBbTr2gNZMsok JMTLGtYYUzX+XNA/2/EM8k4vRNfbonHAo+wiRE9CFB5K3PddjkeMRQqZFwBcL1kaokOrG+zlr8K KNvzpnsNCYsos+K13Ljycx9ZxlbozNr5mjhfH1+dGY1uONCycl+hV3LzCmZrSCjsymyCgbeXxwp eHcCYEjiSRGzZTLfQ+bRUdzJYfl++JkODtLjf2gqIVmU8Kit/9V2NsGw5Kda46ObjjWmEIz9VTJ svFkse/6IYJ6AAQAH92Da8Vr8xpLazTDV8j7EjdXcfg8H3FmCQS78+5gRdqkB3+ezM X-Received: by 2002:a05:600c:8484:b0:48a:906b:14ca with SMTP id 5b1f17b1804b1-490426cd8c4mr72890505e9.20.1779475689187; Fri, 22 May 2026 11:48:09 -0700 (PDT) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-45eb6cce0a4sm5489581f8f.12.2026.05.22.11.48.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 May 2026 11:48:08 -0700 (PDT) Date: Fri, 22 May 2026 19:48:07 +0100 From: David Laight To: Thomas =?UTF-8?B?V2Vpw59zY2h1aA==?= Cc: Willy Tarreau , linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/3] selftests/nolibc: cast execve() argv string to character pointer Message-ID: <20260522194807.4593150c@pumpkin> In-Reply-To: <75da0d46-dabb-435f-b92a-3e2bf465b986@t-8ch.de> References: <20260521-nolibc-write-strings-v1-0-2debb3ad4142@weissschuh.net> <20260521-nolibc-write-strings-v1-2-2debb3ad4142@weissschuh.net> <20260521191558.6e62c6bc@pumpkin> <75da0d46-dabb-435f-b92a-3e2bf465b986@t-8ch.de> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Fri, 22 May 2026 16:39:58 +0200 Thomas Wei=C3=9Fschuh wrote: > On 2026-05-21 19:15:58+0100, David Laight wrote: > > On Thu, 21 May 2026 18:29:30 +0200 > > Thomas Wei=C3=9Fschuh wrote: > > =20 > > > The existing code would trigger a warning under -Wwrite-strings which= is > > > about to be enabled. execve() is specified as not modifying the argv > > > array, but the exact semantics are not representable in the type syst= em. =20 > >=20 > > I suspect you'll have to fix it again to avoid 'casting away const'. =20 >=20 > Where would this warning be coming from? Which compiler flags are needed? > Afaik it is legal to cast away const. IIRC -Wcast-qual Lots of things are legal :-) The problem with enabling -Wcast-qual (NetBSD's kernel does/did) it is makes life annoying when you really do have to do it. (From what I remember there weren't really that many.) You sort of want an (unconst foo *) cast that won't generate a warning when a simple (foo *) cast would. > > Can you use something like (char[]){"/"} ? =20 >=20 > That looks good. However if this issue is real we will also have it in > nolibc's errno.h. There I don't want to use this pattern, as it requires > more memory. You can move a string from .rodata to .data easily enough. Doesn't change the memory footprint. Not relevant for nolibc, but initialising a short string on stack may well be faster than accessing the same string in .rodata because of the missed caches miss (if you get what I mean). -- David >=20 > (...) >=20 >=20 > Thomas