svn commit: r316119 - in head/sys/boot: arm/uboot efi/boot1 efi/loader

Andrew Turner andrew at fubar.geek.nz
Wed Mar 29 15:28:53 UTC 2017


> On 29 Mar 2017, at 00:56, Ngie Cooper <ngie at freebsd.org> wrote:
> 
> Author: ngie
> Date: Tue Mar 28 23:56:02 2017
> New Revision: 316119
> URL: https://svnweb.freebsd.org/changeset/base/316119
> 
> Log:
>  self_reloc.c: Pass -Wno-error=maybe-uninitialized to gcc versions greater than 4.2.1
> 
>  self_reloc.c doesn't initialize `rel` in all cases in the C code, however, the value
>  might be initialized properly on the stack in the assembly code.

The code does initialise rel as the loader will have either a DT_REL or DT_RELA entry, however the compiler doesn’t know this. The asm code shouldn’t be setting any stack variables as it calls self_reloc so would need to know the stack layout. This may change depending on the compiler used, and any flags passed to it.

> 
>  For right now (because this doesn't seem to be breaking anything and my initializing
>  the stack value could break something since it's called from assembly code) disable
>  the warning for self_reloc.c. More investigation should be done to determine the
>  appropriate response to this warning (either intialize the value or find a smarter
>  way to deal with the warning).

The proper solution is to initialise it. If the values incorrect it will access invalid memory, however as it’s parsing its own relocation tables it will be safe, if they are wrong there are bigger problems & the rest of the loader is unlikely to succeed.

Andrew



More information about the svn-src-all mailing list