From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [80.241.56.152]) (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 8AE61282F08 for ; Tue, 3 Mar 2026 11:38:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.241.56.152 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772537931; cv=none; b=IeHuteb5sVxcTMbpRQY7m9kxrhW99Y4awdfueVqI9Yj2XBfouDNqwsH9oby/wQJDehe8j6ESrkGwGK5D8wBKijhCg4MJGpDAZK806T4mmSaMdkHCFz0r8WDx82W8UCMdCc7E6uk1tHBKzKwtX+YrABBrJ9jJ1G7M+97qLviyZBQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772537931; c=relaxed/simple; bh=/8iHhUA947crM/tcOjL/Pd1DVNj06sVqLBqIeC324mA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=KDkJOBy13H+KZ99dmOPwd+ycz8QqObvJ/h5al1h3kbyjyfssK/DuFruR1NrTu8opf32cwXDhW+5vwXBqycBhKRwK9a879vTokTg8w5kV05Vqw6k5HwOTR5RmoXeMBfyoHqPuMK9fA7HkCoHDSsInqpyUtgfOVocaocBLIjBwgZg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=mailbox.org; spf=pass smtp.mailfrom=mailbox.org; dkim=pass (2048-bit key) header.d=mailbox.org header.i=@mailbox.org header.b=kVZJe41H; arc=none smtp.client-ip=80.241.56.152 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=mailbox.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mailbox.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=mailbox.org header.i=@mailbox.org header.b="kVZJe41H" Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4fQDMn14kNz9t2T; Tue, 3 Mar 2026 12:38:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1772537925; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6JjOpbxsE2XuH6A8U7/CZNBAMhIsg22Sin/OfNvOd2o=; b=kVZJe41Hp0Med/oGU68jkHJCSqwYvNvvmlFkVgvwQb8dfIokRivfJQy3Hq2CLGfjbXWqjC PQ1urCLXIQIozIm4XqRqg50kqkis0oPFjJ8zXK7lX+tDZxYMWiT2YWsDAObwIC+ns48H7r yrw4u0dxZ4G2e+gXEGh6fSAXz2Z6II4WgFTnyAKojY+TKCTvW/oPuXsAP4g7T6sCgJcfCK g8une5R4+vEVolHJ72wT/lU+nncWI5NNqpOKEK2K2TBoUkiBom7nwGGvBmlV9FH7eS28ss ookkM3SvaxzpNQhiW90niQPRBlbjC9j5KUDcor3fzDWecGWejIo5S1rW6L3oqA== Message-ID: Date: Tue, 3 Mar 2026 12:38:40 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH] drm/syncobj: Fix handle <-> fd ioctls with dirty stack To: Julian Orth Cc: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , =?UTF-8?Q?Christian_K=C3=B6nig?= , Dmitry Osipenko , Rob Clark , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <20260301-point-v1-1-21fc5fd98614@gmail.com> <637a138f-ee6f-4940-843f-0ec873997de3@mailbox.org> From: =?UTF-8?Q?Michel_D=C3=A4nzer?= Content-Language: en-CA In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-MBO-RS-ID: cb3fc987e8cae002ef4 X-MBO-RS-META: yxtoeghb9kzhzfnnhnzxbj6z5yr7dtsf On 3/3/26 12:23, Julian Orth wrote: > On Tue, Mar 3, 2026 at 12:17 PM Michel Dänzer > wrote: >> >> While I don't object to this change, I'd argue that this is really a workaround for broken user space, not a fix for a kernel regression. >> >> User space must initialize the full struct to 0, except for the fields it wants to have other values. This kind of kernel-side workaround for neglecting that won't be possible in all cases. > > When the code in my example was written, the points field did not > exist. Therefore, as far as that code is concerned, the authors > believed that the struct was fully initialized, since they manually > initialized all fields that were contained in the struct at that time. > The code was then later recompiled against a version of drm/drm.h that > contained the new field. > > Or are you saying that userspace must always use memset(&arg, 0, > sizeof(arg)) to initialize ioctl arguments? Yes, it must. Any approach which results in newly-added fields not being initialized to 0 is broken. To prevent a potential follow-up concern: What if the kernel uses a larger size of the struct than user space? That's fine, user space encodes the size it uses in the parameters to the ioctl system call, and the kernel uses 0 for all fields beyond that size. -- Earthling Michel Dänzer \ GNOME / Xwayland / Mesa developer https://redhat.com \ Libre software enthusiast