Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
a42da7f0
Commit
a42da7f0
authored
Dec 19, 2023
by
Ard Biesheuvel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'efi/urgent' into efi/next
parents
94f7f618
50d7cdf7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
14 deletions
+31
-14
arch/loongarch/include/asm/efi.h
arch/loongarch/include/asm/efi.h
+1
-1
drivers/firmware/efi/libstub/loongarch-stub.c
drivers/firmware/efi/libstub/loongarch-stub.c
+2
-2
drivers/firmware/efi/libstub/loongarch.c
drivers/firmware/efi/libstub/loongarch.c
+3
-3
drivers/firmware/efi/libstub/x86-stub.c
drivers/firmware/efi/libstub/x86-stub.c
+24
-7
drivers/firmware/efi/unaccepted_memory.c
drivers/firmware/efi/unaccepted_memory.c
+1
-1
No files found.
arch/loongarch/include/asm/efi.h
View file @
a42da7f0
...
@@ -32,6 +32,6 @@ static inline unsigned long efi_get_kimg_min_align(void)
...
@@ -32,6 +32,6 @@ static inline unsigned long efi_get_kimg_min_align(void)
#define EFI_KIMG_PREFERRED_ADDRESS PHYSADDR(VMLINUX_LOAD_ADDRESS)
#define EFI_KIMG_PREFERRED_ADDRESS PHYSADDR(VMLINUX_LOAD_ADDRESS)
unsigned
long
kernel_entry_address
(
void
);
unsigned
long
kernel_entry_address
(
unsigned
long
kernel_addr
);
#endif
/* _ASM_LOONGARCH_EFI_H */
#endif
/* _ASM_LOONGARCH_EFI_H */
drivers/firmware/efi/libstub/loongarch-stub.c
View file @
a42da7f0
...
@@ -35,9 +35,9 @@ efi_status_t handle_kernel_image(unsigned long *image_addr,
...
@@ -35,9 +35,9 @@ efi_status_t handle_kernel_image(unsigned long *image_addr,
return
status
;
return
status
;
}
}
unsigned
long
kernel_entry_address
(
void
)
unsigned
long
kernel_entry_address
(
unsigned
long
kernel_addr
)
{
{
unsigned
long
base
=
(
unsigned
long
)
&
kernel_offset
-
kernel_offset
;
unsigned
long
base
=
(
unsigned
long
)
&
kernel_offset
-
kernel_offset
;
return
(
unsigned
long
)
&
kernel_entry
-
base
+
VMLINUX_LOAD_ADDRESS
;
return
(
unsigned
long
)
&
kernel_entry
-
base
+
kernel_addr
;
}
}
drivers/firmware/efi/libstub/loongarch.c
View file @
a42da7f0
...
@@ -37,9 +37,9 @@ static efi_status_t exit_boot_func(struct efi_boot_memmap *map, void *priv)
...
@@ -37,9 +37,9 @@ static efi_status_t exit_boot_func(struct efi_boot_memmap *map, void *priv)
return
EFI_SUCCESS
;
return
EFI_SUCCESS
;
}
}
unsigned
long
__weak
kernel_entry_address
(
void
)
unsigned
long
__weak
kernel_entry_address
(
unsigned
long
kernel_addr
)
{
{
return
*
(
unsigned
long
*
)(
PHYSADDR
(
VMLINUX_LOAD_ADDRESS
)
+
8
)
;
return
*
(
unsigned
long
*
)(
kernel_addr
+
8
)
-
VMLINUX_LOAD_ADDRESS
+
kernel_addr
;
}
}
efi_status_t
efi_boot_kernel
(
void
*
handle
,
efi_loaded_image_t
*
image
,
efi_status_t
efi_boot_kernel
(
void
*
handle
,
efi_loaded_image_t
*
image
,
...
@@ -73,7 +73,7 @@ efi_status_t efi_boot_kernel(void *handle, efi_loaded_image_t *image,
...
@@ -73,7 +73,7 @@ efi_status_t efi_boot_kernel(void *handle, efi_loaded_image_t *image,
csr_write64
(
CSR_DMW0_INIT
,
LOONGARCH_CSR_DMWIN0
);
csr_write64
(
CSR_DMW0_INIT
,
LOONGARCH_CSR_DMWIN0
);
csr_write64
(
CSR_DMW1_INIT
,
LOONGARCH_CSR_DMWIN1
);
csr_write64
(
CSR_DMW1_INIT
,
LOONGARCH_CSR_DMWIN1
);
real_kernel_entry
=
(
void
*
)
kernel_entry_address
();
real_kernel_entry
=
(
void
*
)
kernel_entry_address
(
kernel_addr
);
real_kernel_entry
(
true
,
(
unsigned
long
)
cmdline_ptr
,
real_kernel_entry
(
true
,
(
unsigned
long
)
cmdline_ptr
,
(
unsigned
long
)
efi_system_table
);
(
unsigned
long
)
efi_system_table
);
...
...
drivers/firmware/efi/libstub/x86-stub.c
View file @
a42da7f0
...
@@ -307,17 +307,20 @@ static void setup_unaccepted_memory(void)
...
@@ -307,17 +307,20 @@ static void setup_unaccepted_memory(void)
efi_err
(
"Memory acceptance protocol failed
\n
"
);
efi_err
(
"Memory acceptance protocol failed
\n
"
);
}
}
static
efi_char16_t
*
efistub_fw_vendor
(
void
)
{
unsigned
long
vendor
=
efi_table_attr
(
efi_system_table
,
fw_vendor
);
return
(
efi_char16_t
*
)
vendor
;
}
static
const
efi_char16_t
apple
[]
=
L"Apple"
;
static
const
efi_char16_t
apple
[]
=
L"Apple"
;
static
void
setup_quirks
(
struct
boot_params
*
boot_params
)
static
void
setup_quirks
(
struct
boot_params
*
boot_params
)
{
{
efi_char16_t
*
fw_vendor
=
(
efi_char16_t
*
)(
unsigned
long
)
if
(
IS_ENABLED
(
CONFIG_APPLE_PROPERTIES
)
&&
efi_table_attr
(
efi_system_table
,
fw_vendor
);
!
memcmp
(
efistub_fw_vendor
(),
apple
,
sizeof
(
apple
)))
retrieve_apple_device_properties
(
boot_params
);
if
(
!
memcmp
(
fw_vendor
,
apple
,
sizeof
(
apple
)))
{
if
(
IS_ENABLED
(
CONFIG_APPLE_PROPERTIES
))
retrieve_apple_device_properties
(
boot_params
);
}
}
}
/*
/*
...
@@ -765,11 +768,25 @@ static efi_status_t efi_decompress_kernel(unsigned long *kernel_entry)
...
@@ -765,11 +768,25 @@ static efi_status_t efi_decompress_kernel(unsigned long *kernel_entry)
if
(
IS_ENABLED
(
CONFIG_RANDOMIZE_BASE
)
&&
!
efi_nokaslr
)
{
if
(
IS_ENABLED
(
CONFIG_RANDOMIZE_BASE
)
&&
!
efi_nokaslr
)
{
u64
range
=
KERNEL_IMAGE_SIZE
-
LOAD_PHYSICAL_ADDR
-
kernel_total_size
;
u64
range
=
KERNEL_IMAGE_SIZE
-
LOAD_PHYSICAL_ADDR
-
kernel_total_size
;
static
const
efi_char16_t
ami
[]
=
L"American Megatrends"
;
efi_get_seed
(
seed
,
sizeof
(
seed
));
efi_get_seed
(
seed
,
sizeof
(
seed
));
virt_addr
+=
(
range
*
seed
[
1
])
>>
32
;
virt_addr
+=
(
range
*
seed
[
1
])
>>
32
;
virt_addr
&=
~
(
CONFIG_PHYSICAL_ALIGN
-
1
);
virt_addr
&=
~
(
CONFIG_PHYSICAL_ALIGN
-
1
);
/*
* Older Dell systems with AMI UEFI firmware v2.0 may hang
* while decompressing the kernel if physical address
* randomization is enabled.
*
* https://bugzilla.kernel.org/show_bug.cgi?id=218173
*/
if
(
efi_system_table
->
hdr
.
revision
<=
EFI_2_00_SYSTEM_TABLE_REVISION
&&
!
memcmp
(
efistub_fw_vendor
(),
ami
,
sizeof
(
ami
)))
{
efi_debug
(
"AMI firmware v2.0 or older detected - disabling physical KASLR
\n
"
);
seed
[
0
]
=
0
;
}
}
}
status
=
efi_random_alloc
(
alloc_size
,
CONFIG_PHYSICAL_ALIGN
,
&
addr
,
status
=
efi_random_alloc
(
alloc_size
,
CONFIG_PHYSICAL_ALIGN
,
&
addr
,
...
...
drivers/firmware/efi/unaccepted_memory.c
View file @
a42da7f0
...
@@ -101,7 +101,7 @@ void accept_memory(phys_addr_t start, phys_addr_t end)
...
@@ -101,7 +101,7 @@ void accept_memory(phys_addr_t start, phys_addr_t end)
* overlap on physical address level.
* overlap on physical address level.
*/
*/
list_for_each_entry
(
entry
,
&
accepting_list
,
list
)
{
list_for_each_entry
(
entry
,
&
accepting_list
,
list
)
{
if
(
entry
->
end
<
range
.
start
)
if
(
entry
->
end
<
=
range
.
start
)
continue
;
continue
;
if
(
entry
->
start
>=
range
.
end
)
if
(
entry
->
start
>=
range
.
end
)
continue
;
continue
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment