Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2772638ybt; Mon, 22 Jun 2020 06:42:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKjhtStXtqsC8WLKnIFYSpTN/XvVWZNBINZjl7tf3sbr3YLeDh2idi9dJbLFxDUmrv5kTw X-Received: by 2002:a17:906:e247:: with SMTP id gq7mr15599750ejb.107.1592833367989; Mon, 22 Jun 2020 06:42:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592833367; cv=none; d=google.com; s=arc-20160816; b=qeoDLXEWfP3xF/jA7r2Dw9fAe87EpBiguT4mJsy1JjaarioU+m21NsllW2lY+y7j+F PV4ehEvh8E+wAFVRO16T1DoFuVlmME3ueq4mHXNIh/gjCjVBXMExuFseEY/FI3n68xa2 hH+2Bq2fXpdZmWCzTUOcSEQm8N6GhpYG8ZzomGlD0ku69ywxooIQ2LHB42ay2USPXJRN 2ZDRzswjjl3bhJmijzVXNmKitCvEb9QII7X2rr6UqwhXSDV8oH1iUoxZru7M3R9D2cCh Zw9btMyBU0tpQQCl8QlkoGn835bGiCU8pgXh6O1htgz8l5TppQZGa1cRutLcGlxDyQDO E8yQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition:in-reply-to :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=mgkrMlHTxNpnMQAYHl1K4EwFxcTFYH4+ZUAQ7d50tGY=; b=So6XElckq0i6iVzdb2KnYq1tBF03bLZc9AHmBqRhlMoH38Hpz9DN6oOdBgTIIJ2+l1 S903fE46cNHwWKTWvY0ZokxR9ZnFlBwvtcKIqHmxU2sxWlvkgoSlLq9+o89EimUzEE2B WQMDLQy4qGAoXMwabrOWm5as/xW/s3fplwhsZITmhhMZ8HRLAcyWmnuWhWj9vDjQdMAA b9Kg4o74ihBxNDF60We7d8N01Neqnk52Ubn+0ojr7hu/1hXfRi6XwHRZ9enak64xKuN/ b7502Q8HVnGbwoOvd2BjhmxNzdGabodv5Nb9sVqD6C4pEKKAXoDmdXweoHx5Wq5FKA4a iyzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hqQ98FJl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b10si8933874edr.286.2020.06.22.06.42.24; Mon, 22 Jun 2020 06:42:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hqQ98FJl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729242AbgFVNiA (ORCPT + 99 others); Mon, 22 Jun 2020 09:38:00 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:55532 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728070AbgFVNh7 (ORCPT ); Mon, 22 Jun 2020 09:37:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592833078; 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: in-reply-to:in-reply-to:references:references; bh=mgkrMlHTxNpnMQAYHl1K4EwFxcTFYH4+ZUAQ7d50tGY=; b=hqQ98FJlme/61XxkWMFdDhoojiWhI8hayZ+d/Zswv1SoqAD7rZi6s/neJ0JZUTOaBeFuQJ QDSqnuOFwkVZZfL/C4htL7u5NHBxGTW3W0HAyBiVcXaFUSLRI+G20hunv1hoVBRp2SyABG 0oizWFR44zYyrGaSSy/5YLLfhZP7mug= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-35-taiTrE9hNXq1zEyx4hjdhQ-1; Mon, 22 Jun 2020 09:37:52 -0400 X-MC-Unique: taiTrE9hNXq1zEyx4hjdhQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 01183872FE1; Mon, 22 Jun 2020 13:37:50 +0000 (UTC) Received: from localhost (ovpn-116-90.gru2.redhat.com [10.97.116.90]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8FB355BADE; Mon, 22 Jun 2020 13:37:48 +0000 (UTC) Date: Mon, 22 Jun 2020 10:37:47 -0300 From: Bruno Meneguele To: Linus Torvalds Cc: "Jason A. Donenfeld" , Petr Mladek , Linux Kernel Mailing List , Sergey Senozhatsky , Steven Rostedt , David Laight Subject: Re: [PATCH] Revert "kernel/printk: add kmsg SEEK_CUR handling" Message-ID: <20200622133747.GD2850@glitch> References: <20200622030222.1370098-1-Jason@zx2c4.com> MIME-Version: 1.0 In-Reply-To: X-PGP-Key: http://keys.gnupg.net/pks/lookup?op=get&search=0x3823031E4660608D X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=bmeneg@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="bi5JUZtvcfApsciF" Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --bi5JUZtvcfApsciF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Jun 21, 2020 at 08:50:09PM -0700, Linus Torvalds wrote: > On Sun, Jun 21, 2020 at 8:02 PM Jason A. Donenfeld wrot= e: > > > > This reverts commit 8ece3b3eb576a78d2e67ad4c3a80a39fa6708809. > > > > This commit broke userspace. Bash uses ESPIPE to determine whether or > > not the file should be read using "unbuffered I/O", which means reading > > 1 byte at a time instead of 128 bytes at a time. >=20 > Ack. Somewhat odd behavior, but clearly user space depended on the > legacy "return EINVAL rather than ESPIPE" behavior. >=20 > I do think there are other reasons to not return ESPIPE. The fact is, > the printk buffer _is_ seekable, it's just relative seeking that > doesn't work. You can seek to the beginning and the end and a > particular offset, just not relative. >=20 > So I kind of see why people wanted to return ESPIPE, but at the same > time it really is very misleading: ESPIPE is for pure streams that > can't lseek at all. That was indeed a misunderstanding of mine wrt ESPIPE meaning. And I agree with your previous paragraph where you stated that the buffer is only not "relative" seekable. So, ack for the revert. However, the issue with glibc is their fd checking on dprintf using: lseek(offset =3D=3D 0, whence =3D=3D SEEK_CUR) Which, technically, isn't a relative seek operation in my opinion, thus I'm also not sure that returning EINVAL is correct.=20 Would it make sense to return the next buffer index instead? Basically the same as SEEK_END does? The first "if (offset)" in the function would prevent any real relative move while SEEK_CUR would return a valid address following this buffer behavior of specific points it could seek to. >=20 > The fact that some silly shell internal then reacts very badly to that > may be extreme, but it may be as well as you can do it you worry about > leaving data for the next user. >=20 > I've applied the revert. >=20 > Linus >=20 --=20 bmeneg=20 PGP Key: http://bmeneg.com/pubkey.txt --bi5JUZtvcfApsciF Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEdWo6nTbnZdbDmXutYdRkFR+RokMFAl7wtCsACgkQYdRkFR+R okMX3wgAtGljuKIhXYBxhpvs4p2xQWRLW/RTySITG7k86tmTNf9qs/7/kog9a0Yb gF087sCIG9ZC0POru1uaKVV7uLS6mxJo2e5nzkZukGEoXVkECFjbK79nlJMc3kW5 sgJCT2NvuCng2Ytr82CUVACvWqsna7diX+Pm0RWcys/CwzcEGlbmVmiWJc9BrAIK 1NZCSLtB08HqndkHL9rKeoXBrpb2x4UTMXixJ4Z/axp+UmjhQBfMD+fY/FD/VRPZ Op8/mMglCHDygjghG3m2Fk/6pOQwOkbw/nfGuwcB7gZ+Yr+7DeoCEgrJCPK5Kd2B pi30kaQTwAU5V/TLbLAA+Xiy5xppQg== =+dr2 -----END PGP SIGNATURE----- --bi5JUZtvcfApsciF--