Opened 14 years ago

Closed 6 years ago

Last modified 5 years ago

#6166 closed bug (fixed)

Boot loader network stack never cleaned up

Reported by: andreasf Owned by: jessicah
Priority: normal Milestone: R1/beta2
Component: System/Boot Loader Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
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 14 years ago.
proposed patch: don't double-free the Ethernet interface
0002-Add-net_stack_cleanup.patch (1.8 KB ) - added by andreasf 14 years ago.
proposed patch: add net_stack_cleanup()
0003-Wire-up-net_stack_cleanup.patch (1.2 KB ) - added by andreasf 14 years ago.
proposed patch: wire up net_stack_cleanup()
0003-Detach-UDP-sockets-on-cleanup.patch (1.8 KB ) - added by jessicah 11 years ago.
proposed patch: detach UDP sockets
0004-Wire-up-net_stack_cleanup.patch (1.1 KB ) - added by jessicah 11 years ago.
proposed patch: wire up net_stack_cleanup()

Download all attachments as: .zip

Change History (18)

by andreasf, 14 years ago

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

comment:1 by andreasf, 14 years ago

patch: 01

by andreasf, 14 years ago

proposed patch: add net_stack_cleanup()

by andreasf, 14 years ago

proposed patch: wire up net_stack_cleanup()

comment:2 by andreasf, 14 years ago

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

in reply to:  2 comment:3 by andreasf, 14 years ago

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 by andreasf, 14 years ago

Owner: changed from axeld to andreasf
Status: newassigned

by jessicah, 11 years ago

proposed patch: detach UDP sockets

by jessicah, 11 years ago

proposed patch: wire up net_stack_cleanup()

comment:5 by jessicah, 11 years ago

Owner: changed from andreasf to jessicah

Updated patches to apply to current tree.

comment:6 by jessicah, 11 years ago

Status: assignedin-progress

comment:7 by waddlesplash, 8 years ago

Patches look OK to me. Is applying them OK?

comment:8 by waddlesplash, 7 years ago

Resolution: fixed
Status: in-progressclosed

Patches applied in hrev51542.

comment:9 by waddlesplash, 7 years ago

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 by pulkomandy, 7 years ago

patch: 10

comment:11 by pulkomandy, 7 years ago

patch: 0

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

comment:12 by waddlesplash, 6 years ago

patch: 0
Resolution: fixed
Status: reopenedclosed

Fixed (finally) in hrev53004.

comment:13 by nielx, 5 years ago

Milestone: R1R1/beta2

Assign tickets with status=closed and resolution=fixed within the R1/beta2 development window to the R1/beta2 Milestone

Note: See TracTickets for help on using tickets.