[RTEMS Project] #4216: prinf/vsnprintf crash when used in interrupt context

RTEMS trac trac at rtems.org
Wed Jan 20 10:03:53 UTC 2021

#4216: prinf/vsnprintf crash when used in interrupt context
 Reporter:  ceasar    |       Owner:  (none)
     Type:  defect    |      Status:  closed
 Priority:  high      |   Milestone:
Component:  arch/arm  |     Version:  4.11
 Severity:  major     |  Resolution:  invalid
 Keywords:            |  Blocked By:
 Blocking:            |

Comment (by ceasar):

 Hi Sebastian ,

 What you said any of the printf() functions in interrupt context is
 undefined is really true.  I wrongly thought only float/double data print
 by printf() in interrupt context would crash, but int play the same. after
 a test.

 I show you the background why i get the wrong thought. I implemented a
 system logger feature which supply LOG_I/LOG_E/LOG_W interface to format
 and record logs to the storage device in RTEMS, supported both in thread
 and interrupt. Logs in interrupt context formatted to a string by
 vsnprintf firstly and then send to a async handler task by using message
 queue. Teammate raise an issue said float/double data  deliver to LOG_X
 interface in interrupt context would crash OS.

 After a deep dig, i found the stack as follows:
 an data abort exception happened in d2b() function. So i just want to
 double check vsnprintf() function have the same defect as printf().

 BTW can you tell me why printf function can't used in interrupt? I heard
 if irq handler cost more than 1ms RTEMS would go wrong in some way.

Ticket URL: <http://devel.rtems.org/ticket/4216#comment:2>
RTEMS Project <http://www.rtems.org/>
RTEMS Project

More information about the bugs mailing list