From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mta1.formilux.org (mta1.formilux.org [51.159.59.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD7A519DF55 for ; Fri, 1 May 2026 08:08:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=51.159.59.229 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777622929; cv=none; b=aUqtT1UAMonRnVhUVNG+Zr9enRdSzYbvVj+w84Cg/u1dqZ3Ofq7PUOg6oLipnxJ/64u1Fx/ps4qZUUB2GEng9KxuhKNkyxzyuyb+RPkwy/Yl7AxWHXrUcmDXk9hZRFgiy5zf/ol5s7UYS6fg2ZCQi7UysBg/HkFwBOOFs4OtEUI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777622929; c=relaxed/simple; bh=s9TWfk7Po0D1CztMi3X3Hi1WdJrOq9gPFipyyKvkjnQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ot/jfvPehylAxzTdaEUB+WBpBt2EAt3uOVhiNzGo+bQWIF6pu+pwQYP8gA5F2DMQpq/LigCpDEGJtfz/Js0co69L9stTwU04gQJng05/NZVSKRNIIXBWAGPcg6jUfEx4do8N2dfKZ6KFyWl/l7Hw617AB+6s2E276wiHPJhn8dY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=1wt.eu; spf=pass smtp.mailfrom=1wt.eu; dkim=pass (1024-bit key) header.d=1wt.eu header.i=@1wt.eu header.b=LejWiW8T; arc=none smtp.client-ip=51.159.59.229 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=1wt.eu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=1wt.eu Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=1wt.eu header.i=@1wt.eu header.b="LejWiW8T" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1wt.eu; s=mail; t=1777622926; bh=xX3ad1cQd0LQlgkpC2g+Fy05iqk2Qpo6iprlmjrT9lM=; h=From:Message-ID:From; b=LejWiW8TEU8tyqTSmCwxwhqJNwFvVqdEZQOGuS68h5JNjtd+Y8ZJyyETApKX67cXg sbkX37xqIz4RJ2EFeFES1xEYkXPPKPcemxlaP4vbR5i4bYqBqPB7k1TDHlea30N+tn u73PtxXP0EpTbrLbdeWKCHPaLIvMJr48AUHM4xB0= Received: from 1wt.eu (ded1.1wt.eu [163.172.96.212]) by mta1.formilux.org (Postfix) with ESMTP id DCB03C0A7D; Fri, 01 May 2026 10:08:45 +0200 (CEST) Date: Fri, 1 May 2026 10:08:45 +0200 From: Willy Tarreau To: Thomas =?iso-8859-1?Q?Wei=DFschuh?= Cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH 0/4] tools/nolibc: pass mode to open syscall if O_TMPFILE is set Message-ID: References: <20260429-nolibc-open-tmpfile-v1-0-63d19c95c0a5@weissschuh.net> 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=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20260429-nolibc-open-tmpfile-v1-0-63d19c95c0a5@weissschuh.net> Hi Thomas, On Wed, Apr 29, 2026 at 04:45:08PM +0200, Thomas Weißschuh wrote: > When O_TMPFILE is set, the open mode needs to be passed to the kernel as > per the documentation. > > Signed-off-by: Thomas Weißschuh > --- > Thomas Weißschuh (4): > tools/nolibc: split implicit open flags into a macro > tools/nolibc: split open mode handling into a macro > tools/nolibc: pass mode to open syscall if O_TMPFILE is set > selftests/nolibc: test open mode handling > > tools/include/nolibc/fcntl.h | 46 ++++++++++++---------------- > tools/testing/selftests/nolibc/nolibc-test.c | 23 ++++++++++++++ > 2 files changed, 43 insertions(+), 26 deletions(-) This is a clever approach, and it can definitely work. Acked-by: Willy Tarreau I'm wondering why we're looking at the mode only for certain flags though. After all, the kernel is supposed to look at it when it needs. Why wouldn't we just always pass the va_args and let the syscall refer to it when it needs ? If it's a register, it's implicitly passed anyway, and if it's in the stack, it's only one entry, it's the same as if someone calls open() with one of these flags without passing the argument. Any garbage it contains should be ignored by the kernel when not needed, so I don't see why it would be a problem. Cheers, Willy