shim: Prevent shim to set itself as a second stage loader
shim: Prevent shim to set itself as a second stage loader

When shim is invoked from a relative path (e.g: from the UEFI shell), the
Loaded Image handle LoadOptions can be set to the binary relative path.

But the is_our_path() function only checks if LoadOptions is set to the
absolute path of shim to ignore it. So if a relative path is there, shim
would set itself as the secondary loader and invoke itself in a loop.

To prevent that, use the path in LoadOptions to calculate the absolute
path and compare it with the one in the Loader Image handle FilePath.

Resolves: bz#1622485

Signed-off-by: Javier Martinez Canillas <8fdf2abf85d34ea8f3f979ef25dc1f25d94aca29@redhat.com>
Reviewed-by: 376a259b75464ad86f84b875582977d952f7c6d5@oracle.com
Tested-by: 376a259b75464ad86f84b875582977d952f7c6d5@oracle.com
Upstream-commit-id: e563bc3dcd1

rhinstaller/shim,rhinstaller/shim,rhinstaller/shim