public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Vlad Lungu <vlad@comsys.ro>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] Off-by-two bug when relocating GOT
Date: Sat, 06 Oct 2007 15:27:46 +0300	[thread overview]
Message-ID: <47077F42.4060209@comsys.ro> (raw)
In-Reply-To: <4706D4CF.4070309@corelatus.se>

Thomas Lange wrote:
> Vlad Lungu wrote:
>   
>> Thomas Lange wrote:
>>     
>>> Vlad Lungu wrote:
>>>   
>>>       
>>>> Shinya Kuribayashi wrote:
>>>>     
>>>>         
>>>>> Vlad Lungu wrote:
>>>>>   
>>>>>       
>>>>>           
>>>>>> The first two entries are skipped but the number of relocated entries
>>>>>> is not adjusted; as a result, the first __u_boot_cmd_* structure is
>>>>>> smashed and no commands can be issued.
>>>>>>     
>>>>>>         
>>>>>>             
>>>>> This is a known, long stading, pretty critical, but not fixed problem. See below:
>>>>>
>>>>> http://search.gmane.org/search.php?group=gmane.comp.boot-loaders.u-boot&query=mips+got
>>>>>
>>>>> I'm going to look closely into this.
>>>>>   
>>>>>       
>>>>>           
>>>> The thing I don't get is why skip the top two entries in the first place? Is it because 
>>>> _gp=ALIGN(16) ? Maybe Robert has a point:
>>>>
>>>> http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/25533
>>>>     
>>>>         
>>> Yes, Roberts patch sent 12/15/06 09:53 worked for me when my command
>>> table suddenly got corrupted.
>>>   
>>>       
>> That's my case:
>>                 0x00000000bfc1d950                _gp = ALIGN (0x10)
>>                 0x00000000bfc1d94c                __got_start = .
>>
>> .got            0x00000000bfc1d950      0x500
>>  *(.got)
>>  .got           0x00000000bfc1d950      0x500 cpu/mips/start.o
>>                 0x00000000bfc1d950                _GLOBAL_OFFSET_TABLE_
>>                 0x00000000bfc1de50                __got_end = .
>>                 0x00000000bfc1de50                . = .
>>                 0x00000000bfc1de50                __u_boot_cmd_start = .
>>
>>  The thing is,  num_got_entries=(__got_end - __got_start)>>2 and that's 
>> 0x141 and it should be only 0x140.
>> That is what triggers the bug. In start.S, lines 353-354, $t4 is loaded 
>> with $gp+8 and $t2 with 2 and not with 0, so in effect
>> if I substract 2 from $t3 I'm not relocating the last entry, and with 
>> Robert's patch I'm not relocating the last two.
>> One more point: loading  $gp with _GLOBAL_OFFSET_TABLE_ is not a good  
>> idea, it should be loaded with _gp. The value
>> is the same at the moment, but it's not guaranteed at all, someone could 
>> start playing with the link scripts and break this.
>>     
>>> It is still not applied to sources.
>>>
>>> Is it rejected/pending/forgotten?
>>>   
>>>       
>> Well, it was not a "proper" patch so it kind of fell trought the cracks, 
>> probably.
>> This one is a "proper" patch but it's actually wrong, so please don't 
>> apply it.
>>     
>
> Hmm, are we talking about the same patch?
>
> [PATCH] Fix: Bug in MIPS linker scripts
> http://article.gmane.org/gmane.comp.boot-loaders.u-boot/25541/
>   
Didn't see this one. I was talking about

http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/25533

Well, who knows? There are no commits in the MIPS tree since March, and the patch is not applied there,
even if the dude is listed as custodian of the tree.

Vlad

  reply	other threads:[~2007-10-06 12:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-04 17:45 [U-Boot-Users] [PATCH] Off-by-two bug when relocating GOT Vlad Lungu
2007-10-05  3:58 ` Shinya Kuribayashi
2007-10-05 10:39   ` Vlad Lungu
2007-10-05 20:18     ` Thomas Lange
2007-10-05 22:31       ` Vlad Lungu
2007-10-06  0:20         ` Thomas Lange
2007-10-06 12:27           ` Vlad Lungu [this message]
2007-10-11 20:04         ` Shinya Kuribayashi
2007-10-11 22:06           ` Vlad Lungu
2007-10-12 10:20             ` Vlad Lungu
2007-10-14 15:57             ` Shinya Kuribayashi
2007-10-14 19:00               ` Vlad Lungu
2007-10-16 18:19               ` [U-Boot-Users] _gp in current u-boot.lds for MIPS ports Wolfgang Denk
2007-10-16 19:13                 ` Vlad Lungu
2007-10-16 20:15                 ` Andrew Dyer
2007-10-17 14:27                   ` Shinya Kuribayashi
2007-10-17 14:23                 ` Shinya Kuribayashi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47077F42.4060209@comsys.ro \
    --to=vlad@comsys.ro \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox