Chris Johns created an issue: 
https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5254



## Summary

With `RTEMS_DEBUG` enabled the PC ATA driver asserts with a failure because a 
node's link pointer is not set to `NULL`. The assert is:

```
assertion "_Chain_Is_node_off_chain( the_node )" failed: file 
"../../../cpukit/include/rtems/score/chainimpl.h", line 691, function: 
_Chain_Append_unprotected
```

A back trace is:

```
(gdb) bt
#0  0x00162c55 in bsp_reset (source=source@entry=RTEMS_FATAL_SOURCE_ASSERT, 
code=code@entry=1872624) at ../../../bsps/i386/pc386/start/bspreset.c:39
#1  0x00161b15 in bsp_fatal_extension (source=RTEMS_FATAL_SOURCE_ASSERT, 
always_set_to_false=false, code=1872624) at 
../../../bsps/shared/start/bspfatal-default.c:213
#2  0x001189b3 in _User_extensions_Iterate (arg=arg@entry=0x1c92b8, 
visitor=0x118900 <_User_extensions_Fatal_visitor>, 
direction=CHAIN_ITERATOR_FORWARD) at 
../../../cpukit/score/src/userextiterate.c:194
#3  0x0011321f in _User_extensions_Fatal (error=1872624, 
source=RTEMS_FATAL_SOURCE_ASSERT) at 
../../../cpukit/include/rtems/score/userextimpl.h:467
#4  _Terminate (the_source=the_source@entry=RTEMS_FATAL_SOURCE_ASSERT, 
the_error=the_error@entry=1872624) at ../../../cpukit/score/src/interr.c:66
#5  0x001077ec in rtems_fatal (fatal_code=1872624, 
fatal_source=RTEMS_FATAL_SOURCE_ASSERT) at 
../../../cpukit/include/rtems/fatal.h:160
#6  __assert_func (file=file@entry=0x189a64 
"../../../cpukit/include/rtems/score/chainimpl.h", line=691, func=0x1a0378 
<__func__.0> "_Chain_Append_unprotected", failedexpr=0x189a3c 
"_Chain_Is_node_off_chain( the_node )") at 
../../../cpukit/libcsupport/src/__assert.c:71
#7  0x0016c03d in _Chain_Append_unprotected (the_node=0x1cbbc0, 
the_chain=0x1aae4c <ata_ide_ctrls+44>) at 
../../../cpukit/include/rtems/score/chainimpl.h:691
#8  0x0016c0dc in _Chain_Append_unprotected (the_node=0x1cbbc0, 
the_chain=0x1aae4c <ata_ide_ctrls+44>) at 
../../../cpukit/sapi/src/chainprotected.c:99
#9  rtems_chain_append (chain=chain@entry=0x1aae4c <ata_ide_ctrls+44>, 
node=0x1cbbc0) at ../../../cpukit/sapi/src/chainprotected.c:97
#10 0x00160cb9 in ata_add_to_controller_queue (ctrl_minor=0, areq=0x1cbbc0) at 
../../../bsps/shared/dev/ide/ata.c:540
#11 0x00160ea1 in ata_io_data_request (ata_dev=<optimized out>, req=0x1c9450) 
at ../../../bsps/shared/dev/ide/ata.c:228
#12 ata_ioctl (dd=0x1bee44, cmd=3222815233, argp=0x1c9450) at 
../../../bsps/shared/dev/ide/ata.c:949
#13 0x00102f5e in rtems_bdbuf_execute_transfer_request (dd=dd@entry=0x1bee44, 
req=req@entry=0x1c9450, cache_locked=cache_locked@entry=true) at 
../../../cpukit/libblock/src/bdbuf.c:1878
#14 0x001032c9 in rtems_bdbuf_execute_read_request (dd=dd@entry=0x1bee44, 
bd=<optimized out>, bd@entry=0x1bbe2c, transfer_count=transfer_count@entry=1) 
at ../../../cpukit/libblock/src/bdbuf.c:1994
#15 0x001044df in rtems_bdbuf_read (dd=dd@entry=0x1bee44, block=block@entry=0, 
bd_ptr=bd_ptr@entry=0x1c9558) at ../../../cpukit/libblock/src/bdbuf.c:2094
#16 0x00131f67 in rtems_bdpart_read_record (dd=0x1bee44, index=0, 
block=0x1c9558) at ../../../cpukit/libblock/src/bdpart-read.c:220
#17 0x00132190 in rtems_bdpart_read (disk_name=disk_name@entry=0x1ca62e 
"/dev/hda", format=format@entry=0x1c95dc, pt=pt@entry=0x1c9630, 
count=count@entry=0x1c95d4) at ../../../cpukit/libblock/src/bdpart-read.c:273
#18 0x00119a5e in rtems_bdpart_shell_main (argc=2, argv=0x1c9b30) at 
../../../cpukit/libmisc/shell/fdisk.c:236
#19 0x0012dacd in shell_main_loop (shell_env=shell_env@entry=0x1c9ec8, 
interactive=interactive@entry=true, line_editor_output=<optimized out>) at 
../../../cpukit/libmisc/shell/shell.c:1215
#20 0x0012ed18 in rtems_shell_main_loop (shell_env=shell_env@entry=0x1c9ec8) at 
../../../cpukit/libmisc/shell/shell.c:1383
#21 0x0012ed38 in rtems_shell_task (task_argument=1875656) at 
../../../cpukit/libmisc/shell/shell.c:1038
#22 0x00115adb in _Thread_Handler () at 
../../../cpukit/score/src/threadhandler.c:164
#23 0xa5a5a5a5 in ?? ()
```

## Steps to reproduce

INI file:

```
[DEFAULT]
RTEMS_DEBUG = True
RTEMS_POSIX_API = True

[i386/pc686]
BUILD_TESTS = True
```

Run the `fileio.exe` test, enter the shell and then enter the following command:

```
fdisk /dev/hda
```

The shell session is:

```
*** BEGIN OF TEST FILE I/O ***
*** TEST VERSION: 7.0.0.34c362fee100659e36a6945204f77e71cb1c2f7e
*** TEST STATE: USER_INPUT
*** TEST BUILD: RTEMS_DEBUG RTEMS_POSIX_API
*** TEST TOOLS: 13.3.0 20240521 (RTEMS 7, RSB 
170160cb918e7c68b4b35d8f0a42db6df81168e7, Newlib 1b3dcfd)
Press any key to start file I/O sample (20s remaining)
 =========================
 RTEMS FILE I/O Test Menu
 =========================
   p -> part_table_initialize
   f -> mount all disks in fs_table
   l -> list  file
   r -> read  file
   w -> write file
   s -> start shell
   Enter your selection ==>s
Creating /etc/passwd and group with four useable accounts:
  root/pwd
  test/pwd
  rtems/NO PASSWORD
  chroot/NO PASSWORD
Only the root user has access to all available commands.
 =========================
 starting shell
 =========================

Welcome to rtems-7.0.0 (Intel i386/Pentium/pc686)
Copyright (C) 1989, 2021 RTEMS Project and contributors
Login into RTEMS
/dev/foobar login: root
Password:

RTEMS Shell on /dev/foobar. Use 'help' to list commands.
SHLL [/] # fdisk /dev/hda
assertion "_Chain_Is_node_off_chain( the_node )" failed: file 
"../../../cpukit/include/rtems/score/chainimpl.h", line 691, function: 
_Chain_Append_unprotected
```

### Pre-set options

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5254
You're receiving this email because of your account on gitlab.rtems.org.


_______________________________________________
bugs mailing list
bugs@rtems.org
http://lists.rtems.org/mailman/listinfo/bugs

Reply via email to