bugGNU GRUB - Bugs: bug #40363, TFTP: Files bigger than 63 MB...


You are not allowed to post comments on this tracker with your current authentification level.

bug #40363: TFTP: Files bigger than 63 MB generate "error: timeout reading `/boot/initrd'."

Submitted by:  Bernhard Übelacker <bernhardu>
Submitted on:  Thu 24 Oct 2013 03:10:34 PM UTC  
Category: NetworkSeverity: Major
Priority: 5 - NormalItem Group: Software Error
Status: FixedPrivacy: Public
Assigned to: NoneOriginator Name: 
Open/Closed: ClosedRelease: 
Release: Bazaar - trunkReproducibility: Every Time
Planned Release: None

(Jump to the original submission Jump to the original submission)

Sun 27 Oct 2013 06:17:09 PM UTC, comment #6:

comitted modification of my patch.

Vladimir Serbinenko <phcoder>
Project Administrator
Sat 26 Oct 2013 01:18:54 PM UTC, comment #5:

When the block number gets over 0xffff the last
packet gets ack'ed twice and grub shows this error:

error: not an IP.

(Due to an tcpdump at the tftp server; the tftp server
itself is logging that the file was sent successfully.)
(With the patch #29471 tftp.diff applied on top of
yesterdays git c16535a845dcbb2b1d3b42994d3b72b8dc088a38)

I think this is because ack_sent stores only the 2 byte
block number.

When storing in ack_sent the real block number like in
attached patch it works when the block number turns over.
(And works also for smaller files.)

(Tested indeed only in a tiny network with one VM as server,
one VM and one PC as clients.)

(file #29478)

Bernhard Übelacker <bernhardu>
Sat 26 Oct 2013 02:17:38 AM UTC, comment #4:

If packet for 10000 reaches GRUB before packet FFFF then packet 10000 would be considered to come before FFFF and will be processed as delayed retransmission and GRUB will discard it but (re)send ack for 0000, then it will take packet for FFFF and process it correctly, send ack for FFFF. Then server will see ack for FFFF and 0000 which it will interpret as 10000 and go on with sending 10001 and GRUB will wait for 10000 which it will never receive. The reason why it worked for you is combination of #40293 and your network being perfect (no losses or duplicates). The full problem is more complex than casting few types. In general there is no solution. Imagine that packet for 00000 got duplicate in network and delayed and arrives at the same time as FFFF and before 10000. Then there is no way to distinguish this situation from packet 10000 arriving. You can handle it only by introducing some assumptions. The most sensible is that you never have packets more than 0x8000 apart. Then (grub_int16_t)(a-b) would give correct compare. Please try attached patch.

(file #29471)

Vladimir Serbinenko <phcoder>
Project Administrator
Sat 26 Oct 2013 12:52:28 AM UTC, comment #3:

Then if the datatype change is removed the sorting in the
priority queue is still correct and only when comparing with
the network data using only the lowest 2 bytes?
(new adjusted patch)

(file #29470)

Bernhard Übelacker <bernhardu>
Fri 25 Oct 2013 06:03:28 PM UTC, comment #2:

This patch worked only by chance that the priority queue was empty at the moment of wraparound.

Vladimir Serbinenko <phcoder>
Project Administrator
Thu 24 Oct 2013 03:14:35 PM UTC, comment #1:

Patch which handles the overflow attached.

Bernhard Übelacker <bernhardu>
Thu 24 Oct 2013 03:10:34 PM UTC, original submission:

When attempting to load a file with a size bigger
than 63 MB over TFTP grub shows this error message:

error: timeout reading `/boot/initrd'.

The problem lies in the blocknumber assigned to each
network packet. TFTP uses only 2 bytes for it, therefore
continuing after the overflow with blocknumber 0.
This overflow happens with a blocksize of 1024 after 63 MB.

(With current git of today f70d5c0701c6edf7f83c2e5ad01d29962b0aabd0)

Bernhard Übelacker <bernhardu>



Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by phcoder (Posted a comment)
  • -unavailable- added by bernhardu (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 8 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 27 Oct 2013 06:17:09 PM UTCphcoderStatusNone=>Fixed
    Sat 26 Oct 2013 01:18:54 PM UTCbernharduAttached File-=>Added 0001-TFTP-Handle-overflow-in-blocknumber-fixes-bug-40363-try-4.patch, #29478
    Sat 26 Oct 2013 02:17:38 AM UTCphcoderAttached File-=>Added tftp.diff, #29471
    Sat 26 Oct 2013 12:52:28 AM UTCbernharduAttached File-=>Added 0001-TFTP-Handle-overflow-in-blocknumber-fixes-bug-40363-try-2.patch, #29470
    Thu 24 Oct 2013 03:15:05 PM UTCbernharduCarbon-CopyRemoved bernhardu=>-
    Thu 24 Oct 2013 03:13:34 PM UTCbernharduAttached File-=>Added 0001-TFTP-Handle-overflow-in-blocknumber-fixes-bug-40363.patch, #29460
    Thu 24 Oct 2013 03:10:34 PM UTCbernharduCarbon-Copy-=>Added bernhardu

    Back to the top

    Powered by Savane 3.1-cleanup