Opened 9 years ago

Closed 4 weeks ago

#6166 closed bug (fixed)

Boot loader network stack never cleaned up

Reported by: andreasf Owned by: jessicah
Priority: normal Milestone: R1
Component: System/Boot Loader Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: no Platform: All

Description

The boot loader's network stack, currently used for OpenFirmware and PXE only, is not cleaned up before entering the kernel.

With #5193 patches on ppc the OpenFirmware memory is successfully retained while unmapping the boot loader memory (including its network stack) along with any non-kernel memory. The dma-alloc'ed send/receive buffer is retained inside OpenFirmware though (here 0xff9d1000-0xff9d3000 and OpenFirmware at 0xff800000-0xffa00000), with no proper way to access or free the memory afterwards.

Attachments (5)

0001-Don-t-double-free-the-Ethernet-interface.patch (895 bytes) - added by andreasf 9 years ago.
proposed patch: don't double-free the Ethernet interface
0002-Add-net_stack_cleanup.patch (1.8 KB) - added by andreasf 9 years ago.
proposed patch: add net_stack_cleanup()
0003-Wire-up-net_stack_cleanup.patch (1.2 KB) - added by andreasf 9 years ago.
proposed patch: wire up net_stack_cleanup()
0003-Detach-UDP-sockets-on-cleanup.patch (1.8 KB) - added by jessicah 5 years ago.
proposed patch: detach UDP sockets
0004-Wire-up-net_stack_cleanup.patch (1.1 KB) - added by jessicah 5 years ago.
proposed patch: wire up net_stack_cleanup()

Download all attachments as: .zip

Change History (17)

Changed 9 years ago by andreasf

proposed patch: don't double-free the Ethernet interface

comment:1 Changed 9 years ago by andreasf

Has a Patch: set

Changed 9 years ago by andreasf

proposed patch: add net_stack_cleanup()

Changed 9 years ago by andreasf

proposed patch: wire up net_stack_cleanup()

comment:2 Changed 9 years ago by andreasf

This patch set adds a network stack cleanup function. Further descriptions are in the individual patches.

The underlying assumption of patch 3 is that platform_start_kernel() will no longer use any sockets. Tested on ppc only.

Future improvements could include:

  • a way for ~UDPService() destructor to unbind any dangling UDPSocket, so that the socket remains usable but returns an error
  • delegation to platform-specific cleanup functions, should the need arise

comment:3 in reply to:  2 Changed 9 years ago by andreasf

Turns out I do have a use case for unbinding UDP sockets coming up, so let's insert that patch right away. Patch 4 is previous patch 3, unchanged.

comment:4 Changed 9 years ago by andreasf

Owner: changed from axeld to andreasf
Status: newassigned

Changed 5 years ago by jessicah

proposed patch: detach UDP sockets

Changed 5 years ago by jessicah

proposed patch: wire up net_stack_cleanup()

comment:5 Changed 5 years ago by jessicah

Owner: changed from andreasf to jessicah

Updated patches to apply to current tree.

comment:6 Changed 5 years ago by jessicah

Status: assignedin-progress

comment:7 Changed 2 years ago by waddlesplash

Patches look OK to me. Is applying them OK?

comment:8 Changed 18 months ago by waddlesplash

Resolution: fixed
Status: in-progressclosed

Patches applied in hrev51542.

comment:9 Changed 18 months ago by waddlesplash

Resolution: fixed
Status: closedreopened

Had to revert patch 0004 as it breaks the link of the bootloader. The other 3 patches are still in effect.

comment:10 Changed 15 months ago by pulkomandy

Has a Patch: unset

comment:11 Changed 15 months ago by pulkomandy

Has a Patch: unset

Migrated patch 4 to Gerrit: https://review.haiku-os.org/50

comment:12 Changed 4 weeks ago by waddlesplash

Has a Patch: unset
Resolution: fixed
Status: reopenedclosed

Fixed (finally) in hrev53004.

Note: See TracTickets for help on using tickets.