<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en" style="--code-editor-font: var(--default-mono-font, "GitLab Mono"), JetBrains Mono, Menlo, DejaVu Sans Mono, Liberation Mono, Consolas, Ubuntu Mono, Courier New, andale mono, lucida console, monospace;">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title>
GitLab
</title>

<style data-premailer="ignore" type="text/css">
a { color: #1068bf; }
</style>

<style>img {
max-width: 100%; height: auto;
}
body {
font-size: .875rem;
}
body {
-webkit-text-shadow: hsla(0,0%,100%,.01) 0 0 1px;
}
body {
font-family: "GitLab Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Noto Sans",Ubuntu,Cantarell,"Helvetica Neue",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"; font-size: inherit;
}
</style>
</head>
<body style="font-size: inherit; -webkit-text-shadow: hsla(0,0%,100%,.01) 0 0 1px; font-family: "GitLab Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Noto Sans",Ubuntu,Cantarell,"Helvetica Neue",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";">
<div class="content">

<p class="details" style="font-style: italic; color: #626168;">
Issue created by <a href="https://gitlab.rtems.org/sebhub">Sebastian Huber</a>: <a href="https://gitlab.rtems.org/rtems/rtos/rtems/-/work_items/5741">#5741</a>
</p>
<p>
Assignee: Sebastian Huber
</p>
<div class="md" style="position: relative; z-index: 1; color: #3a383f; word-wrap: break-word;">
<h2 id="user-content-summary" dir="auto" style="margin-top: 0px; margin-bottom: 10px;" align="initial">Summary<a href="#summary" aria-label="Link to heading 'Summary'" data-heading-content="Summary" class="anchor" style="margin-top: 0px;"></a>
</h2>
<p dir="auto" style="color: #3a383f; margin: 0px 0px 1rem;" align="initial"><code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;">_Watchdog_Do_tickle()</code> marks a watchdog inactive and releases the lock of the
header before it calls the service routine. A party which frees the object of
that watchdog in this window leaves the routine on freed memory. The watchdog
has no state which tells a caller that a service routine runs. No remove path
and no delete directive can therefore wait for it.</p>
<p dir="auto" style="color: #3a383f; margin: 0px 0px 1rem;" align="initial">Five object classes of the operating system own a watchdog and can be freed.
Four of them are open to this order.</p>
<h2 id="user-content-affected-versions" dir="auto" style="margin-top: 20px; margin-bottom: 10px;" align="initial">Affected versions<a href="#affected-versions" aria-label="Link to heading 'Affected versions'" data-heading-content="Affected versions" class="anchor" style="margin-top: 0px;"></a>
</h2>
<p dir="auto" style="color: #3a383f; margin: 0px 0px 1rem;" align="initial">The window and the set of watchdog states are the same in 5.1, 5.2, 5.3, 6.1,
6.2 and main. The line numbers below are those of main at commit <a href="https://gitlab.rtems.org/rtems/rtos/rtems/-/commit/3fc18b536e9b5bdecba78606de5cf02661397a4f" title="bsps/mips/jmr3904: Run the intrcritical tests" class="gfm gfm-commit has-tooltip" data-original="3fc18b536e" data-link="false" data-link-reference="false" data-commit="3fc18b536e9b5bdecba78606de5cf02661397a4f" data-project="26" data-container="body" data-placement="top" data-reference-type="commit" style="font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; font-size: 95%; margin-top: 0px;">3fc18b53</a>.</p>
<h2 id="user-content-the-window" dir="auto" style="margin-top: 20px; margin-bottom: 10px;" align="initial">The window<a href="#the-window" aria-label="Link to heading 'The window'" data-heading-content="The window" class="anchor" style="margin-top: 0px;"></a>
</h2>
<p dir="auto" style="color: #3a383f; margin: 0px 0px 1rem;" align="initial"><code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;">cpukit/score/src/watchdogtick.c:56</code></p>
<div class="gl-relative markdown-code-block js-markdown-code">
<pre data-canonical-lang="c" class="code highlight js-syntax-highlight language-c" v-pre="true" style="display: block; font-size: 14px; color: #3a383f; line-height: 1.6em; overflow-x: auto; border-radius: .25rem; position: relative; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: break-all; word-wrap: break-word; background-color: #fbfafd; margin: 0px 0 1rem; padding: 12px; border: 1px solid #dcdcde;"><code style="font-size: inherit; color: inherit; word-wrap: normal; word-break: keep-all; background-color: inherit; border-radius: .25rem; white-space: pre; margin-top: 0px; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; overflow-wrap: normal; padding: unset;"><span id="LC1" class="line" lang="c" style="margin-top: 0px;">  <span class="k" style="margin-top: 0px;">do</span> <span class="p">{</span></span>
<span id="LC2" class="line" lang="c">    <span class="k" style="margin-top: 0px;">if</span> <span class="p">(</span> <span class="n">first</span><span class="o">-></span><span class="n">expire</span> <span class="o"><=</span> <span class="n">now</span> <span class="p">)</span> <span class="p">{</span></span>
<span id="LC3" class="line" lang="c">      <span class="n" style="margin-top: 0px;">Watchdog_Service_routine_entry</span> <span class="n">routine</span><span class="p">;</span></span>
<span id="LC4" class="line" lang="c"></span>
<span id="LC5" class="line" lang="c">      <span class="n" style="margin-top: 0px;">_Watchdog_Next_first</span><span class="p">(</span> <span class="n">header</span><span class="p">,</span> <span class="n">first</span> <span class="p">);</span></span>
<span id="LC6" class="line" lang="c">      <span class="n" style="margin-top: 0px;">_RBTree_Extract</span><span class="p">(</span> <span class="o">&</span><span class="n">header</span><span class="o">-></span><span class="n">Watchdogs</span><span class="p">,</span> <span class="o">&</span><span class="n">first</span><span class="o">-></span><span class="n">Node</span><span class="p">.</span><span class="n">RBTree</span> <span class="p">);</span></span>
<span id="LC7" class="line" lang="c">      <span class="n" style="margin-top: 0px;">_Watchdog_Set_state</span><span class="p">(</span> <span class="n">first</span><span class="p">,</span> <span class="n">WATCHDOG_INACTIVE</span> <span class="p">);</span></span>
<span id="LC8" class="line" lang="c">      <span class="n" style="margin-top: 0px;">routine</span> <span class="o">=</span> <span class="n">first</span><span class="o">-></span><span class="n">routine</span><span class="p">;</span></span>
<span id="LC9" class="line" lang="c"></span>
<span id="LC10" class="line" lang="c">      <span class="n" style="margin-top: 0px;">_ISR_lock_Release_and_ISR_enable</span><span class="p">(</span> <span class="n">lock</span><span class="p">,</span> <span class="n">lock_context</span> <span class="p">);</span></span>
<span id="LC11" class="line" lang="c">      <span class="p" style="margin-top: 0px;">(</span> <span class="o">*</span><span class="n">routine</span> <span class="p">)(</span> <span class="n">first</span> <span class="p">);</span></span>
<span id="LC12" class="line" lang="c">      <span class="n" style="margin-top: 0px;">_ISR_lock_ISR_disable_and_acquire</span><span class="p">(</span> <span class="n">lock</span><span class="p">,</span> <span class="n">lock_context</span> <span class="p">);</span></span></code></pre>
<copy-code></copy-code><insert-code-snippet></insert-code-snippet>
</div>
<p dir="auto" style="color: #3a383f; margin: 0px 0px 1rem;" align="initial">The lock of the header is free from the release to the reacquire. Another
processor runs in that span. The state of the watchdog is <code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;">WATCHDOG_INACTIVE</code>
throughout it.</p>
<h2 id="user-content-no-caller-can-see-the-routine" dir="auto" style="margin-top: 20px; margin-bottom: 10px;" align="initial">No caller can see the routine<a href="#no-caller-can-see-the-routine" aria-label="Link to heading 'No caller can see the routine'" data-heading-content="No caller can see the routine" class="anchor" style="margin-top: 0px;"></a>
</h2>
<p dir="auto" style="color: #3a383f; margin: 0px 0px 1rem;" align="initial"><code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;">cpukit/include/rtems/score/watchdogimpl.h:63</code></p>
<div class="gl-relative markdown-code-block js-markdown-code">
<pre data-canonical-lang="c" class="code highlight js-syntax-highlight language-c" v-pre="true" style="display: block; font-size: 14px; color: #3a383f; line-height: 1.6em; overflow-x: auto; border-radius: .25rem; position: relative; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: break-all; word-wrap: break-word; background-color: #fbfafd; margin: 0px 0 1rem; padding: 12px; border: 1px solid #dcdcde;"><code style="font-size: inherit; color: inherit; word-wrap: normal; word-break: keep-all; background-color: inherit; border-radius: .25rem; white-space: pre; margin-top: 0px; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; overflow-wrap: normal; padding: unset;"><span id="LC1" class="line" lang="c" style="margin-top: 0px;"><span class="k" style="margin-top: 0px;">typedef</span> <span class="k">enum</span> <span class="p">{</span></span>
<span id="LC2" class="line" lang="c">  <span class="n" style="margin-top: 0px;">WATCHDOG_SCHEDULED_BLACK</span><span class="p">,</span></span>
<span id="LC3" class="line" lang="c">  <span class="n" style="margin-top: 0px;">WATCHDOG_SCHEDULED_RED</span><span class="p">,</span></span>
<span id="LC4" class="line" lang="c">  <span class="n" style="margin-top: 0px;">WATCHDOG_INACTIVE</span><span class="p">,</span></span>
<span id="LC5" class="line" lang="c">  <span class="n" style="margin-top: 0px;">WATCHDOG_PENDING</span></span>
<span id="LC6" class="line" lang="c"><span class="p" style="margin-top: 0px;">}</span> <span class="n">Watchdog_State</span><span class="p">;</span></span></code></pre>
<copy-code></copy-code><insert-code-snippet></insert-code-snippet>
</div>
<p dir="auto" style="color: #3a383f; margin: 0px 0px 1rem;" align="initial">There is no state for a watchdog under service. A caller which reads
<code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;">WATCHDOG_INACTIVE</code> cannot tell a watchdog which never ran from one whose
routine is in flight.</p>
<p dir="auto" style="color: #3a383f; margin: 0px 0px 1rem;" align="initial"><code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;">_Timer_Cancel()</code> at <code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;">cpukit/rtems/src/timercreate.c:180</code> shows the pattern. It
removes the watchdog when the state is scheduled. It takes the watchdog off the
chain of the timer server when the state is pending. It does nothing when the
state is inactive. <code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;">rtems_timer_delete()</code> frees the object right after that
call.</p>
<h2 id="user-content-the-affected-objects" dir="auto" style="margin-top: 20px; margin-bottom: 10px;" align="initial">The affected objects<a href="#the-affected-objects" aria-label="Link to heading 'The affected objects'" data-heading-content="The affected objects" class="anchor" style="margin-top: 0px;"></a>
</h2>
<table dir="auto" style="border-spacing: 0; text-align: initial; color: #3a383f; width: auto; border-collapse: collapse; margin: 16px 0; border-width: 0;">
<thead style="margin-top: 0px;">
<tr style="margin-top: 0px;">
<th style="line-height: 1.25rem; color: #18171d; margin-top: 0px; padding: 10px 16px; border-color: #dcdcde; border-style: solid; border-width: 1px 1px 0;" valign="top">Owner</th>
<th style="line-height: 1.25rem; color: #18171d; padding: 10px 16px; border-color: #dcdcde; border-style: solid; border-width: 1px 1px 0;" valign="top">Freed by</th>
<th style="line-height: 1.25rem; color: #18171d; padding: 10px 16px; border-color: #dcdcde; border-style: solid; border-width: 1px 1px 0;" valign="top">Service routine</th>
<th style="line-height: 1.25rem; color: #18171d; padding: 10px 16px; border-color: #dcdcde; border-style: solid; border-width: 1px 1px 0;" valign="top">Open</th>
</tr>
</thead>
<tbody>
<tr style="margin-top: 0px;">
<td style="line-height: 1.25rem; margin-top: 0px; padding: 10px 16px; border: 1px solid #dcdcde;" valign="top"><code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 0.125rem 0.25rem;">Timer_Control.Ticker</code></td>
<td style="line-height: 1.25rem; padding: 10px 16px; border: 1px solid #dcdcde;" valign="top"><code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 0.125rem 0.25rem;">rtems_timer_delete()</code></td>
<td style="line-height: 1.25rem; padding: 10px 16px; border: 1px solid #dcdcde;" valign="top"><code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 0.125rem 0.25rem;">_Timer_Routine_adaptor()</code></td>
<td style="line-height: 1.25rem; padding: 10px 16px; border: 1px solid #dcdcde;" valign="top">yes</td>
</tr>
<tr>
<td style="line-height: 1.25rem; margin-top: 0px; padding: 10px 16px; border: 1px solid #dcdcde;" valign="top"><code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 0.125rem 0.25rem;">POSIX_Timer_Control.Timer</code></td>
<td style="line-height: 1.25rem; padding: 10px 16px; border: 1px solid #dcdcde;" valign="top"><code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 0.125rem 0.25rem;">timer_delete()</code></td>
<td style="line-height: 1.25rem; padding: 10px 16px; border: 1px solid #dcdcde;" valign="top"><code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 0.125rem 0.25rem;">_POSIX_Timer_TSR()</code></td>
<td style="line-height: 1.25rem; padding: 10px 16px; border: 1px solid #dcdcde;" valign="top">yes</td>
</tr>
<tr>
<td style="line-height: 1.25rem; margin-top: 0px; padding: 10px 16px; border: 1px solid #dcdcde;" valign="top">
<code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 0.125rem 0.25rem;">Thread_Control</code> timer</td>
<td style="line-height: 1.25rem; padding: 10px 16px; border: 1px solid #dcdcde;" valign="top"><code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 0.125rem 0.25rem;">_Thread_Free()</code></td>
<td style="line-height: 1.25rem; padding: 10px 16px; border: 1px solid #dcdcde;" valign="top"><code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 0.125rem 0.25rem;">_Thread_Timeout()</code></td>
<td style="line-height: 1.25rem; padding: 10px 16px; border: 1px solid #dcdcde;" valign="top">yes</td>
</tr>
<tr>
<td style="line-height: 1.25rem; margin-top: 0px; padding: 10px 16px; border: 1px solid #dcdcde;" valign="top"><code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 0.125rem 0.25rem;">POSIX_API_Control.Sporadic.Timer</code></td>
<td style="line-height: 1.25rem; padding: 10px 16px; border: 1px solid #dcdcde;" valign="top"><code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 0.125rem 0.25rem;">_Thread_Free()</code></td>
<td style="line-height: 1.25rem; padding: 10px 16px; border: 1px solid #dcdcde;" valign="top"><code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 0.125rem 0.25rem;">_POSIX_Threads_Sporadic_timer()</code></td>
<td style="line-height: 1.25rem; padding: 10px 16px; border: 1px solid #dcdcde;" valign="top">yes</td>
</tr>
<tr>
<td style="line-height: 1.25rem; margin-top: 0px; padding: 10px 16px; border: 1px solid #dcdcde;" valign="top"><code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 0.125rem 0.25rem;">Rate_monotonic_Control.Timer</code></td>
<td style="line-height: 1.25rem; padding: 10px 16px; border: 1px solid #dcdcde;" valign="top"><code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 0.125rem 0.25rem;">rtems_rate_monotonic_delete()</code></td>
<td style="line-height: 1.25rem; padding: 10px 16px; border: 1px solid #dcdcde;" valign="top"><code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 0.125rem 0.25rem;">_Rate_monotonic_Timeout()</code></td>
<td style="line-height: 1.25rem; padding: 10px 16px; border: 1px solid #dcdcde;" valign="top">yes</td>
</tr>
<tr>
<td style="line-height: 1.25rem; margin-top: 0px; padding: 10px 16px; border: 1px solid #dcdcde;" valign="top"><code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 0.125rem 0.25rem;">Record_Control.Watchdog</code></td>
<td style="line-height: 1.25rem; padding: 10px 16px; border: 1px solid #dcdcde;" valign="top">never, one per processor</td>
<td style="line-height: 1.25rem; padding: 10px 16px; border: 1px solid #dcdcde;" valign="top">none</td>
<td style="line-height: 1.25rem; padding: 10px 16px; border: 1px solid #dcdcde;" valign="top">no</td>
</tr>
</tbody>
</table>
<h2 id="user-content-what-each-routine-does-to-the-freed-object" dir="auto" style="margin-top: 20px; margin-bottom: 10px;" align="initial">What each routine does to the freed object<a href="#what-each-routine-does-to-the-freed-object" aria-label="Link to heading 'What each routine does to the freed object'" data-heading-content="What each routine does to the freed object" class="anchor" style="margin-top: 0px;"></a>
</h2>
<h3 id="user-content-rtems_timer_delete" dir="auto" style="margin-top: 1.5rem; margin-bottom: 1rem; font-weight: 600; font-size: 1.125rem; letter-spacing: inherit; line-height: 1.25; color: #18171d;" align="initial">rtems_timer_delete()<a href="#rtems_timer_delete" aria-label="Link to heading 'rtems_timer_delete()'" data-heading-content="rtems_timer_delete()" class="anchor" style="margin-top: 0px;"></a>
</h3>
<p dir="auto" style="color: #3a383f; margin: 0px 0px 1rem;" align="initial"><code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;">cpukit/rtems/src/timerdelete.c:57</code> cancels the timer and line 59 frees the
object. <code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;">_Timer_Routine_adaptor()</code> at <code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;">cpukit/rtems/src/timercreate.c:62</code>
writes <code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;">the_timer->stop_time</code> and then runs line 71.</p>
<div class="gl-relative markdown-code-block js-markdown-code">
<pre data-canonical-lang="c" class="code highlight js-syntax-highlight language-c" v-pre="true" style="display: block; font-size: 14px; color: #3a383f; line-height: 1.6em; overflow-x: auto; border-radius: .25rem; position: relative; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: break-all; word-wrap: break-word; background-color: #fbfafd; margin: 0px 0 1rem; padding: 12px; border: 1px solid #dcdcde;"><code style="font-size: inherit; color: inherit; word-wrap: normal; word-break: keep-all; background-color: inherit; border-radius: .25rem; white-space: pre; margin-top: 0px; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; overflow-wrap: normal; padding: unset;"><span id="LC1" class="line" lang="c" style="margin-top: 0px;">  <span class="p" style="margin-top: 0px;">(</span> <span class="o">*</span><span class="n">the_timer</span><span class="o">-></span><span class="n">routine</span> <span class="p">)(</span> <span class="n">the_timer</span><span class="o">-></span><span class="n">Object</span><span class="p">.</span><span class="n">id</span><span class="p">,</span> <span class="n">the_timer</span><span class="o">-></span><span class="n">user_data</span> <span class="p">);</span></span></code></pre>
<copy-code></copy-code><insert-code-snippet></insert-code-snippet>
</div>
<p dir="auto" style="color: #3a383f; margin: 0px 0px 1rem;" align="initial">It reads the function pointer and both arguments out of the freed object. A
<code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;">Timer_Control</code> which the allocator gave away carries the routine of another
timer.</p>
<h3 id="user-content-timer_delete" dir="auto" style="margin-top: 1.5rem; margin-bottom: 1rem; font-weight: 600; font-size: 1.125rem; letter-spacing: inherit; line-height: 1.25; color: #18171d;" align="initial">timer_delete()<a href="#timer_delete" aria-label="Link to heading 'timer_delete()'" data-heading-content="timer_delete()" class="anchor" style="margin-top: 0px;"></a>
</h3>
<p dir="auto" style="color: #3a383f; margin: 0px 0px 1rem;" align="initial"><code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;">cpukit/posix/src/psxtimerdelete.c:74</code> removes the watchdog and line 79 frees
the object. <code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;">_POSIX_Timer_TSR()</code> at <code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;">cpukit/posix/src/timersettime.c:74</code> writes
<code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;">ptimer->overrun</code>. A periodic timer reaches <code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;">_POSIX_Timer_Insert()</code> at line 92,
which puts the node of the freed object back into the tree of the processor.
Line 105 then runs.</p>
<div class="gl-relative markdown-code-block js-markdown-code">
<pre data-canonical-lang="c" class="code highlight js-syntax-highlight language-c" v-pre="true" style="display: block; font-size: 14px; color: #3a383f; line-height: 1.6em; overflow-x: auto; border-radius: .25rem; position: relative; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: break-all; word-wrap: break-word; background-color: #fbfafd; margin: 0px 0 1rem; padding: 12px; border: 1px solid #dcdcde;"><code style="font-size: inherit; color: inherit; word-wrap: normal; word-break: keep-all; background-color: inherit; border-radius: .25rem; white-space: pre; margin-top: 0px; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; overflow-wrap: normal; padding: unset;"><span id="LC1" class="line" lang="c" style="margin-top: 0px;">  <span class="k" style="margin-top: 0px;">if</span> <span class="p">(</span> <span class="n">pthread_kill</span><span class="p">(</span> <span class="n">ptimer</span><span class="o">-></span><span class="n">thread_id</span><span class="p">,</span> <span class="n">ptimer</span><span class="o">-></span><span class="n">inf</span><span class="p">.</span><span class="n">sigev_signo</span> <span class="p">)</span> <span class="p">)</span> <span class="p">{</span></span></code></pre>
<copy-code></copy-code><insert-code-snippet></insert-code-snippet>
</div>
<p dir="auto" style="color: #3a383f; margin: 0px 0px 1rem;" align="initial">Both arguments come out of the freed object.</p>
<h3 id="user-content-task-delete" dir="auto" style="margin-top: 1.5rem; margin-bottom: 1rem; font-weight: 600; font-size: 1.125rem; letter-spacing: inherit; line-height: 1.25; color: #18171d;" align="initial">Task delete<a href="#task-delete" aria-label="Link to heading 'Task delete'" data-heading-content="Task delete" class="anchor" style="margin-top: 0px;"></a>
</h3>
<p dir="auto" style="color: #3a383f; margin: 0px 0px 1rem;" align="initial"><code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;">_Thread_Make_zombie()</code> calls <code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;">_Thread_Timer_remove_and_continue()</code> at
<code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;">cpukit/score/src/threadrestart.c:135</code>. That call meets the window and removes
nothing. <code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;">_Thread_Kill_zombies()</code> frees the thread at line 184. It waits at
line 155 for the thread to leave its processor. It waits for no service
routine. <code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;">_Thread_Timeout()</code> then reads and writes the wait flags of a freed
thread and can unblock it.</p>
<p dir="auto" style="color: #3a383f; margin: 0px 0px 1rem;" align="initial">The timer of a thread carries every timed wait of the operating system, so this
case has the widest reach. The sporadic server timer of a POSIX thread sits in
the same storage. See <code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;">cpukit/include/rtems/posix/threadsup.h:77</code>.</p>
<h3 id="user-content-rtems_rate_monotonic_delete" dir="auto" style="margin-top: 1.5rem; margin-bottom: 1rem; font-weight: 600; font-size: 1.125rem; letter-spacing: inherit; line-height: 1.25; color: #18171d;" align="initial">rtems_rate_monotonic_delete()<a href="#rtems_rate_monotonic_delete" aria-label="Link to heading 'rtems_rate_monotonic_delete()'" data-heading-content="rtems_rate_monotonic_delete()" class="anchor" style="margin-top: 0px;"></a>
</h3>
<p dir="auto" style="color: #3a383f; margin: 0px 0px 1rem;" align="initial"><code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;">cpukit/rtems/src/ratemondelete.c:56</code> cancels the period and line 57 frees the
object. The directive tests no owner, so every task may call it.
<code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;">_Rate_monotonic_Timeout()</code> reads the owner of the period out of the freed
object, takes the lock of that object and can end a period wait of the thread
which it names.</p>
<h2 id="user-content-reproducer" dir="auto" style="margin-top: 20px; margin-bottom: 10px;" align="initial">Reproducer<a href="#reproducer" aria-label="Link to heading 'Reproducer'" data-heading-content="Reproducer" class="anchor" style="margin-top: 0px;"></a>
</h2>
<p dir="auto" style="color: #3a383f; margin: 0px 0px 1rem;" align="initial">The test builds the order for the rate monotonic period on one
processor. The link wraps <code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;">_Rate_monotonic_Timeout()</code>. The wrapper keeps the
watchdog, wakes a master task and returns without a call of the real routine,
which leaves the state of the window as it is. The master then carries out the
work of the window in task context and calls the real routine itself.</p>
<ol dir="auto" style="text-align: initial; margin: 0px 0px 1rem; padding: 0;">
<li style="margin-top: 0px; line-height: 1.6em; margin-left: 25px; padding-left: 3px;">Task A creates a period and calls <code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 0.125rem 0.25rem;">rtems_rate_monotonic_period()</code> once. The
call arms the timer and returns, so the window opens without a wait of A.</li>
<li style="line-height: 1.6em; margin-left: 25px; padding-left: 3px;">The clock tick interrupt reaches the wrapper.</li>
<li style="line-height: 1.6em; margin-left: 25px; padding-left: 3px;">The master calls <code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 0.125rem 0.25rem;">rtems_rate_monotonic_delete()</code>.</li>
<li style="line-height: 1.6em; margin-left: 25px; padding-left: 3px;">Task B calls <code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; white-space: pre-wrap; overflow-wrap: break-word; word-break: keep-all; padding: 0.125rem 0.25rem;">rtems_rate_monotonic_create()</code>. The configuration holds one
period, so the allocator gives B the object which the delete freed. B enters
its period and waits on it.</li>
<li style="line-height: 1.6em; margin-left: 25px; padding-left: 3px;">The master calls the real routine.</li>
</ol>
<p dir="auto" style="color: #3a383f; margin: 0px 0px 1rem;" align="initial">The test reports eight rounds out of eight in which the object address of B
matched the object address of A, and eight rounds in which the routine ended
the period wait of B. It reproduces on <code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;">sparc/gr740</code> with and without
<code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;">RTEMS_SMP</code> and with and without <code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;">RTEMS_DEBUG</code>.</p>
<p dir="auto" style="color: #3a383f; margin: 0px 0px 1rem;" align="initial">A real system reaches the order on an SMP configuration. The tickle runs in the
clock tick interrupt, and every delete directive above obtains the object
allocator mutex, which no interrupt handler may do. The delete therefore runs
on another processor while the routine is in flight.</p>
<h2 id="user-content-suggested-repair" dir="auto" style="margin-top: 20px; margin-bottom: 10px;" align="initial">Suggested repair<a href="#suggested-repair" aria-label="Link to heading 'Suggested repair'" data-heading-content="Suggested repair" class="anchor" style="margin-top: 0px;"></a>
</h2>
<p dir="auto" style="color: #3a383f; margin: 0px 0px 1rem;" align="initial">A per object counter does not close this. Every one of the routines above would
read the counter out of the object which it must not touch.</p>
<p dir="auto" style="color: #3a383f; margin: 0px 0px 1rem;" align="initial">The repair belongs to the watchdog. <code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;">_Watchdog_Do_tickle()</code> publishes the
watchdog which it is about to service. A caller which is about to free the
owner waits until that publication clears. All five delete paths run in task
context under the object allocator lock, so they can afford to wait.</p>
<p dir="auto" style="color: #3a383f; margin: 0px 0px 1rem;" align="initial">The ordinary remove paths must not wait. <code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;">_Thread_Timer_remove()</code> runs from
interrupt context, and an interrupt which preempted the routine on its own
processor would spin without an end. A separate call for the free paths keeps
the two apart.</p>
<h2 id="user-content-a-second-defect-of-the-same-window" dir="auto" style="margin-top: 20px; margin-bottom: 10px;" align="initial">A second defect of the same window<a href="#a-second-defect-of-the-same-window" aria-label="Link to heading 'A second defect of the same window'" data-heading-content="A second defect of the same window" class="anchor" style="margin-top: 0px;"></a>
</h2>
<p dir="auto" style="color: #3a383f; margin: 0px;" align="initial">The same window produces a defect which does not need a free. A party which
ends the wait of a thread in the window leaves the routine to act on the next
wait of that thread. The thread then reports <code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0px; font-weight: inherit; overflow-wrap: break-word; white-space: break-spaces; font-family: "GitLab Mono", "JetBrains Mono", "Menlo", "DejaVu Sans Mono", "Liberation Mono", "Consolas", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; font-variant-ligatures: none; word-break: keep-all; padding: 0.125rem 0.25rem;">STATUS_TIMEOUT</code> for a wait which
did not time out, or the watchdog of a new timed wait stays in the tree and the
next insert of that node breaks the red-black tree of the processor. This
report does not cover that defect. See also <a href="https://gitlab.rtems.org/rtems/rtos/rtems/-/work_items/5733" title="A timeout of a wait which ended may cancel the next wait" class="gfm gfm-issue" data-original="#5733" data-link="false" data-link-reference="false" data-issue="29959" data-project="26" data-iid="5733" data-namespace-path="rtems/rtos/rtems" data-project-path="rtems/rtos/rtems" data-issue-type="issue" data-container="body" data-placement="top" data-reference-type="issue">#5733</a>.</p>
</div>

</div>
<div class="footer" style="margin-top: 10px;">
<p style="font-size: small; color: #626168;">

<br>
<a href="https://gitlab.rtems.org/rtems/rtos/rtems/-/work_items/5741">View it on GitLab</a>.
<br>
You're receiving this email because of your account on <a target="_blank" rel="noopener noreferrer" href="https://gitlab.rtems.org">gitlab.rtems.org</a>. <a href="https://gitlab.rtems.org/-/sent_notifications/5-97n8yiebb9w8eu8wtx99z8fcy-1d/unsubscribe" target="_blank" rel="noopener noreferrer">Unsubscribe</a> from this thread · <a href="https://gitlab.rtems.org/-/profile/notifications" target="_blank" rel="noopener noreferrer" class="mng-notif-link">Manage all notifications</a> · <a href="https://gitlab.rtems.org/help" target="_blank" rel="noopener noreferrer" class="help-link">Help</a>
<span style="color: transparent; font-size: 0; display: none; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0;">
Notification message regarding https://gitlab.rtems.org/rtems/rtos/rtems/-/work_items/5741 at 1788400896
</span>
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Work item","url":"https://gitlab.rtems.org/rtems/rtos/rtems/-/work_items/5741"}}</script>


</p>
</div>
</body>
</html>