Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp428159ybl; Thu, 23 Jan 2020 01:05:40 -0800 (PST) X-Google-Smtp-Source: APXvYqz1+/UxHKXTD/5TCerDgFWYm6IZYQoA2WwvTmM6L5AYJZLeDwZ0xtaClgsc05SJrk8gnvY1 X-Received: by 2002:a05:6830:22ee:: with SMTP id t14mr10341706otc.236.1579770340727; Thu, 23 Jan 2020 01:05:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579770340; cv=none; d=google.com; s=arc-20160816; b=ckoOR+xyaRG1hvbBe4ZqXS0XieapKrk5dBrmbc+fWvZkkTgCuuYhCK7YwgUJQ6lv1n INrKETVqIt9nxs4sbrmnuKCsVzOIm3sWmNeH6KM4+os6Dx/lJIXBSFLI0QKOKa8y6IQT JvMO79rHY0GBS+Aa8Yz5DGpIS2255oXDa88gfYQ+ScQTlYKE6U1KI0jN+v8gj4CGhE6y 4tNVk1KZOP2PgFJNyhD4/r2MtSpGq5AoE5usbRg+RYqD8KXyAoTN7TiCQGGzsBQZcvCz tcVk2UH2/4JKZ7eakZnsY1LfnhDepej3+q81gX5MEfXZANK0uKj9qhDSp2Ig2rh4ey7b lM6g== 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=oAttzg6qVW8N0ioLhFqmsG4glkS3NcR7Yiep9Gs7DZs=; b=zIxBSvvpehBSyfYuLPcHyHA8IfDeWYExg2eK8PZRKPcg9VK3WEfRLijkWCSoMA7w2n Y7qCoWgpag5C9kbcBPEfc70t2lPOqcbG9BzReSWSMfVjiBHU9muy7REX5bRLqeA/A4Rk UIsbi6JzVkxJ99oxqIBhDzQZhJdVpEYBpla7idoALKzPQcYM+vhfdjsQssFtlJSBZkFr jIe6r9c2iffB8LtQNObI64/swYcu1P4qi0bPOPRd6LQiJO0Kt44PT4cP/4345rvky883 iQt/hqC+ixxq9UBtJ0Jbt6OiO6e12uOdkJ3i5C/XEHm8Vt4YkJVjQ4Ya8gZOYlBShDLI Rlkw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-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 u16si620698oia.233.2020.01.23.01.05.19; Thu, 23 Jan 2020 01:05:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-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-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-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 S1726194AbgAWJFR (ORCPT + 99 others); Thu, 23 Jan 2020 04:05:17 -0500 Received: from relay.sw.ru ([185.231.240.75]:39816 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726170AbgAWJFR (ORCPT ); Thu, 23 Jan 2020 04:05:17 -0500 Received: from vvs-ws.sw.ru ([172.16.24.21]) by relay.sw.ru with esmtp (Exim 4.92.3) (envelope-from ) id 1iuYQF-0006p9-JC; Thu, 23 Jan 2020 12:05:07 +0300 From: Vasily Averin Subject: [PATCH 0/1] jbd2: seq_file .next functions should increase position index To: linux-ext4@vger.kernel.org, Theodore Ts'o Cc: Jan Kara Message-ID: Date: Thu, 23 Jan 2020 12:05:05 +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-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@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/* Following patch fixes ext4-related file, script below generates endless output $ q=;while read -r r;do echo "$((++q)) $r";done