Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Mar 2017 16:28:14 +0100
From:      Andrew Turner <andrew@fubar.geek.nz>
To:        Ngie Cooper <ngie@freebsd.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r316119 - in head/sys/boot: arm/uboot efi/boot1 efi/loader
Message-ID:  <08FA2B39-CF4A-4BDD-8A3A-44FA69F708F4@fubar.geek.nz>
In-Reply-To: <201703282356.v2SNu2Hv057034@repo.freebsd.org>
References:  <201703282356.v2SNu2Hv057034@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

> On 29 Mar 2017, at 00:56, Ngie Cooper <ngie@freebsd.org> wrote:
>=20
> Author: ngie
> Date: Tue Mar 28 23:56:02 2017
> New Revision: 316119
> URL: https://svnweb.freebsd.org/changeset/base/316119
>=20
> Log:
>  self_reloc.c: Pass -Wno-error=3Dmaybe-uninitialized to gcc versions =
greater than 4.2.1
>=20
>  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=E2=80=99t know this. The asm =
code shouldn=E2=80=99t 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.

>=20
>  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=E2=80=99s 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?08FA2B39-CF4A-4BDD-8A3A-44FA69F708F4>