Package: pagein
Version: 0.00.03-1
Severity: important

Dear Maintainer,

*** Reporter, please consider answering these questions, where appropriate ***

   * What led up to the situation?
   * What exactly did you do (or not do) that was effective (or
     ineffective)?
   * What was the outcome of this action?
   * What outcome did you expect instead?

*** End of the template - remove these template lines ***

Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
From: Ben Wiederhake <benwiederhake.git...@gmx.de>
To: Debian Bug Tracking System <sub...@bugs.debian.org>
Subject: pagein: Segfaults roughly every 1 in ten executions
Message-ID: <149796559606.22041.12836038062408551702.reportbug@bewied-eeepc>
X-Mailer: reportbug 7.1.7
Date: Tue, 20 Jun 2017 15:33:16 +0200

Package: pagein
Version: 0.00.03-1
Severity: normal

Dear Maintainer,

How to reproduce:

    user@machine:/$ sudo -s
    root@machine:/# pagein -a -v
    root@machine:/# pagein -a -v
    root@machine:/# pagein -a -v
    root@machine:/# pagein -a -v
                    # You get the idea.

Expected results:
Runs without issues, as described in the man page

Actual results:
Sometimes, it crashed without apparent reason.

Potentially relevant:
- 'pagein -a' also crashes, and more reliably.
- Architecture is i686.
- 1 GiB of physical RAM, and "swap in use" is greater than "mem free" according 
to /usr/bin/free
  (I know, that just shuffles around the pages; but still, it shouldn't 
segfault.)
- Running this on a specific process, e.g. smartd (which runs as root,
  and happened to be PID 510 during my tests) also exhibits the bug.
- Running this on a specific "luser" process as non-root also exhibits the bug.
- Adding a bit of printf debugging reveals which process it's looking at when 
it crashes:
  Sample from three attempts: smartd (510), policykit (574), reportbug (22041), 
exim4 (907)
  I don't see any pattern.
- Recompiling from source (apt-get source and 'make' instead of using Debian 
tools)
  also segfaults.  I have the impression that it's more seldom, but that may be 
subjective.
- Running this in gdb apparently "fixes it".
  (Set a breakpoint on exit with 'run -p 510 -v', fetch a cup of hot chocolate,
  see that it doesn't crash even after a hundred runs.)
- Running this in valgrind apparently "fixes it".
- Apparently valgrind and gdb change the timing a bit, and the segfault is due 
to a race
  condition of some kind.  That could even explain the slight increase in 
reliability after adding
  printf's into the loop of 'pagein_all_procs'.
- If that's the case, then '--show-mismatched-frees=no --keep-stacktraces=none 
--leak-resolution=low'
  doesn't make valgrind fast enough to cause the segfault there.
- Doing some printf-debugging, it seems that it always crashes "towards the 
end", but still in 'pagein_proc'.
  Any further printf-debugging slows the program down sufficiently to prevent 
it from crashing.

What else could I test?

Cheers,
Ben Wiederhake

-- System Information:
Debian Release: 9.0
  APT prefers testing
  APT policy: (500, 'testing'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 4.9.0-3-686-pae (SMP w/2 CPU cores)
Locale: LANG=de_DE.utf8, LC_CTYPE=de_DE.utf8 (charmap=UTF-8), 
LANGUAGE=de_DE.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages pagein depends on:
ii  libc6  2.24-11

pagein recommends no packages.

pagein suggests no packages.

-- no debconf information

-- System Information:
Debian Release: 9.0
  APT prefers testing
  APT policy: (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.9.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), 
LANGUAGE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages pagein depends on:
ii  libc6  2.24-11

pagein recommends no packages.

pagein suggests no packages.

Reply via email to