#1612 closed defect (fixed)

Recent change to rtems/cpukit/libcsupport/src/freenode.c breaks socket use

Reported by: Manuel Köppen Owned by: Eric Norum
Priority: normal Milestone: 4.11
Component: network/legacy Version: 4.11
Severity: blocker Keywords:
Cc: joel.sherrill@…, jennifer.averett@…, chrisj@…, sebastian.huber@…, vinutheraj@… Blocked By:
Blocking:

Description

Using the CVS HEAD, network doesn't work at all ATM.
At the first ifconfig (within rtems_bsdnet_initialize_network) a socket is opened, then closed.

Rtems uses unchecked NULL-Pointers whenever a socket is closed.
It's because socket fds are not created by open and they don't have a filesystem.
In the rtems_libio_tt,the pathinfo member (rtems_filesystem_location_info_t) is just zero'd memory created by rtems_libio_allocate. So the ops pointer in that struct as well. Then a function pointer somewhere at the beginning of the memory is pulled and branched to, causing an exception in my case.

Possible solutions:
1) Undo the last change on rtems/cpukit/libcsupport/src/freenode.c
It worked but I did only minor testing.

2) Add some code to rtems/cpukit/libcsupport/src/libio_sockets.c that will create a dummy fileops table filled with default functions pointers.

3) In rtems/cpukit/libcsupport/src/close.c add some code to find out it's a socket and don't call rtems_filesystem_freenode(&iop->pathinfo) in that case.

What worries me is that I have a PPC and filled the 256 byte reserved memory at address 0 with a pattern. After starting rtems, some bytes are overwritten. So somebody is using a null-pointer. I can't say whether this has something to do with the changeset that remove lots of null-pointer checks...

Attachments (3)

pr1612.diff (1.6 KB) - added by Joel Sherrill on Jul 9, 2010 at 9:03:15 PM.
At least a partial fix
close.patch (899 bytes) - added by Vinu Rajashekhar on Jul 12, 2010 at 3:24:08 PM.
Patch to close.c
close_v1.patch (492 bytes) - added by Vinu Rajashekhar on Jul 12, 2010 at 9:03:27 PM.
new patch to close.c

Download all attachments as: .zip

Change History (13)

Changed on Jul 9, 2010 at 9:03:15 PM by Joel Sherrill

Attachment: pr1612.diff added

At least a partial fix

comment:1 Changed on Jul 9, 2010 at 9:03:50 PM by Joel Sherrill

Cc: Jennifer Averett added

comment:2 Changed on Jul 9, 2010 at 9:04:42 PM by Joel Sherrill

Cc: Chris Johns added

comment:3 Changed on Jul 12, 2010 at 3:17:16 PM by Vinu Rajashekhar

Cc: Vinu Rajashekhar added

Changed on Jul 12, 2010 at 3:24:08 PM by Vinu Rajashekhar

Attachment: close.patch added

Patch to close.c

Changed on Jul 12, 2010 at 9:03:27 PM by Vinu Rajashekhar

Attachment: close_v1.patch added

new patch to close.c

comment:4 Changed on Jul 12, 2010 at 9:03:27 PM by Vinu Rajashekhar

attachments.isobsolete: 01

comment:5 Changed on Jul 14, 2010 at 1:58:51 PM by Joel Sherrill

Component: cpukitfilesystem
Owner: changed from Joel Sherrill to Chris Johns

comment:6 Changed on Jul 14, 2010 at 2:01:23 PM by Joel Sherrill

Cc: Joel Sherrill added
Component: filesystemnetworking
Owner: changed from Chris Johns to Eric Norum

comment:7 Changed on Jul 14, 2010 at 2:30:49 PM by Sebastian Huber

Cc: Sebastian Huber added

comment:8 Changed on Jul 15, 2010 at 7:16:48 AM by Sebastian Huber

Resolution: fixed
Status: newclosed

comment:9 Changed on Jul 18, 2010 at 11:19:12 PM by Chris Johns

Replying to comment:15:

Committed way 1. to CVS head. Loopback test is ok

This is the best fix. Sockets need their own handlers. You can never assume a root file systems handlers are suitable. One reason is handlers can assume some state information is present in the iop.

Created an attachment (id=881) [details]
new patch to close.c

I do not like this patch. Please do not commit it. We have just been removing null tests from the file system code.

comment:10 Changed on Nov 24, 2014 at 6:58:28 PM by Gedare Bloom

Version: HEAD4.11

Replace Version=HEAD with Version=4.11 for the tickets with Milestone >= 4.11

Note: See TracTickets for help on using tickets.