<!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: rgba(255,255,255,.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: rgba(255,255,255,.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 style="color: #777777;">
<a href="https://gitlab.rtems.org/Chandanuvm">Chandan U</a>
<a href="https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5491#note_143340">commented</a>:
</p>
<div class="md" style="position: relative; z-index: 1; color: #3a383f; word-wrap: break-word;">
<p dir="auto" style="color: #3a383f; margin: 0 0 1rem;" align="initial">hello <a href="https://gitlab.rtems.org/gedare" title="Gedare Bloom" class="gfm gfm-project_member js-user-link" data-user="8" data-original="@gedare" data-container="body" data-placement="top" data-reference-type="user" style="color: #284779; background-color: #cbe2f9; border-radius: .25rem; margin-top: 0; padding: 0 2px;">@gedare</a> <a href="https://gitlab.rtems.org/joel" title="Joel Sherrill" class="gfm gfm-project_member js-user-link" data-user="7" data-original="@joel" data-container="body" data-placement="top" data-reference-type="user" style="color: #284779; background-color: #cbe2f9; border-radius: .25rem; padding: 0 2px;">@joel</a> from all the guidance and suggestions i recieved, i carefully reproduced the bug. There are 3-4 bug fixation needed, i'm documenting each bug fix seperately.</p>
<h2 id="user-content-1st-bug-" dir="auto" style="margin-top: 20px; margin-bottom: 10px;" align="initial">1st BUG:-<a href="#1st-bug-" aria-label="Link to heading '1st BUG:-'" data-heading-content="1st BUG:-" class="anchor" style="margin-top: 0;"></a>
</h2>
<p dir="auto" style="color: #3a383f; margin: 0 0 1rem;" align="initial">I compiled the testsuites for the configuration, <strong style="font-weight: 600; margin-top: 0;">SMP=true</strong> and <strong style="font-weight: 600;">DEBUG=TRUE/FALSE</strong>,</p>
<p dir="auto" style="color: #3a383f; margin: 0 0 1rem;" align="initial"><strong style="font-weight: 600; margin-top: 0;">Before:</strong></p>
<p dir="auto" style="color: #3a383f; margin: 0 0 1rem;" align="initial"><a class="no-attachment-icon gfm" href="https://gitlab.rtems.org/-/project/26/uploads/5df373443d833feff55ec7a8ef0a0a03/Screenshot_from_2026-02-23_23-14-24.png" target="_blank" rel="noopener noreferrer" data-canonical-src="/uploads/5df373443d833feff55ec7a8ef0a0a03/Screenshot_from_2026-02-23_23-14-24.png" data-link="true" style="margin-top: 0;"><img src="https://gitlab.rtems.org/-/project/26/uploads/5df373443d833feff55ec7a8ef0a0a03/Screenshot_from_2026-02-23_23-14-24.png" alt="Screenshot from 2026-02-23 23-14-24.png" width="240" height="145" data-canonical-src="/uploads/5df373443d833feff55ec7a8ef0a0a03/Screenshot_from_2026-02-23_23-14-24.png" class="gfm" style="max-width: 100%; height: auto; margin-top: 0; vertical-align: baseline; object-fit: contain; object-position: top;"></a></p>
<p dir="auto" style="color: #3a383f; margin: 0 0 1rem;" align="initial">I generated the logs and checked for the first file which generated the bug,</p>
<p dir="auto" style="color: #3a383f; margin: 0 0 1rem;" align="initial"><a class="no-attachment-icon gfm" href="https://gitlab.rtems.org/-/project/26/uploads/95b2ea5857408fc2bc25270051b30828/Screenshot_from_2026-02-23_22-37-46.png" target="_blank" rel="noopener noreferrer" data-canonical-src="/uploads/95b2ea5857408fc2bc25270051b30828/Screenshot_from_2026-02-23_22-37-46.png" data-link="true" style="margin-top: 0;"><img src="https://gitlab.rtems.org/-/project/26/uploads/95b2ea5857408fc2bc25270051b30828/Screenshot_from_2026-02-23_22-37-46.png" alt="Screenshot from 2026-02-23 22-37-46.png" width="621" height="600" data-canonical-src="/uploads/95b2ea5857408fc2bc25270051b30828/Screenshot_from_2026-02-23_22-37-46.png" class="gfm" style="max-width: 100%; height: auto; margin-top: 0; vertical-align: baseline; object-fit: contain; object-position: top;"></a></p>
<p dir="auto" style="color: #3a383f; margin: 0 0 1rem;" align="initial">from this i ran the file using GDB to debug it, and got the function calls through back tracing which led to the assertion,</p>
<p dir="auto" style="color: #3a383f; margin: 0 0 1rem;" align="initial"><a class="no-attachment-icon gfm" href="https://gitlab.rtems.org/-/project/26/uploads/899500dbbafecc87d600f7f84f58d941/Screenshot_from_2026-02-23_22-44-15.png" target="_blank" rel="noopener noreferrer" data-canonical-src="/uploads/899500dbbafecc87d600f7f84f58d941/Screenshot_from_2026-02-23_22-44-15.png" data-link="true" style="margin-top: 0;"><img src="https://gitlab.rtems.org/-/project/26/uploads/899500dbbafecc87d600f7f84f58d941/Screenshot_from_2026-02-23_22-44-15.png" alt="Screenshot from 2026-02-23 22-44-15.png" width="670" height="259" data-canonical-src="/uploads/899500dbbafecc87d600f7f84f58d941/Screenshot_from_2026-02-23_22-44-15.png" class="gfm" style="max-width: 100%; height: auto; margin-top: 0; vertical-align: baseline; object-fit: contain; object-position: top;"></a></p>
<p dir="auto" style="color: #3a383f; margin: 0 0 1rem;" align="initial">from this i looked into the relevant code files and understood the flow,</p>
<p dir="auto" style="color: #3a383f; margin: 0 0 1rem;" align="initial"><a class="no-attachment-icon gfm" href="https://gitlab.rtems.org/-/project/26/uploads/7e45bf4cbf29fc6f5729c3a520493eaa/WhatsApp_Image_2026-02-23_at_23.32.42.jpeg" target="_blank" rel="noopener noreferrer" data-canonical-src="/uploads/7e45bf4cbf29fc6f5729c3a520493eaa/WhatsApp_Image_2026-02-23_at_23.32.42.jpeg" data-link="true" style="margin-top: 0;"><img src="https://gitlab.rtems.org/-/project/26/uploads/7e45bf4cbf29fc6f5729c3a520493eaa/WhatsApp_Image_2026-02-23_at_23.32.42.jpeg" alt="WhatsApp Image 2026-02-23 at 23.32.42.jpeg" width="900" height="486" data-canonical-src="/uploads/7e45bf4cbf29fc6f5729c3a520493eaa/WhatsApp_Image_2026-02-23_at_23.32.42.jpeg" class="gfm" style="max-width: 100%; height: auto; margin-top: 0; vertical-align: baseline; object-fit: contain; object-position: top;"></a></p>
<p dir="auto" style="color: #3a383f; margin: 0 0 1rem;" align="initial">Clearly the smp01.c code tried to print something to the screen. To do this safely (so two CPUs don't write over each other), it tried to grab a Semaphore.</p>
<p dir="auto" style="color: #3a383f; margin: 0 0 1rem;" align="initial">So it wanted a free semaphore , and it called Semaphore_Get_flags which checks if the chain is free by _Chain_is_node_off_chain(), But semaphores store their flags in prev pointer, Since the _Chain_is_node_off_chain() got stricter in debug mode i.e asserts if prev!=null it was throwing error.</p>
<p dir="auto" style="color: #3a383f; margin: 0 0 1rem;" align="initial">But prev need not be cleared for a free chain, Since its prev eventually gets replaced with new flags , so only next==null check is enough.</p>
<p dir="auto" style="color: #3a383f; margin: 0 0 1rem;" align="initial">Bug fix solution proposed, replace <code style="font-size: 90%; color: #18171d; word-wrap: break-word; background-color: #ececef; border-radius: .25rem; margin-top: 0; 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;">_Assert( _Chain_Is_node_off_chain( &the_semaphore->Object.Node ) );</code> with <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;">_Assert( the_semaphore->Object.Node.next == NULL );</code> in the <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;">_Semaphore_Get_flags</code> function. Similarly for the <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;">_Semaphore_Set_flags</code> function.</p>
<p dir="auto" style="color: #3a383f; margin: 0 0 1rem;" align="initial"><strong style="font-weight: 600; margin-top: 0;">After:</strong></p>
<p dir="auto" style="color: #3a383f; margin: 0 0 1rem;" align="initial"><a class="no-attachment-icon gfm" href="https://gitlab.rtems.org/-/project/26/uploads/656a47425536fd1f758d4455b012d2b0/Screenshot_from_2026-02-23_23-13-47.png" target="_blank" rel="noopener noreferrer" data-canonical-src="/uploads/656a47425536fd1f758d4455b012d2b0/Screenshot_from_2026-02-23_23-13-47.png" data-link="true" style="margin-top: 0;"><img src="https://gitlab.rtems.org/-/project/26/uploads/656a47425536fd1f758d4455b012d2b0/Screenshot_from_2026-02-23_23-13-47.png" alt="Screenshot from 2026-02-23 23-13-47.png" width="225" height="141" data-canonical-src="/uploads/656a47425536fd1f758d4455b012d2b0/Screenshot_from_2026-02-23_23-13-47.png" class="gfm" style="max-width: 100%; height: auto; margin-top: 0; vertical-align: baseline; object-fit: contain; object-position: top;"></a></p>
<p dir="auto" style="color: #3a383f; margin: 0 0 1rem;" align="initial">The new failures are from new bug and are dealt seperately and will be documented seperately.</p>
<p dir="auto" style="color: #3a383f; margin: 0 0 1rem;" align="initial">Please guide me in this, Thank you.</p>
<p dir="auto" style="color: #3a383f; margin: 0;" align="initial">I have updated the MR with the first bug fix, <a href="https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1067" title="cpukit: fix off-chain state checks and pointer clearing" class="gfm gfm-merge_request" data-original="https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1067" data-link="false" data-link-reference="true" data-merge-request="2194" data-project="26" data-project-path="rtems/rtos/rtems" data-iid="1067" data-container="body" data-placement="top" data-reference-type="merge_request" style="margin-top: 0;">!1067</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/-/issues/5491#note_143340">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/2-51yfa0ocph5e8aupxxttng24u/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/-/issues/5491#note_143340 at 1771874057
</span>
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Issue","url":"https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5491#note_143340"}}</script>
</p>
</div>
</body>
</html>