<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Journald can cause an endless loop"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=76886">76886</a>
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>systemd-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Journald can cause an endless loop
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>systemd-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux (All)
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>bartlomiej.gluch.ext@nsn.com
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>ARM
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>general
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>systemd
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Systemd version 211
Linux kernel 3.13.3
ARMv7 based embedded system

It is possible o create an endless loop, when I2C device or power supply
exists, but only with one of following kernel configs enabled:
CONFIG_POWER_SUPPLY_DEBUG
CONFIG_I2C_DEBUG_CORE

Both of this flags enables debug printout of function dev_dbg() in kernel in
following files:
drivers/power/power_supply_sysfs.c (line265, function power_supply_uevent())
drivers/i2c/i2c-core.c (line 102, function i2c_device_uevent())

dev_dbg creates an syslog entry - which triggers journald to read uevent file
for this device, which than again dev_dbg() is called causing journald to read
uevent file - so there is an endless loop (technically, kernel will kill
journald after some time)


Situation with CONFIG_POWER_SUPPLY_DEBUG is not observed in my system, but it
is described here:
<a href="http://forums.gentoo.org/viewtopic-t-977530-postdays-0-postorder-asc-start-0.html">http://forums.gentoo.org/viewtopic-t-977530-postdays-0-postorder-asc-start-0.html</a>

The reasons are the same as for I2C, uevent function 

Result of the bug:

If the kernel is started with "debug" in the bootargs, as soon as the udev
starts there is an loop of debug outputs, making system unusable, after 10-12
minutes journald is killed.

If the kernel is started with loglevel=0 system is usable, but logs are filled
with debug output.

Dump stack in uevent function shows that each time uevent was triggered by
SySFS read/write:

[<c0422f94>] (unwind_backtrace+0x0/0xf8) from [<c041edac>]
(show_stack+0x10/0x14)
[<c041edac>] (show_stack+0x10/0x14) from [<c09151b4>] (dump_stack+0x74/0x90)
[<c09151b4>] (dump_stack+0x74/0x90) from [<c07e0760>]
(i2c_sysfs_new_device+0xf8/0x20c)
[<c07e0760>] (i2c_sysfs_new_device+0xf8/0x20c) from [<c06f2df4>]
(dev_attr_store+0x18/0x24)
[<c06f2df4>] (dev_attr_store+0x18/0x24) from [<c0536d54>]
(sysfs_write_file+0x14c/0x1dc)
[<c0536d54>] (sysfs_write_file+0x14c/0x1dc) from [<c04df208>]
(vfs_write+0xa8/0x1b0)
[<c04df208>] (vfs_write+0xa8/0x1b0) from [<c04df638>] (SyS_write+0x3c/0x70)
[<c04df638>] (SyS_write+0x3c/0x70) from [<c041b560>]
(ret_fast_syscall+0x0/0x30)


lsof -r1 | grep /sys/devices/2010085000.i2c/i2c-1/1-0054/uevent

systemd-j 146           root   12r      REG       0,13     4096       6833
/sys/devices/2010085000.i2c/i2c-1/1-0054/uevent


Bug can be workarounded in kernel by changing dev_dbg() to pr_debug() in uevent
functions.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>