This repository has been archived by the owner on Aug 5, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
arm64/efi: isolate EFI stub from the kernel proper
Since arm64 does not use a builtin decompressor, the EFI stub is built into the kernel proper. So far, this has been working fine, but actually, since the stub is in fact a PE/COFF relocatable binary that is executed at an unknown offset in the 1:1 mapping provided by the UEFI firmware, we should not be seamlessly sharing code with the kernel proper, which is a position dependent executable linked at a high virtual offset. So instead, separate the contents of libstub and its dependencies, by putting them into their own namespace by prefixing all of its symbols with __efistub. This way, we have tight control over what parts of the kernel proper are referenced by the stub. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Matt Fleming <matt.fleming@intel.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
- Loading branch information
Showing
6 changed files
with
139 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Taken from: | ||
* linux/lib/string.c | ||
* | ||
* Copyright (C) 1991, 1992 Linus Torvalds | ||
*/ | ||
|
||
#include <linux/types.h> | ||
#include <linux/string.h> | ||
|
||
#ifndef __HAVE_ARCH_STRSTR | ||
/** | ||
* strstr - Find the first substring in a %NUL terminated string | ||
* @s1: The string to be searched | ||
* @s2: The string to search for | ||
*/ | ||
char *strstr(const char *s1, const char *s2) | ||
{ | ||
size_t l1, l2; | ||
|
||
l2 = strlen(s2); | ||
if (!l2) | ||
return (char *)s1; | ||
l1 = strlen(s1); | ||
while (l1 >= l2) { | ||
l1--; | ||
if (!memcmp(s1, s2, l2)) | ||
return (char *)s1; | ||
s1++; | ||
} | ||
return NULL; | ||
} | ||
#endif | ||
|
||
#ifndef __HAVE_ARCH_STRNCMP | ||
/** | ||
* strncmp - Compare two length-limited strings | ||
* @cs: One string | ||
* @ct: Another string | ||
* @count: The maximum number of bytes to compare | ||
*/ | ||
int strncmp(const char *cs, const char *ct, size_t count) | ||
{ | ||
unsigned char c1, c2; | ||
|
||
while (count) { | ||
c1 = *cs++; | ||
c2 = *ct++; | ||
if (c1 != c2) | ||
return c1 < c2 ? -1 : 1; | ||
if (!c1) | ||
break; | ||
count--; | ||
} | ||
return 0; | ||
} | ||
#endif |