Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2900833ybt; Mon, 22 Jun 2020 09:45:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzi8D8v8y6w3XfYKERw4WBaym1SxCko9tRuTrtmEj0+tFTxI8yNk53lCoCz5KrHBX2hwNrx X-Received: by 2002:a17:906:cd06:: with SMTP id oz6mr17443823ejb.434.1592844337245; Mon, 22 Jun 2020 09:45:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592844337; cv=none; d=google.com; s=arc-20160816; b=G2s5Pn92z0WsCajb36MMTgMk3ZDS8fDU1usGuMHpF0N6PGW8i9TkdBvDXnvzIXv5kP hEQ6EODn46RvIXtliKeMd8iYCv4H+X4eicjMUQu5fmH4EcZ/vKuT3Y0/bBXhvMboKc4u nJxRn1JVUngUMCKPdqxB4y/PUgLz3qNrolWWc7wmtihEYoHJPhvheeJXWYNO3QpEsMzA Q9YblCYEb/1Q7y60PRxO0kvw3W7Jr1CcUPjx5DHP+irL1KHM6i4qwDL0/5ITMgWyhYEs dTL0dr4hz44uz/VdddzqJ9Wx4kbUSiA3hpd1+Zh3TMz/FMvibVlccQ3JxAjCkdQbdAS9 z41w== 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=bioh+BBjrn8lfhGJU2vSscKrqgHvIa0YiWgSVaXIKk0=; b=vldUS+BS53q1av+3bIdFNWjMN1MTqYvIZaXiMjKWhpQgSYFC6+IJQFgxK+/2ev/TqE b8SVLTjw1nhyjYHrMASKE1veOHXZsoMc0SKOkGhGAaPSInqf2LBa/DUSlguA26I9JKqE paSirPFJxSgPrwzHCuzHDaIyGfFn/ygmbd2IK+4GV9f3jrQQTPh5Ohf5Uh9wLBSFdXmG gSkPUAiRtIruM7E2MFbJfW1B3c6FHg1kwMpsFwCZOGQgxDe13KjwpjG9wHGr5xNrmvss Ay4O9EcB/KlxT9HWPqqtVP1ATpMmsZtHMYNspTCDdpQQbIwgc+J6wbgN4DDPWjgqcGDm 0VzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=L+z0IZKy; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e24si5577304edy.323.2020.06.22.09.45.14; Mon, 22 Jun 2020 09:45:37 -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=@linux-foundation.org header.s=google header.b=L+z0IZKy; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729789AbgFVQmp (ORCPT + 99 others); Mon, 22 Jun 2020 12:42:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729260AbgFVQmp (ORCPT ); Mon, 22 Jun 2020 12:42:45 -0400 Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1601EC061573 for ; Mon, 22 Jun 2020 09:42:45 -0700 (PDT) Received: by mail-lj1-x244.google.com with SMTP id n24so20049017lji.10 for ; Mon, 22 Jun 2020 09:42:45 -0700 (PDT) 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=bioh+BBjrn8lfhGJU2vSscKrqgHvIa0YiWgSVaXIKk0=; b=L+z0IZKykUBFS0YqWDjAmY+wO4YVKJ/tRwgisWQle1k44UsBmPcahzs8ifuDU8djes OJGNCtXFOfX/eo/OdCIa2SQT08iS+s4+eexRbyPteoxEgHXyBvNxhXTALA0LFUiK516K 5LxY5wqnTstVM8qg8SRRWqsqYEFko76b/eRgg= 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=bioh+BBjrn8lfhGJU2vSscKrqgHvIa0YiWgSVaXIKk0=; b=imylYud0Jc45/MwVHtX0QTLiYucdHsrVKrgvAdbTXr1OhvLudXpV7BO+w+R1iogMxD VrkTRzISkidUncSuBNsr6Ge8K6XLRxDNAmyJ+r3T7Gu9nhXaDDyyM6kitN0x3FEWIYSK V9Z8yZxFNtFoGPIXiX+jU5WQAQoJX3jkCwhpa1h3ucNVbCKVB8TIt9UytJ0LQ4/iycOg mtSg4BBmine2czZnIy7As+QJFFZYvofRIo0WbMSaVrBL7POSw6MpslxQuKqGL8/+FJAv ww5vxrLe90FrA+6z5oNwsmvT5zVv66y7xzyz30gLn3OuMY+V5EJ3w1BLMtOtx5fOlJsV RBnw== X-Gm-Message-State: AOAM530u/mZNSUvnwyZDxtWHSvCSFQHLo+MoBlihHSVFQlqcTLbhfpAn nE1AuPqFRlcNi9e9BUl9afgSV4RHhX0= X-Received: by 2002:a2e:6e17:: with SMTP id j23mr9483555ljc.194.1592844163244; Mon, 22 Jun 2020 09:42:43 -0700 (PDT) Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com. [209.85.167.50]) by smtp.gmail.com with ESMTPSA id b6sm3570458lfe.28.2020.06.22.09.42.41 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 22 Jun 2020 09:42:42 -0700 (PDT) Received: by mail-lf1-f50.google.com with SMTP id o4so10023976lfi.7 for ; Mon, 22 Jun 2020 09:42:41 -0700 (PDT) X-Received: by 2002:a19:ae0f:: with SMTP id f15mr10345309lfc.142.1592844161606; Mon, 22 Jun 2020 09:42:41 -0700 (PDT) MIME-Version: 1.0 References: <20200622030222.1370098-1-Jason@zx2c4.com> <20200622133747.GD2850@glitch> In-Reply-To: <20200622133747.GD2850@glitch> From: Linus Torvalds Date: Mon, 22 Jun 2020 09:42:25 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] Revert "kernel/printk: add kmsg SEEK_CUR handling" To: Bruno Meneguele Cc: "Jason A. Donenfeld" , Petr Mladek , Linux Kernel Mailing List , Sergey Senozhatsky , Steven Rostedt , David Laight Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 22, 2020 at 6:38 AM Bruno Meneguele wrote: > > However, the issue with glibc is their fd checking on dprintf using: > > lseek(offset == 0, whence == SEEK_CUR) > > Which, technically, isn't a relative seek operation in my opinion, thus > I'm also not sure that returning EINVAL is correct. Well, I'm not sure there is a "correct". Normal file descriptors are seekable or not, this is kind of a special one. It's not like you can read it byte for byte anyway. There is a "historical behavior". > 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. Maybe. At the same time, the way we don't actually return a real position means that that's very dangerous too. We'll always return "we're at position zero". And we never accept byte-by-byte reads and require a "get the whole record" model. So I think we might as well accept "kmsg is special". I don't have hugely strong opinions on it - I certainly agree that "SEEK_CUR with offset zero could be a no-op", but I also don't think there's a huge reason to try to change it, considering just _how_ special kmsg is. Linus