Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1298682lqm; Thu, 2 May 2024 10:21:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUdYhhBbPyFxCzSsj20Z/yHOFBiYRhA4mPUbRhl7vegj7SsE5xcFINm1bDfDlkdOGlEziW9oY0kTvRhtFdyWlsEIUZ9mLpmRMouTFAdoA== X-Google-Smtp-Source: AGHT+IHC8Eugji62JNc+mJMmG6s/8qzdN+lc8OiFfeCLXeFT1i+sLMeV2lb9jGaRsr2bTuekA4ZJ X-Received: by 2002:a05:6a00:13a4:b0:6f3:e720:cead with SMTP id t36-20020a056a0013a400b006f3e720ceadmr282640pfg.5.1714670477435; Thu, 02 May 2024 10:21:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714670477; cv=pass; d=google.com; s=arc-20160816; b=WH/wM9w6v3XuUkV2OfOeg684rXIuq1apCFJ8+ybAhpf78EELFAx7W9rzhP8UxO5OFl D+Mek1e5sKU08mktdPkjhtCqplinpYZFpa96i17QWmCHWvR0A24nEzA5UblKSWuQXHM3 zaCud+xQN+G4wp5ZyGrSaFXK0Y2yLRsCQuRnEasNNXfhwPDqUPZMaDKfMkYpbgoUW+Yi VynmTulB9zG6Amwoc03h42af4luv/uR32Lza+FSs/i+WlFXL+cBxLcf8PeDPOqf6uKXM Z/VWqsV9CzEiRAh42//cpXrdIhQSnjcU8CzOD6OQVSW3lNyiB9YErHp4+Ft6bnb1hOQE 3M1g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=IAFt7eBKKgungDlgXUVM9S/K1MsryQKKIBA2KVjr1YE=; fh=1eRuyUKfP2P6uGPQw62CEJ0KTAeOAlYrWxqj6sHNKTI=; b=kfQnkAhIM4xcMZa8j1KpWxHlKYkpVIsT4kkS6tMSzdMJKVIb5mAixqtysldT4v2tLT OfnKzRaAQfvl3kAg9WDYdJsovY1HtNYZsxBIZv5/tW0XJbW84j1wFaXvy5vx7rRDqZA4 x33ydFdTNIOXoy9LkT2nTmC0s8rA49YiyFbFO/VE6PttMpGm9OoMesA5VBX3kFwlXq1C x88dTnDysw6x8K6KqiReui5uh87lf77PfDf4tTnqEtD2e1lIX24birWh0j+f5E6R+Av5 8MZHq5E9IoqtQU5zA8OFpgR7c7TZj5ON/z6GsQ0snn2U41tG1p3ejDfg4sgOmnnXfOH5 XQhQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=FevljIVB; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-166775-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166775-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id h27-20020a63385b000000b005dccf9c665csi1385749pgn.664.2024.05.02.10.21.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 10:21:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-166775-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=FevljIVB; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-166775-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166775-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 899D0281E30 for ; Thu, 2 May 2024 17:21:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0084116FF3C; Thu, 2 May 2024 17:21:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="FevljIVB" Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) (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 4A0B815E5A9 for ; Thu, 2 May 2024 17:21:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714670470; cv=none; b=ix7qXKaYqsKIpDETqASb9j+W3ZGNCtDJBSdLYWg05IHlGCscTkmJabIWUGysliQgv/YfWc5CPlN2xua4pzYhA2vS2QXGrryJJZZ5aaaGez+oc9cYbiRupUsOaw6C/DTG7mIm4KJCc3VQHNogkAgkno64bGZUVzXam1OGOExPSQM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714670470; c=relaxed/simple; bh=oxNcBWQxmMinnuPRCnHgfU+zEqGKyyng8T4qsAL+ufM=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=TbbgQr8olaxNtxKIrDdW8XZZ66yZKTp//P4oovlAicLXr546U27F0V0UHR1Ik1t13GRZ3r/LhCjC5M7KI2vMqGzQmUfYjOq5m2K8xrDih3rfCgxCIbXrkW710iu0riVD5XZJMCZUnBW/946fVcXmIEBS+rCge4Xnl+OOKyiL/tk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=FevljIVB; arc=none smtp.client-ip=209.85.167.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-51ae2e37a87so9965325e87.2 for ; Thu, 02 May 2024 10:21:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1714670466; x=1715275266; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=IAFt7eBKKgungDlgXUVM9S/K1MsryQKKIBA2KVjr1YE=; b=FevljIVBtNzae+cu+q/wb+BEoyzpC2aKX1GW1S4aE+9l8bQPMb7oE2HB96HHze05bX 4PHq1SDn0EMgpqsDhMvWYyTQ3fqBuGxwns+9pIThO8JI9rm1UKcxYs9ralH6N3E8DYgr Ve75NXkwUzbFQTRi6KXqq3g75/1lOsWfISCU3gnU8UPCrdnTmknXS226jnKnLW+MNwYR 9rfY2an8JUXXiSd/Zk9S8ec9zTLwrdgaT9jD8KZ3C4O/pmJWnxTJVoEhN9gHMG+zrKJ8 EUjlXZy9mGCfsJSTSX3oxHKl1EUgBZt1cw9vfeProEu0YMM+MQhgMBHEUyq/Cyr12mDp I3oQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714670466; x=1715275266; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=IAFt7eBKKgungDlgXUVM9S/K1MsryQKKIBA2KVjr1YE=; b=HXp+5+l3svEGq26rbRsHaWysU/50XQuyLFdG2Kgh/O/rueZHdJtA9tFbAcUGaBL1gJ lVCJmGj1sTJ5QNJUZUXtFSO5ClLpltbxyx9As2b2lWMooyJcMVKbktQxQq5TcV9cSeHh bkV/m+KLo38bqTABtZ/DmCdlhwzLL/85Qr/Sb7QV+a8zvtBENJkiPn0Q2357tZno/ynp SRLc1yiGeq+as9m3y9sSvvbXZxV8qaydgndalfuOZX73ke6lvNvszqtQtVye/xvkuqFS eCRohM+jaYsjw+i14nFIkj+h9Z4Hl4Ts+cGD9ZgXY14Fts0LZpMErvjbJ8vCUNmSK6g2 HaMw== X-Forwarded-Encrypted: i=1; AJvYcCUMONDlqpD1uNvt3gHHj/XAeezTQrzfjCGVBjOy6U26yDEWz/RPjFJVp+9uVEn5HzLiBp2kjPvMENTM11z+JxiVb3p3x0cS3YJMp2oA X-Gm-Message-State: AOJu0YwppwJ/Vo17tz5UtwLcIJVxATNpHkUd+Py0cdXL5lNrkTNcPvQg +6rrWyfbhQeFZi5KE5Z67ZQLobkta0que+eFB+3w9g4JZrU3D7EOqKfkUgmVtCqVxBFhbc1EdfN lNAQ4dBFhAVXj3JSGkjOJVfjeh7Qe7cKrRX9a X-Received: by 2002:a05:6512:3f1a:b0:51d:4473:48eb with SMTP id y26-20020a0565123f1a00b0051d447348ebmr423118lfa.38.1714670466174; Thu, 02 May 2024 10:21:06 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <8edbd558-a05f-c775-4d0c-09367e688682@I-love.SAKURA.ne.jp> <2023053048-saved-undated-9adf@gregkh> <18a58415-4aa9-4cba-97d2-b70384407313@I-love.SAKURA.ne.jp> <892324fc-9b75-4e8a-b3b6-cf3c5b4c3506@paulmck-laptop> In-Reply-To: From: Marco Elver Date: Thu, 2 May 2024 19:20:25 +0200 Message-ID: Subject: Re: [PATCH v3] tty: tty_io: remove hung_up_tty_fops To: Tetsuo Handa Cc: Linus Torvalds , paulmck@kernel.org, Greg Kroah-Hartman , Dmitry Vyukov , syzbot , linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com, Nathan Chancellor , Arnd Bergmann , Al Viro , Jiri Slaby Content-Type: text/plain; charset="UTF-8" On Thu, 2 May 2024 at 18:42, Tetsuo Handa wrote: > > On 2024/05/02 23:14, Marco Elver wrote: > > I sent a patch to add the type qualifier - in a simple test I added it > > does what we want: > > https://lore.kernel.org/all/20240502141242.2765090-1-elver@google.com/T/#u > > Want some updates to Documentation/process/volatile-considered-harmful.rst > because __data_racy is for patches to add volatile variables ? This has nothing to do with volatile. It's merely an implementation artifact that in CONFIG_KCSAN builds __data_racy translates to "volatile": the compiler will emit special instrumentation for volatile accesses so that KCSAN thinks they are "marked". However, volatile is and has been an implementation detail of certain primitives like READ_ONCE()/WRITE_ONCE(), although as a developer using this interface we should not be concerned with the fact that there's volatile underneath. In a perfect world the compiler would give us a better "tool" than volatile, but we have to make do with the tools we have at our disposal today. > Patches to remove volatile variables are generally welcome - as long as > they come with a justification which shows that the concurrency issues have > been properly thought through. My suggestion is to forget about "volatile" and simply pretend it's data_race() but as a type qualifier, like the bit of documentation I added to Documentation/dev-tools/kcsan.rst in the patch. > > > > I'll leave it to Tetsuo to amend the original patch if __data_racy makes sense. > > OK if below change is acceptable. > > --- a/include/linux/fs.h > +++ b/include/linux/fs.h > @@ -1012,7 +1012,7 @@ struct file { > struct file_ra_state f_ra; > struct path f_path; > struct inode *f_inode; /* cached value */ > - const struct file_operations *f_op; > + const __data_racy struct file_operations *f_op; > > u64 f_version; > #ifdef CONFIG_SECURITY > > Hmm, debugfs assumes that f_op does not change? > > fs/debugfs/file.c: In function 'full_proxy_release': > fs/debugfs/file.c:357:45: warning: initialization discards 'volatile' qualifier from pointer target type [-Wdiscarded-qualifiers] > const struct file_operations *proxy_fops = filp->f_op; > ^~~~ Exactly as I pointed out elsewhere: pointers to __data_racy fields now have to become __data_racy as well: const struct file_operations __data_racy *proxy_fops = filp->f_op; should be what you want there. The type system is in fact helping us here as intended. :-)