[Bug 1861776] Re: fseek(…, …, SEEK_SET) causes reading over the skipped range

Balint Reczey 1861776 at bugs.launchpad.net
Mon Dec 7 20:09:29 UTC 2020


I've set the bug as forwarded, following how the discussion at upstream
goes. The fix _may_ be backported if upstream backports it to the 2.27
branch.

** Also affects: glibc (Ubuntu Focal)
   Importance: Undecided
       Status: New

** Also affects: glibc (Ubuntu Bionic)
   Importance: Undecided
       Status: New

** Changed in: glibc (Ubuntu)
       Status: New => Fix Released

** Changed in: glibc (Ubuntu Focal)
       Status: New => Fix Released

** Changed in: glibc (Ubuntu Bionic)
   Importance: Undecided => Low

** Bug watch added: Sourceware.org Bugzilla #25497
   https://sourceware.org/bugzilla/show_bug.cgi?id=25497

** Also affects: glibc via
   https://sourceware.org/bugzilla/show_bug.cgi?id=25497
   Importance: Unknown
       Status: Unknown

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to glibc in Ubuntu.
https://bugs.launchpad.net/bugs/1861776

Title:
  fseek(…, …, SEEK_SET) causes reading over the skipped range

Status in GLibC:
  Unknown
Status in glibc package in Ubuntu:
  Fix Released
Status in glibc source package in Bionic:
  New
Status in glibc source package in Focal:
  Fix Released

Bug description:
  When fseek is called, it calls in turn 1. lseek(), and 2. read(). In
  glibc 2.29 (maybe earlier) read() is only called for the last block.
  However in glibc 2.27 Ubuntu 18.04 is using, the read happens over the
  whole skipped range, which may cause a hang of an app that tries to
  skip too big range.

  There's is a related report:
  https://sourceware.org/bugzilla/show_bug.cgi?id=25497 Note, per
  comments, in at least glibc 2.29 read() only happens for the *last
  block*. This means there was some fix for fseek() to not read over
  everything it skipped, which Ubuntu didn't backport to older glibc
  it's using.

  # Steps to reproduce

  In command below, replace `/dev/sda` if necessary with a device that
  is at least 2 GB in size.

  Run `sudo hexdump -C /dev/sda -s 0x80000000 -n 1`. This command uses
  `hexdump` to print content of a disk at a large offset.

  ## Expected

  The command returns immediately with a print

  ## Actual

  The command hangs with high CPU load. If you use `strace hexdump …`,
  you'll see there a bunch of reads happens. These reads arise from
  glibc 2.27 implementation of `fseek()`.

To manage notifications about this bug go to:
https://bugs.launchpad.net/glibc/+bug/1861776/+subscriptions



More information about the foundations-bugs mailing list