* [PATCH 1/3] firmware: arm_sdei: Put the SDEI table after using it
2020-05-19 18:21 [PATCH 0/3] firmare: arm_sdei: Extras for v5.8 James Morse
@ 2020-05-19 18:21 ` James Morse
2020-05-19 18:21 ` [PATCH 2/3] firmware: arm_sdei: remove unused interfaces James Morse
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: James Morse @ 2020-05-19 18:21 UTC (permalink / raw)
To: linux-arm-kernel
Cc: Catalin Marinas, James Morse, Will Deacon, Christoph Hellwig,
Hanjun Guo
From: Hanjun Guo <guohanjun@huawei.com>
The acpi_get_table() should be coupled with acpi_put_table() if
the mapped table is not used for runtime after the initialization
to release the table mapping, put the SDEI table after using it.
Signed-off-by: Hanjun Guo <guohanjun@huawei.com>
Link: https://lore.kernel.org/linux-arm-kernel/1589021566-46373-1-git-send-email-guohanjun@huawei.com/
Signed-off-by: James Morse <james.morse@arm.com>
---
drivers/firmware/arm_sdei.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/firmware/arm_sdei.c b/drivers/firmware/arm_sdei.c
index 5afd7409e6fa..a33b701ab2b0 100644
--- a/drivers/firmware/arm_sdei.c
+++ b/drivers/firmware/arm_sdei.c
@@ -1096,6 +1096,8 @@ static bool __init sdei_present_acpi(void)
if (ACPI_FAILURE(status))
return false;
+ acpi_put_table(sdei_table_header);
+
return true;
}
--
2.19.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/3] firmware: arm_sdei: remove unused interfaces
2020-05-19 18:21 [PATCH 0/3] firmare: arm_sdei: Extras for v5.8 James Morse
2020-05-19 18:21 ` [PATCH 1/3] firmware: arm_sdei: Put the SDEI table after using it James Morse
@ 2020-05-19 18:21 ` James Morse
2020-05-19 18:21 ` [PATCH 3/3] firmware: arm_sdei: Document the motivation behind these set_fs() calls James Morse
2020-05-20 11:00 ` [PATCH 0/3] firmare: arm_sdei: Extras for v5.8 Will Deacon
3 siblings, 0 replies; 5+ messages in thread
From: James Morse @ 2020-05-19 18:21 UTC (permalink / raw)
To: linux-arm-kernel
Cc: Catalin Marinas, James Morse, Will Deacon, Christoph Hellwig,
Hanjun Guo
From: Christoph Hellwig <hch@lst.de>
The export symbols to register/unregister and enable/disable events
aren't used upstream, remove them.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/linux-arm-kernel/20200504164224.2842960-1-hch@lst.de/
[ dropped the parts of Christoph's patch that made the API static too ]
Signed-off-by: James Morse <james.morse@arm.com>
---
drivers/firmware/arm_sdei.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/firmware/arm_sdei.c b/drivers/firmware/arm_sdei.c
index a33b701ab2b0..b12b99a19f66 100644
--- a/drivers/firmware/arm_sdei.c
+++ b/drivers/firmware/arm_sdei.c
@@ -429,7 +429,6 @@ int sdei_event_enable(u32 event_num)
return err;
}
-EXPORT_SYMBOL(sdei_event_enable);
static int sdei_api_event_disable(u32 event_num)
{
@@ -471,7 +470,6 @@ int sdei_event_disable(u32 event_num)
return err;
}
-EXPORT_SYMBOL(sdei_event_disable);
static int sdei_api_event_unregister(u32 event_num)
{
@@ -533,7 +531,6 @@ int sdei_event_unregister(u32 event_num)
return err;
}
-EXPORT_SYMBOL(sdei_event_unregister);
/*
* unregister events, but don't destroy them as they are re-registered by
@@ -643,7 +640,6 @@ int sdei_event_register(u32 event_num, sdei_event_callback *cb, void *arg)
return err;
}
-EXPORT_SYMBOL(sdei_event_register);
static int sdei_reregister_event_llocked(struct sdei_event *event)
{
--
2.19.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 3/3] firmware: arm_sdei: Document the motivation behind these set_fs() calls
2020-05-19 18:21 [PATCH 0/3] firmare: arm_sdei: Extras for v5.8 James Morse
2020-05-19 18:21 ` [PATCH 1/3] firmware: arm_sdei: Put the SDEI table after using it James Morse
2020-05-19 18:21 ` [PATCH 2/3] firmware: arm_sdei: remove unused interfaces James Morse
@ 2020-05-19 18:21 ` James Morse
2020-05-20 11:00 ` [PATCH 0/3] firmare: arm_sdei: Extras for v5.8 Will Deacon
3 siblings, 0 replies; 5+ messages in thread
From: James Morse @ 2020-05-19 18:21 UTC (permalink / raw)
To: linux-arm-kernel
Cc: Catalin Marinas, James Morse, Will Deacon, Christoph Hellwig,
Hanjun Guo
The SDEI handler save/restores the addr_limit using set_fs(). It isn't
very clear why. The reason is to mirror the arch code's entry assembly.
The arch code does this because perf may access user-space, and
inheriting the addr_limit may be a problem.
Add a comment explaining why this is here.
Link: https://bugs.chromium.org/p/project-zero/issues/detail?id=822
Suggested-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Morse <james.morse@arm.com>
---
drivers/firmware/arm_sdei.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/firmware/arm_sdei.c b/drivers/firmware/arm_sdei.c
index b12b99a19f66..e7e36aab2386 100644
--- a/drivers/firmware/arm_sdei.c
+++ b/drivers/firmware/arm_sdei.c
@@ -1128,6 +1128,14 @@ int sdei_event_handler(struct pt_regs *regs,
mm_segment_t orig_addr_limit;
u32 event_num = arg->event_num;
+ /*
+ * Save restore 'fs'.
+ * The architecture's entry code save/restores 'fs' when taking an
+ * exception from the kernel. This ensures addr_limit isn't inherited
+ * if you interrupted something that allowed the uaccess routines to
+ * access kernel memory.
+ * Do the same here because this doesn't come via the same entry code.
+ */
orig_addr_limit = get_fs();
set_fs(USER_DS);
--
2.19.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] firmare: arm_sdei: Extras for v5.8
2020-05-19 18:21 [PATCH 0/3] firmare: arm_sdei: Extras for v5.8 James Morse
` (2 preceding siblings ...)
2020-05-19 18:21 ` [PATCH 3/3] firmware: arm_sdei: Document the motivation behind these set_fs() calls James Morse
@ 2020-05-20 11:00 ` Will Deacon
3 siblings, 0 replies; 5+ messages in thread
From: Will Deacon @ 2020-05-20 11:00 UTC (permalink / raw)
To: James Morse, linux-arm-kernel
Cc: catalin.marinas, Will Deacon, Christoph Hellwig, Hanjun Guo
On Tue, 19 May 2020 19:21:05 +0100, James Morse wrote:
> Some extra patches for SDEI if you're still willing to add to your tree.
>
> Hanjun's patch to cleanup some ACPI table handling conflicts with
> Sudeep's patch that you already have queued.
>
> Based on arm64's for-next/sdei branch: v5.7-rc3-1-gcaf2cd610dbb
>
> [...]
Applied to arm64 (for-next/sdei), thanks!
[1/3] firmware: arm_sdei: Put the SDEI table after using it
https://git.kernel.org/arm64/c/70e6352aefb1
[2/3] firmware: arm_sdei: remove unused interfaces
https://git.kernel.org/arm64/c/82b2077afccd
[3/3] firmware: arm_sdei: Document the motivation behind these set_fs() calls
https://git.kernel.org/arm64/c/472de63b0b83
Cheers,
--
Will
https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 5+ messages in thread