Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp254437ybl; Thu, 23 Jan 2020 23:04:53 -0800 (PST) X-Google-Smtp-Source: APXvYqxKcdXk0skzbUMjnuoeFetfoqIOQcJRQX7DY8flbq0GuD7Q0UQR5YOBd0Fx5XSgjiZwq/9F X-Received: by 2002:aca:4c9:: with SMTP id 192mr1195959oie.105.1579849493224; Thu, 23 Jan 2020 23:04:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579849493; cv=none; d=google.com; s=arc-20160816; b=a0GkS13TlmPEdjxZudINN3DiKLFCwvcx49oLsrHIl5NgkHPX9U0x4IJosQdxPjiRcq Ia4ZAnTvMJw/dFPUbSJjVGDWRHNNXZ/xLg0CC4ZY/xn/cqH6hZpFdobK883yXLjvLR5R 99I9mw1Iu3L55fIoZkRVDEUIj5rpSaOyXFvxzj+jZYIlctvVJkUV5le68Z4PgZQHR1kr Yc8x7601ucVkDPGNOcHCFDy1kRYGsn7LLpiXeqknIOoqAFA9KYlr3EyyhTuSgM2tgtE5 4jlzoJVXFlejOQyJfvtjll+p7Hil4vfcsgAZLgwWcF/rgS64qTO0eWK6tWABdtWyJ5Lz fQxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:mime-version:user-agent:date:message-id:cc:to :subject:from; bh=6CywLjUqtryl0Qu700HYOrtSZ1tn1qUwoFFoJM4K0X4=; b=VE6LB1jB8+8GohNwD/dX+9fBnFsORrgx+byVQliCo160StX8L9/6iwpxX07pTtosB6 igF4HVa0ivU5+B+5Z1PJXYrZP/Cv3Ei0ZFWvFDZBO+kpgEBxoFUGPlVw0efIXH/MBd0Y 5N6X8cjcXK199G4sg8fQItOMXAtyDcyXfE+BIoJkfIjWB/eEqXH6T3qWB4wTSJQBDzeL BnCHUcYYKU6OlTRIgWHZeE7c2V/THK3ZjBTYHmQUSyF+69+z60fXWjVTbRv54H4xpSsc 6TMfAkjeIANVcGlxiqxm1AMv+dMIK5SHytIFywQ/GuJffRflWzVNTsp4W0Iavgt1pa4a /tiA== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g126si1984520oib.105.2020.01.23.23.04.41; Thu, 23 Jan 2020 23:04:53 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727430AbgAXHDK (ORCPT + 99 others); Fri, 24 Jan 2020 02:03:10 -0500 Received: from relay.sw.ru ([185.231.240.75]:53108 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726657AbgAXHDK (ORCPT ); Fri, 24 Jan 2020 02:03:10 -0500 Received: from vvs-ws.sw.ru ([172.16.24.21]) by relay.sw.ru with esmtp (Exim 4.92.3) (envelope-from ) id 1iuszF-00085a-V4; Fri, 24 Jan 2020 10:02:38 +0300 From: Vasily Averin Subject: [PATCH 0/7] seq_file .next functions should increase position index To: linux-kernel@vger.kernel.org Cc: Andrew Morton , NeilBrown , Waiman Long , Steven Rostedt , Ingo Molnar , Peter Oberparleiter Message-ID: <244674e5-760c-86bd-d08a-047042881748@virtuozzo.com> Date: Fri, 24 Jan 2020 10:02:36 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In Aug 2018 NeilBrown noticed commit 1f4aace60b0e ("fs/seq_file.c: simplify seq_file iteration code and interface") "Some ->next functions do not increment *pos when they return NULL... Note that such ->next functions are buggy and should be fixed. A simple demonstration is dd if=/proc/swaps bs=1000 skip=1 Choose any block size larger than the size of /proc/swaps. This will always show the whole last line of /proc/swaps" Described problem is still actual. If you make lseek into middle of last output line following read will output end of last line and whole last line once again. $ dd if=/proc/swaps bs=1 # usual output Filename Type Size Used Priority /dev/dm-0 partition 4194812 97536 -2 104+0 records in 104+0 records out 104 bytes copied $ dd if=/proc/swaps bs=40 skip=1 # last line was generated twice dd: /proc/swaps: cannot skip to specified offset v/dm-0 partition 4194812 97536 -2 /dev/dm-0 partition 4194812 97536 -2 3+1 records in 3+1 records out 131 bytes copied There are lot of other affected files, I've found 30+ including /proc/net/ip_tables_matches and /proc/sysvipc/* I've sent patches into maillists of affected subsystems already, this patch-set fixes the problem in files related to pstore, tracing, gcov, sysvipc and other subsystems processed via linux-kernel@ mailing list directly https://bugzilla.kernel.org/show_bug.cgi?id=206283 Vasily Averin (7): pstore_ftrace_seq_next should increase position index gcov_seq_next should increase position index t_next should increase position index fpid_next should increase position index eval_map_next should increase position index trigger_next should increase position index sysvipc_find_ipc should increase position index fs/pstore/inode.c | 2 +- ipc/util.c | 2 +- kernel/gcov/fs.c | 2 +- kernel/trace/ftrace.c | 9 ++++++--- kernel/trace/trace.c | 4 +--- kernel/trace/trace_events_trigger.c | 5 +++-- 6 files changed, 13 insertions(+), 11 deletions(-) -- 1.8.3.1