Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1372320lqa; Mon, 29 Apr 2024 06:56:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVO8DcfZdeIhs5Gx84JDSqPlTvQ6KDyHsvvBEQ8DAkJOCjBqvOaLVoa5P5DPeLQicjo2aEgYbQ8lajtFmFeJ9ykc9nxFuP43iwjSOCXBw== X-Google-Smtp-Source: AGHT+IEchuABMshJhzLsFxSx6Lo9V5IQOMOU3Ul81r4nJpx9rbvnKdXSRrjq/pWunww+04C45hyU X-Received: by 2002:ac8:7c4d:0:b0:43a:b9e1:3891 with SMTP id o13-20020ac87c4d000000b0043ab9e13891mr5289509qtv.51.1714398975128; Mon, 29 Apr 2024 06:56:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714398975; cv=pass; d=google.com; s=arc-20160816; b=F/qxe2QmYRSBzq3xE8BgXa4njJxx5JCH7mrOt2qbNX4vQU0lzAHBAllWz45PaIZdJ1 sIeFlJBo0whLUpqlbL6Zm6vBP/6OUWj3zagSwpz3/YJa04Fr18vqn62pt8dUqqeJzd// zeFZAGB1pZnFki4n7TnPWYGw3cMITKAI0jyEKEIvtlxNlsFScmkUkKYKop82L/HMCBMC LbFdJtKJXooLOSOeUhIgJBE4iXFaOSDkECr/NTAMNQgr3Y+x7KIPeMjrbdUlsdlZzqCf MrMpp5wAQDHK3zfEal0aZbolwFGZLCRcFU7vy1zi5PdsAl1OqF9Rqn3+QzDNbnscjmIE FqVQ== 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=KPPrqlc4ZJJeSjSUgiLUuySnt0snj2gr7SuaO9otL0Y=; fh=BBhdQOmzOUz3zw86R7UYuVks/htbkHIosFENPCxvdXs=; b=K6HnmRGHBJmPIoLFIlOd76Gp5RlWREtwg9XOXd83NHckB0t55XDMwiHGgHqYEPMbYh yKAAGMaA/iCCBCw45YqVe1T5MQgk4kXWF+9n+Wl3DZ9/vUWL+LTFBNQDI7TAVikq0Ap5 pLg9zBtbS6cKGCyY5B3cYPwXj1GxBzsHlpYLf86BX9luF69hGG0ZcFwZwu/psH8dV0sg KBTYOy19OuwwPG6vGo4U6tI/ej+GajUAj31A9f1uL6yOUrVYBdXFYnS//u+/jFnbLBk4 pCgx89xFLnsPff1SDIuqH3YwQZJw+2yD0kYRgX9ZPp1kXxIYMPpSYWHSxCfAT1JUWbK0 Zxig==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=ihclxSWS; 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-162402-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162402-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id ey16-20020a05622a4c1000b00438d77c3f0csi23358655qtb.312.2024.04.29.06.56.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 06:56:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162402-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=ihclxSWS; 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-162402-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162402-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id C5DFF1C203B6 for ; Mon, 29 Apr 2024 13:56:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C77A774BE8; Mon, 29 Apr 2024 13:56:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ihclxSWS" Received: from mail-vs1-f54.google.com (mail-vs1-f54.google.com [209.85.217.54]) (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 619F72940D for ; Mon, 29 Apr 2024 13:56:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714398966; cv=none; b=u5ERrLAlm9pI5fAqlmPbJweo8+1IIHxzo1EeE9GBzcbSACgOtpF5hK883qz7J9H50ovWAsf1QyzIuzZG/VSGNa88LzTElg87x4K85b13JCZJSakzAAYrqjnGF9a5egtz0H4OFc0j2kOJZrtO8SedURkUjyMEvJ2BVIUzVorSueI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714398966; c=relaxed/simple; bh=KPPrqlc4ZJJeSjSUgiLUuySnt0snj2gr7SuaO9otL0Y=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=NNriGLMj1GnOm65RShpe6ZDkPDTF1fubsfPztLsniLreYLlTVs7dSCMK99H2gmtEKLy+GsXJiSy4zmCNdvp0qjNCdCnYSltnOY4LkAnDS6MWsvwWhPL7so+Gf/eEOJLezLD4in4xNjx8ijfbBGvpa04Hlo21q4lYCRIuIlrX2Do= 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=ihclxSWS; arc=none smtp.client-ip=209.85.217.54 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-vs1-f54.google.com with SMTP id ada2fe7eead31-47a404c6decso1146895137.3 for ; Mon, 29 Apr 2024 06:56:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1714398964; x=1715003764; 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=KPPrqlc4ZJJeSjSUgiLUuySnt0snj2gr7SuaO9otL0Y=; b=ihclxSWS7UUNWtf1zeuZCql23gBKSqgxbMJOCh4WTibnzahnaw9rEH2QEplYsZaZ7X ushk9T+qzTKtikhfy7o0vXnVpgQtqdscpt8b9baQ7ndTD3WSSmCFT+/G8yr+OVeHdt8o YuQKD5l8U0i3OpqrrV/vdZEECZ74lielMEGfNH7CSPqV9sVR1o/yVWiAR3gFoBfNKtrj xRYUJvzLh585IbnfYe4K8POvfvApsbTKJ0saaHE7BGwhBxnNCVUMEyP1VVIn2DZvILYK 7Z8EKWxds+qZHMmE8j4/c+BAkMe0i0erDeZvpe1ILuhmN8ckWMRVrVklopHDeNp0Rcd+ Z40w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714398964; x=1715003764; 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=KPPrqlc4ZJJeSjSUgiLUuySnt0snj2gr7SuaO9otL0Y=; b=r3ucXm6iMZVs2fc1Ai9uGWpQHolZRnAn/qC8Sc/TOpQCrKvNNS+2Ha8VYxwEpr/Rn3 VXOYscQvd5iH9/cT8dFzw1qAsH174Nv2hXGJmGUGJE54wefzAm04tsJntMKk6WynQNAu Q1a23e7RdkVdo05UrW7benf1hJEs/UKItcskmydALd1gnhK7t8YQdNZnLnXs4+Yis+dM dXSj1A7/8cEBMa1AICNAXlPvogfSIo7EBmdfSAJJlvco4O3wTpyQ1y4Gj3f4K7/G2Rt+ kUQlGmvjJptGpZROC/ITqQFJf/bDp/LScaHq+hvdp9bIjxEjLB8gk9yNWwQNsVBg+sNQ /97w== X-Forwarded-Encrypted: i=1; AJvYcCUcshlNEyuUaVsD1IqnhSpjilOafB3KcoHxIRGuuvs2q5fZYMhWj+4j844c3rrrZlxnkvuUcdtKGbPTA2ZhgvxfdlP+0bdSw1dF/wLR X-Gm-Message-State: AOJu0YwJyVM4VKao+xnN93Y3nNs1S5bh1O5RBiYsKuHO4jGaG1xXBqbV ICu3v+ss+nZqqdN4SdfQyuOp0gW8VolAiTAyNgz0sj75UoHZgW+418MN3OL+IKfD+NFsO4vZFaK QaSfiMofqTN9eakuANUJnXBEJLPOz3q1zSxGY X-Received: by 2002:a05:6102:3583:b0:47b:b2f7:2006 with SMTP id h3-20020a056102358300b0047bb2f72006mr9958251vsu.3.1714398964079; Mon, 29 Apr 2024 06:56:04 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20230424004431.GG3390869@ZenIV> <8e21256a-736e-4c2d-1ff4-723775bcac46@I-love.SAKURA.ne.jp> <2fca7932-5030-32c3-dd61-48dd78e58e11@I-love.SAKURA.ne.jp> <20230425160344.GS3390869@ZenIV> <1b405689-ea0a-6696-6709-d372ce72d68c@I-love.SAKURA.ne.jp> <5cebade5-0aa9-506c-c817-7bcf098eba89@I-love.SAKURA.ne.jp> <2023053005-alongside-unvisited-d9af@gregkh> <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> In-Reply-To: From: Marco Elver Date: Mon, 29 Apr 2024 15:55:25 +0200 Message-ID: Subject: Re: [PATCH v3] tty: tty_io: remove hung_up_tty_fops To: Linus Torvalds Cc: Tetsuo Handa , Greg Kroah-Hartman , Dmitry Vyukov , syzbot , linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com, Nathan Chancellor , Arnd Bergmann , Al Viro , Jiri Slaby , "Paul E. McKenney" Content-Type: text/plain; charset="UTF-8" On Sun, 28 Apr 2024 at 20:50, Linus Torvalds wrote: > On Sun, 28 Apr 2024 at 03:20, Tetsuo Handa > wrote: > > > > If we keep the current model, WRITE_ONCE() is not sufficient. FWIW, the original report here came from syzbot, which is configured so that the WRITE_ONCE() is sufficient (CONFIG_KCSAN_REPORT_RACE_UNKNOWN_ORIGIN=n, CONFIG_KCSAN_IGNORE_ATOMICS=y ... long names, I know), because this was an idiom we ran into in the past and just wanted to filter them out (for better or worse). That being said, the reader side still has a real problem, even if hidden in some KCSAN configs. Up to you if the WRITE_ONCE() is sufficient or not, at least on syzbot this case wouldn't resurface (for now). > > My understanding is that KCSAN's report like > > I find it obnoxious that these are NOT REAL PROBLEMS. > > It's KCSAN that is broken and doesn't allow us to just tell it to > sanely ignore things. > > I don't want to add stupid and pointless annotations for a broken tooling. KCSAN is the messenger in this case that our mental model vs. what our language/memory model gives us is wrong: we already have our own memory model (!= C11), but we still have data races, and have to deal with the fallout. Data races (here: 2 plain unmarked accesses of the pointers) still exist, and the compiler is still free to optimize them (miscompile them according to our mental model). Assuming the data race is not a problem assumes all compilers on all architectures won't mess up the accesses. This comes up over and over, and the problem hasn't gone away. Our compilers still don't know about the kernel doing things outside the scope of standard C - we can beat the compiler into submission with lots of flags, but we know [1] compilers break our assumptions. What's the long-term fix? I don't know, besides trying to teach compilers more of what Linux wants. [1] https://lpc.events/event/16/contributions/1174/attachments/1108/2121/Status%20Report%20-%20Broken%20Dependency%20Orderings%20in%20the%20Linux%20Kernel.pdf > Can you instead just ask the KCSAN people to have some mode where we > can annotate a pointer as a "use one or the other", and just shut that > thing up that way? Saying "use one or the other" pointer, implies atomicity of the load and store. Telling KCSAN about our assumption of what we think the compiler should do is the wrong way around - we should tell the compiler. Which part of the code is telling the compiler we want atomicity of the loaded pointers? A WRITE_ONCE() / READ_ONCE() pair would do it here. What should we use instead? Thanks, -- Marco