* [PATCH 16/24] ACPI: Limit access to custom_method when the kernel is locked down
[not found] <149142326734.5101.4596394505987813763.stgit@warthog.procyon.org.uk>
@ 2017-04-05 20:16 ` David Howells
2017-04-05 20:16 ` [PATCH 17/24] acpi: Ignore acpi_rsdp kernel param when the kernel has been " David Howells
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: David Howells @ 2017-04-05 20:16 UTC (permalink / raw)
To: linux-kernel
Cc: matthew.garrett, linux-efi, gnomes, gregkh, dhowells, linux-acpi,
linux-security-module, keyrings
From: Matthew Garrett <matthew.garrett@nebula.com>
custom_method effectively allows arbitrary access to system memory, making
it possible for an attacker to circumvent restrictions on module loading.
Disable it if the kernel is locked down.
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
Signed-off-by: David Howells <dhowells@redhat.com>
cc: linux-acpi@vger.kernel.org
---
drivers/acpi/custom_method.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/acpi/custom_method.c b/drivers/acpi/custom_method.c
index c68e72414a67..e4d721c330c0 100644
--- a/drivers/acpi/custom_method.c
+++ b/drivers/acpi/custom_method.c
@@ -29,6 +29,9 @@ static ssize_t cm_write(struct file *file, const char __user * user_buf,
struct acpi_table_header table;
acpi_status status;
+ if (kernel_is_locked_down())
+ return -EPERM;
+
if (!(*ppos)) {
/* parse the table header to get the table length */
if (count <= sizeof(struct acpi_table_header))
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 17/24] acpi: Ignore acpi_rsdp kernel param when the kernel has been locked down
[not found] <149142326734.5101.4596394505987813763.stgit@warthog.procyon.org.uk>
2017-04-05 20:16 ` [PATCH 16/24] ACPI: Limit access to custom_method when the kernel is locked down David Howells
@ 2017-04-05 20:16 ` David Howells
2017-04-06 19:43 ` Rafael J. Wysocki
2017-04-05 20:17 ` [PATCH 18/24] acpi: Disable ACPI table override if the kernel is " David Howells
2017-04-05 20:17 ` [PATCH 19/24] acpi: Disable APEI error injection " David Howells
3 siblings, 1 reply; 8+ messages in thread
From: David Howells @ 2017-04-05 20:16 UTC (permalink / raw)
To: linux-kernel
Cc: gnomes, linux-efi, Josh Boyer, gregkh, dhowells, linux-acpi,
linux-security-module, keyrings, matthew.garrett
From: Josh Boyer <jwboyer@redhat.com>
This option allows userspace to pass the RSDP address to the kernel, which
makes it possible for a user to circumvent any restrictions imposed on
loading modules. Ignore the option when the kernel is locked down.
Signed-off-by: Josh Boyer <jwboyer@redhat.com>
Signed-off-by: David Howells <dhowells@redhat.com>
cc: linux-acpi@vger.kernel.org
---
drivers/acpi/osl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index db78d353bab1..d4d4ba348451 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -192,7 +192,7 @@ acpi_physical_address __init acpi_os_get_root_pointer(void)
acpi_physical_address pa = 0;
#ifdef CONFIG_KEXEC
- if (acpi_rsdp)
+ if (acpi_rsdp && !kernel_is_locked_down())
return acpi_rsdp;
#endif
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 18/24] acpi: Disable ACPI table override if the kernel is locked down
[not found] <149142326734.5101.4596394505987813763.stgit@warthog.procyon.org.uk>
2017-04-05 20:16 ` [PATCH 16/24] ACPI: Limit access to custom_method when the kernel is locked down David Howells
2017-04-05 20:16 ` [PATCH 17/24] acpi: Ignore acpi_rsdp kernel param when the kernel has been " David Howells
@ 2017-04-05 20:17 ` David Howells
2017-04-05 20:17 ` [PATCH 19/24] acpi: Disable APEI error injection " David Howells
3 siblings, 0 replies; 8+ messages in thread
From: David Howells @ 2017-04-05 20:17 UTC (permalink / raw)
To: linux-kernel
Cc: gnomes, linux-efi, Linn Crosetto, matthew.garrett, gregkh,
dhowells, linux-acpi, linux-security-module, keyrings
From: Linn Crosetto <linn@hpe.com>
>From the kernel documentation (initrd_table_override.txt):
If the ACPI_INITRD_TABLE_OVERRIDE compile option is true, it is possible
to override nearly any ACPI table provided by the BIOS with an
instrumented, modified one.
When securelevel is set, the kernel should disallow any unauthenticated
changes to kernel space. ACPI tables contain code invoked by the kernel,
so do not allow ACPI tables to be overridden if the kernel is locked down.
Signed-off-by: Linn Crosetto <linn@hpe.com>
Signed-off-by: David Howells <dhowells@redhat.com>
cc: linux-acpi@vger.kernel.org
---
drivers/acpi/tables.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c
index 2604189d6cd1..601096d0d849 100644
--- a/drivers/acpi/tables.c
+++ b/drivers/acpi/tables.c
@@ -542,6 +542,11 @@ void __init acpi_table_upgrade(void)
if (table_nr == 0)
return;
+ if (kernel_is_locked_down()) {
+ pr_notice("kernel is locked down, ignoring table override\n");
+ return;
+ }
+
acpi_tables_addr =
memblock_find_in_range(0, ACPI_TABLE_UPGRADE_MAX_PHYS,
all_tables_size, PAGE_SIZE);
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 19/24] acpi: Disable APEI error injection if the kernel is locked down
[not found] <149142326734.5101.4596394505987813763.stgit@warthog.procyon.org.uk>
` (2 preceding siblings ...)
2017-04-05 20:17 ` [PATCH 18/24] acpi: Disable ACPI table override if the kernel is " David Howells
@ 2017-04-05 20:17 ` David Howells
3 siblings, 0 replies; 8+ messages in thread
From: David Howells @ 2017-04-05 20:17 UTC (permalink / raw)
To: linux-kernel
Cc: gnomes, linux-efi, Linn Crosetto, matthew.garrett, gregkh,
dhowells, linux-acpi, linux-security-module, keyrings
From: Linn Crosetto <linn@hpe.com>
ACPI provides an error injection mechanism, EINJ, for debugging and testing
the ACPI Platform Error Interface (APEI) and other RAS features. If
supported by the firmware, ACPI specification 5.0 and later provide for a
way to specify a physical memory address to which to inject the error.
Injecting errors through EINJ can produce errors which to the platform are
indistinguishable from real hardware errors. This can have undesirable
side-effects, such as causing the platform to mark hardware as needing
replacement.
While it does not provide a method to load unauthenticated privileged code,
the effect of these errors may persist across reboots and affect trust in
the underlying hardware, so disable error injection through EINJ if
the kernel is locked down.
Signed-off-by: Linn Crosetto <linn@hpe.com>
Signed-off-by: David Howells <dhowells@redhat.com>
cc: linux-acpi@vger.kernel.org
---
drivers/acpi/apei/einj.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c
index ec50c32ea3da..e082718d01c2 100644
--- a/drivers/acpi/apei/einj.c
+++ b/drivers/acpi/apei/einj.c
@@ -518,6 +518,9 @@ static int einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2,
int rc;
u64 base_addr, size;
+ if (kernel_is_locked_down())
+ return -EPERM;
+
/* If user manually set "flags", make sure it is legal */
if (flags && (flags &
~(SETWA_FLAGS_APICID|SETWA_FLAGS_MEM|SETWA_FLAGS_PCIE_SBDF)))
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 17/24] acpi: Ignore acpi_rsdp kernel param when the kernel has been locked down
2017-04-05 20:16 ` [PATCH 17/24] acpi: Ignore acpi_rsdp kernel param when the kernel has been " David Howells
@ 2017-04-06 19:43 ` Rafael J. Wysocki
2017-04-07 6:31 ` Dave Young
[not found] ` <20170407063107.GA10451-0VdLhd/A9Pl+NNSt+8eSiB/sF2h8X+2i0E9HWUfgJXw@public.gmane.org>
0 siblings, 2 replies; 8+ messages in thread
From: Rafael J. Wysocki @ 2017-04-06 19:43 UTC (permalink / raw)
To: David Howells
Cc: Linux Kernel Mailing List, gnomes, linux-efi, Josh Boyer,
Greg Kroah-Hartman, ACPI Devel Maling List, linux-security-module,
keyrings, matthew.garrett
On Wed, Apr 5, 2017 at 10:16 PM, David Howells <dhowells@redhat.com> wrote:
> From: Josh Boyer <jwboyer@redhat.com>
>
> This option allows userspace to pass the RSDP address to the kernel, which
> makes it possible for a user to circumvent any restrictions imposed on
> loading modules. Ignore the option when the kernel is locked down.
I'm not really sure here.
What exactly is the mechanism?
Thanks,
Rafael
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 17/24] acpi: Ignore acpi_rsdp kernel param when the kernel has been locked down
2017-04-06 19:43 ` Rafael J. Wysocki
@ 2017-04-07 6:31 ` Dave Young
[not found] ` <20170407063107.GA10451-0VdLhd/A9Pl+NNSt+8eSiB/sF2h8X+2i0E9HWUfgJXw@public.gmane.org>
1 sibling, 0 replies; 8+ messages in thread
From: Dave Young @ 2017-04-07 6:31 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: David Howells, Linux Kernel Mailing List, gnomes, linux-efi,
Josh Boyer, Greg Kroah-Hartman, ACPI Devel Maling List,
linux-security-module, keyrings, matthew.garrett
On 04/06/17 at 09:43pm, Rafael J. Wysocki wrote:
> On Wed, Apr 5, 2017 at 10:16 PM, David Howells <dhowells@redhat.com> wrote:
> > From: Josh Boyer <jwboyer@redhat.com>
> >
> > This option allows userspace to pass the RSDP address to the kernel, which
> > makes it possible for a user to circumvent any restrictions imposed on
> > loading modules. Ignore the option when the kernel is locked down.
>
> I'm not really sure here.
>
> What exactly is the mechanism?
Actually this acpi_rsdp param is created for EFI kexec reboot in old
days when we had not supported persistent efi vm space across kexec
reboot. At that time kexec reboot runs as noefi mode, it can not find
the acpi root table thus kernel will hang early.
Now kexec can support EFI boot so this param is not necessary for most
user unless they still use efi=old_map.
>
> Thanks,
> Rafael
> --
> To unsubscribe from this list: send the line "unsubscribe linux-efi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 17/24] acpi: Ignore acpi_rsdp kernel param when the kernel has been locked down
[not found] ` <20170407063107.GA10451-0VdLhd/A9Pl+NNSt+8eSiB/sF2h8X+2i0E9HWUfgJXw@public.gmane.org>
@ 2017-04-07 7:05 ` David Howells
2017-04-07 7:39 ` Dave Young
0 siblings, 1 reply; 8+ messages in thread
From: David Howells @ 2017-04-07 7:05 UTC (permalink / raw)
To: Dave Young
Cc: dhowells-H+wXaHxf7aLQT0dZR+AlfA, Rafael J. Wysocki,
Linux Kernel Mailing List,
gnomes-qBU/x9rampVanCEyBjwyrvXRex20P6io,
linux-efi-u79uwXL29TY76Z2rM5mHXA, Josh Boyer, Greg Kroah-Hartman,
ACPI Devel Maling List,
linux-security-module-u79uwXL29TY76Z2rM5mHXA,
keyrings-u79uwXL29TY76Z2rM5mHXA,
matthew.garrett-05XSO3Yj/JvQT0dZR+AlfA
Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
> > > This option allows userspace to pass the RSDP address to the kernel, which
> > > makes it possible for a user to circumvent any restrictions imposed on
> > > loading modules. Ignore the option when the kernel is locked down.
> >
> > I'm not really sure here.
> >
> > What exactly is the mechanism?
>
> Actually this acpi_rsdp param is created for EFI kexec reboot in old
> days when we had not supported persistent efi vm space across kexec
> reboot. At that time kexec reboot runs as noefi mode, it can not find
> the acpi root table thus kernel will hang early.
>
> Now kexec can support EFI boot so this param is not necessary for most
> user unless they still use efi=old_map.
Is this patch now unnecessary?
David
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 17/24] acpi: Ignore acpi_rsdp kernel param when the kernel has been locked down
2017-04-07 7:05 ` David Howells
@ 2017-04-07 7:39 ` Dave Young
0 siblings, 0 replies; 8+ messages in thread
From: Dave Young @ 2017-04-07 7:39 UTC (permalink / raw)
To: David Howells
Cc: Rafael J. Wysocki, Linux Kernel Mailing List, gnomes, linux-efi,
Josh Boyer, Greg Kroah-Hartman, ACPI Devel Maling List,
linux-security-module, keyrings, matthew.garrett
On 04/07/17 at 08:05am, David Howells wrote:
> Dave Young <dyoung@redhat.com> wrote:
>
> > > > This option allows userspace to pass the RSDP address to the kernel, which
> > > > makes it possible for a user to circumvent any restrictions imposed on
> > > > loading modules. Ignore the option when the kernel is locked down.
> > >
> > > I'm not really sure here.
> > >
> > > What exactly is the mechanism?
> >
> > Actually this acpi_rsdp param is created for EFI kexec reboot in old
> > days when we had not supported persistent efi vm space across kexec
> > reboot. At that time kexec reboot runs as noefi mode, it can not find
> > the acpi root table thus kernel will hang early.
> >
> > Now kexec can support EFI boot so this param is not necessary for most
> > user unless they still use efi=old_map.
>
> Is this patch now unnecessary?
I think it is still necessary because the acpi_rsdp kernel param is still
a valid paramater and one can still pass a pointer to be recognized as acpi
root pointer.
Maybe "imposed on loading modules" is not clear which can be dropped.
Thanks
Dave
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-04-07 7:39 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <149142326734.5101.4596394505987813763.stgit@warthog.procyon.org.uk>
2017-04-05 20:16 ` [PATCH 16/24] ACPI: Limit access to custom_method when the kernel is locked down David Howells
2017-04-05 20:16 ` [PATCH 17/24] acpi: Ignore acpi_rsdp kernel param when the kernel has been " David Howells
2017-04-06 19:43 ` Rafael J. Wysocki
2017-04-07 6:31 ` Dave Young
[not found] ` <20170407063107.GA10451-0VdLhd/A9Pl+NNSt+8eSiB/sF2h8X+2i0E9HWUfgJXw@public.gmane.org>
2017-04-07 7:05 ` David Howells
2017-04-07 7:39 ` Dave Young
2017-04-05 20:17 ` [PATCH 18/24] acpi: Disable ACPI table override if the kernel is " David Howells
2017-04-05 20:17 ` [PATCH 19/24] acpi: Disable APEI error injection " David Howells
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).