Skip to content

Consistent segmentation faults upon creating directories #36

Open

Description

@GSI

I can consistently crash incrond 0.5.12 with a single mkdir command.

incrontab:

/tmp/i IN_CREATE echo $@/$# $%

Journal output upon mkdir /tmp/i/del:

incrond[13604]: PATH (/tmp/i) FILE (del) EVENT (IN_CREATE,IN_ISDIR)
systemd[1]: incrond.service: Main process exited, code=dumped, status=11/SEGV
systemd[1]: incrond.service: Unit entered failed state.
systemd[1]: incrond.service: Failed with result 'core-dump'.

Backtrace:

(gdb) bt
#0  0x00007f07242bc3e8 in memchr () from /usr/lib/libc.so.6
#1  0x00007f07249138aa in std::char_traits<char>::find (__a=<synthetic pointer>: <optimized out>, __n=<optimized out>,
    __s=<optimized out>) at /build/gcc-multilib/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/char_traits.h:274
#2  std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::find (this=<optimized out>, __c=<optimized out>,
    __pos=<optimized out>) at /build/gcc-multilib/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:1209
#3  0x000000000040fd71 in ?? ()
#4  0x000000000041060e in ?? ()
#5  0x0000000000404412 in ?? ()
#6  0x00007f0724259291 in __libc_start_main () from /usr/lib/libc.so.6
#7  0x0000000000405249 in ?? ()

Observations:

  • File creation (touch) does not cause the issue. Only directories;
  • When leaving out the $@, the command runs just fine (/tmp/i IN_CREATE echo /$# $%)
  • I confirmed the behaviour on tmpfs and ext4.

Activity

  1. UnitedMarsupials-zz commented on Nov 14, 2017

    @UnitedMarsupials-zz
    Contributor

    Could you build the daemon with -O0 -g flags and reproduce the problem? The gdb stack should be much nicer then...

  2. galaxy4public commented on Mar 3, 2018

    @galaxy4public

    This is a very consistent bug -- and @GSI provided exact steps to reproduce it. Unfortunately, an year later this issue is still open and is biting people who are trying to use incrond.

    The bug is between lines usertable.cpp#L390 and usertable.cpp#L408 where incrond "forgets" and reloads itself, then tries to process an event it just forgot about :)

  3. added a commit that references this issue on Mar 3, 2018
    134900e
  4. frayber commented on Mar 8, 2019

    @frayber

    I have 0.5.12 too on a centos 7, same behaviour,moreover sometimes a huge number of incrond processes appear which freezes the system (load1 up to 2000!), with a lot of messages like these:

    auditd[766]: dispatch error reporting limit reached - ending report notification.
    auditd[766]: dispatch err (pipe full) event lost

    Thank you.

  5. Nikoh77 commented on Jan 3, 2021

    @Nikoh77

    hi guys, i am same problem, is incron stiil in development?
    This bug is a big bug... can someone investigate and solve please?
    I am on ubuntu server 20.04 and incron 5.12

  6. patricksebastien commented on Feb 15, 2023

    @patricksebastien

    Same problem, on verion 0.5.12. Anyone reading this and cannot wait for @ar- to work on this:

    checkout this commit from @galaxy4public
    galaxy4public@134900e

    make & make install
    cp incrond /usr/sbin/incrond
    
  7. anzz1 commented on Sep 6, 2025

    @anzz1

    thank you @patricksebastien and @galaxy4public , that worked. In Debian 12 (bookworm) this crash indeed occurs on directory creation events which makes incrond basically useless.

    full spell to fix the problem on debian 12

    apt-get install incron
    cd /usr/local/src
    git clone https://github.com/anzz1/incron.git
    cd incron
    make
    service incron stop
    cp incrond /usr/sbin/incrond
    service incron start

    edit: changed to my own branch which also includes a fix for GetSafePath

  8. added a commit that references this issue on Sep 6, 2025
    afdfb4c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions