Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3692524ybc; Mon, 25 Nov 2019 19:27:00 -0800 (PST) X-Google-Smtp-Source: APXvYqzRRef7CiI7OJv/Z4SKSRlo4HWFOoVrjDgPccmN2U/r+n9YSAQeC8C8LHaYk8uvCv1EzYxU X-Received: by 2002:a50:e70f:: with SMTP id a15mr23088375edn.287.1574738820254; Mon, 25 Nov 2019 19:27:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574738820; cv=none; d=google.com; s=arc-20160816; b=p244uVu9DSbE3ivrXhqyyrgMrpaxYoXHswAiJz4vtKzS66fn8fLR6WrRj85ubS1jGc 55TG9iCUvfgIdNE9eNv1RHN9STjXjsuPMVxWkigHhbqn8HdVsydQQ2AomMXFNl04MqXU JCzHiERX1xaFcGl4bV2t8saPqYxt+Xw8yLgtYkrXW2EGPXlsIxjUCeyB58e0kxmnEBC8 k7Zo0V2w/VtetINi+mVwqNlaynDJn588YdLEzjVCR6iil2ZDqdtRTaM7TsR/TRduwdUP JwospgbL6G5r30/DEn1h3oDvlqtxilE0BUFvrpjyptVLL9ZoEpFRN5N6kmkVUe8754za ivww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=/mWh4zHOpJuBz4S9adg+rZZ8a37OLbsX8O3eNwWxZ6U=; b=WTTSgxUpFqOnaJVYoRxXZRznjl5XaAVWIu4sycH4mW8X6p5XNGjHayfYl8sK+p0Qme jk1J6fjs7ya0JciqCktEAABV0kZ0Art1xj5yO/c0GwjEuiGil72ZzNDEjATiIxZcrsLQ SgWZM6fXdRNMiHeUwP0IhuV5DNjEfdv/tNEL43tKMY2owNn8M9B9LrsKe9hOBfjVdKhw 4I1803w+ob7cv9H0W530WlWMfRHiW0dcZhet/4/Cwh+2SLqi2O9z5/Lf+u+Jovd9jbkA raQmpV11LMHzNZ5+R+5opSoiXWPW4IqAmrre215nlEWlyGw2nafQUTY0x+6PTcyD9qhz lm0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=PIBz9DkI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w3si6747514edt.196.2019.11.25.19.26.35; Mon, 25 Nov 2019 19:27:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=PIBz9DkI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727275AbfKZDWQ (ORCPT + 99 others); Mon, 25 Nov 2019 22:22:16 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:32890 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727127AbfKZDWQ (ORCPT ); Mon, 25 Nov 2019 22:22:16 -0500 Received: by mail-lf1-f68.google.com with SMTP id d6so12811105lfc.0 for ; Mon, 25 Nov 2019 19:22:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/mWh4zHOpJuBz4S9adg+rZZ8a37OLbsX8O3eNwWxZ6U=; b=PIBz9DkIcX7+LqItZzpiHfN1ECzE8Em4WA4leISipGNVTIqLcfdkWyCjkh2gpU1Xfs lmAMPIPXNnkBrKLEkzMGfZ1hDISC3NTKbzma62gZ0cBp4qgpSnojMe7QE6aQdkbc04QO 9+B5XDU6183f3S18qW/yJcRbKrD/YBvIxcHTg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/mWh4zHOpJuBz4S9adg+rZZ8a37OLbsX8O3eNwWxZ6U=; b=Zg9a4sjJCIpU0w9dcvOYfX/K11wZY92RFkBjJQuz6iQuaS/Q1RNetN4SD2bZUDbGTC Ef+GFj1QO9nYOWiE70YYEtZUv+kn+jMUTlHezxaPf0q0eEc8DQMVtJ+ipL2D7w/AIjQ4 mgH7bMUB4hpowBSGUedQKSk+EtOEk0eTif2Bzf8RF25KxqJVvtEI4tEcjxDbyuVPMzc6 nSxaYjuDTbAHuoqpkTx4JzUwiKXN/Qmx8cpDkNPKHcG4KfexlpYBX0Vax/4KF3zWznHB oLHYJmp0+qlia3pPHpGBvs2iYMc62q7Ye0o4mgYYLya4ZT8xB81oCR9Sb6aVEfbnGN46 /Afg== X-Gm-Message-State: APjAAAWO6nn5VS6+gI7xBjs3dHe/n7gYrMisjSL4jEn5/4RW9vdiVSdH uxv0j7eqNy6BowokanOhL2NvAU8496c= X-Received: by 2002:ac2:5616:: with SMTP id v22mr12936695lfd.84.1574738533889; Mon, 25 Nov 2019 19:22:13 -0800 (PST) Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com. [209.85.167.54]) by smtp.gmail.com with ESMTPSA id i23sm4496753lfj.71.2019.11.25.19.22.12 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 25 Nov 2019 19:22:12 -0800 (PST) Received: by mail-lf1-f54.google.com with SMTP id a17so12760844lfi.13 for ; Mon, 25 Nov 2019 19:22:12 -0800 (PST) X-Received: by 2002:a19:4949:: with SMTP id l9mr22319881lfj.52.1574738532324; Mon, 25 Nov 2019 19:22:12 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Linus Torvalds Date: Mon, 25 Nov 2019 19:21:56 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Commit 0be0ee71 ("fs: properly and reliably lock f_pos in fdget_pos()") breaking userspace To: "Kenneth R. Crudup" Cc: Linux Kernel Mailing List , Kirill Smelkov Content-Type: multipart/mixed; boundary="000000000000d582d60598376238" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --000000000000d582d60598376238 Content-Type: text/plain; charset="UTF-8" On Mon, Nov 25, 2019 at 5:58 PM Linus Torvalds wrote: > > It might still be a bit noisy even with the above, but I think it will > at least be better. Yeah, I think I see what's going on. I for some reason entirely missed the tty case. Oops. That was just stupid of me, I should have thought of it. There are other things that trigger the new informational line in that hacky patch, and they _might_ matter, but I suspect it's the tty and sound cases that causes the worst problems. I suspect Kirill Smelkov even might have mentioned the tty case at one point, and I just spaced out. There are other things too that trigger that debug check, like the sound file descriptors, and they might well matter too. Anyway, I think the thing to do (for now) is to just say "character devices are FMODE_STREAM files if they have no llseek operations". That should take care of both tty's and the sound devices. You can certainly have a character device that can do llseek, but it sounds like a reasonable base rule. Of course, this may fix the f_pos locking issue, but replace it with a "oops, the character device driver tried to look at *pos anyway", and that will give you a nice OOPS instead. So this patch might just replace the failure mode with another failure mode instead. At which point I think I'd have to revert that "get rid of FMODE_ATOMIC_POS" trial balloon, but let's see if this patch solves your problem and is sufficient.. I'd suggest using it _together_ with that "pr_info()" debug patch I sent, to see what else might be going on.. Linus --000000000000d582d60598376238 Content-Type: text/x-patch; charset="US-ASCII"; name="patch.diff" Content-Disposition: attachment; filename="patch.diff" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_k3famq520 IGZzL2NoYXJfZGV2LmMgfCAxMiArKysrKysrKysrKy0KIDEgZmlsZSBjaGFuZ2VkLCAxMSBpbnNl cnRpb25zKCspLCAxIGRlbGV0aW9uKC0pCgpkaWZmIC0tZ2l0IGEvZnMvY2hhcl9kZXYuYyBiL2Zz L2NoYXJfZGV2LmMKaW5kZXggMDBkZmUxNzg3MWFjLi5lNWZmZWJkZjgwZDUgMTAwNjQ0Ci0tLSBh L2ZzL2NoYXJfZGV2LmMKKysrIGIvZnMvY2hhcl9kZXYuYwpAQCAtMzY3LDYgKzM2NywxNiBAQCB2 b2lkIGNkZXZfcHV0KHN0cnVjdCBjZGV2ICpwKQogCX0KIH0KIAorc3RhdGljIGludCBtaWdodF9i ZV9zdHJlYW0oc3RydWN0IGlub2RlICppbm9kZSwgc3RydWN0IGZpbGUgKmZpbGUpCit7CisJY29u c3Qgc3RydWN0IGZpbGVfb3BlcmF0aW9ucyAqZm9wcyA9IGZpbGUtPmZfb3A7CisKKwlpZiAoZm9w cy0+bGxzZWVrICYmIGZvcHMtPmxsc2VlayAhPSBub19sbHNlZWspCisJCXJldHVybiAwOworCisJ cmV0dXJuIHN0cmVhbV9vcGVuKGlub2RlLCBmaWxlKTsKK30KKwogLyoKICAqIENhbGxlZCBldmVy eSB0aW1lIGEgY2hhcmFjdGVyIHNwZWNpYWwgZmlsZSBpcyBvcGVuZWQKICAqLwpAQCAtNDE2LDcg KzQyNiw3IEBAIHN0YXRpYyBpbnQgY2hyZGV2X29wZW4oc3RydWN0IGlub2RlICppbm9kZSwgc3Ry dWN0IGZpbGUgKmZpbHApCiAJCQlnb3RvIG91dF9jZGV2X3B1dDsKIAl9CiAKLQlyZXR1cm4gMDsK KwlyZXR1cm4gbWlnaHRfYmVfc3RyZWFtKGlub2RlLCBmaWxwKTsKIAogIG91dF9jZGV2X3B1dDoK IAljZGV2X3B1dChwKTsK --000000000000d582d60598376238--