Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1499945 > unrolled thread
| Started by | Laura Abbott <labbott@redhat.com> |
|---|---|
| First post | 2016-10-13 00:40 +0200 |
| Last post | 2016-10-17 13:10 +0200 |
| Articles | 5 — 2 participants |
Back to article view | Back to linux.kernel
[PATCHv2 0/4] WX checking for arm64 Laura Abbott <labbott@redhat.com> - 2016-10-13 00:40 +0200
[PATCHv2 2/4] arm64: dump: Make the page table dumping seq_file optional Laura Abbott <labbott@redhat.com> - 2016-10-13 00:40 +0200
Re: [PATCHv2 2/4] arm64: dump: Make the page table dumping seq_file optional Mark Rutland <mark.rutland@arm.com> - 2016-10-17 13:10 +0200
[PATCHv2 3/4] arm64: dump: Remove max_addr Laura Abbott <labbott@redhat.com> - 2016-10-13 00:40 +0200
Re: [PATCHv2 3/4] arm64: dump: Remove max_addr Mark Rutland <mark.rutland@arm.com> - 2016-10-17 13:10 +0200
| From | Laura Abbott <labbott@redhat.com> |
|---|---|
| Date | 2016-10-13 00:40 +0200 |
| Subject | [PATCHv2 0/4] WX checking for arm64 |
| Message-ID | <srAlP-2op-7@gated-at.bofh.it> |
Hi, This is v2 of the implementation to check for writable and executable pages on arm64. Major changes since v1: - I realized my concerns about initialization and registration were unfounded so registration to register page tables with debugfs is simplified. - New patch to remove max_addr since it was pointed out it was unused. - Rebased to include changes for the EFI page tables as well. - Checking is now only done on the init_mm page tables. It was mentioned that we should check the hyp page tables as well but that can be follow on work. - Checking for UXN per suggestion from Mark Rutland. Laura Abbott (4): arm64: dump: Make ptdump debugfs a separate option arm64: dump: Make the page table dumping seq_file optional arm64: dump: Remove max_addr arm64: dump: Add checking for writable and exectuable pages arch/arm64/Kconfig.debug | 34 ++++++++++++++- arch/arm64/include/asm/ptdump.h | 22 +++++++--- arch/arm64/mm/Makefile | 3 +- arch/arm64/mm/dump.c | 89 ++++++++++++++++++++++++++------------ arch/arm64/mm/mmu.c | 2 + arch/arm64/mm/ptdump_debugfs.c | 31 +++++++++++++ drivers/firmware/efi/arm-runtime.c | 5 +-- 7 files changed, 147 insertions(+), 39 deletions(-) create mode 100644 arch/arm64/mm/ptdump_debugfs.c -- 2.7.4
[toc] | [next] | [standalone]
| From | Laura Abbott <labbott@redhat.com> |
|---|---|
| Date | 2016-10-13 00:40 +0200 |
| Subject | [PATCHv2 2/4] arm64: dump: Make the page table dumping seq_file optional |
| Message-ID | <srAlQ-2op-29@gated-at.bofh.it> |
| In reply to | #1499945 |
The page table dumping code always assumes it will be dumping to a
seq_file to userspace. Future code will be taking advantage of
the page table dumping code but will not need the seq_file. Make
the seq_file optional for these cases.
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Laura Abbott <labbott@redhat.com>
---
v2: Tweak commit text per Mark Rutland's suggestion
---
arch/arm64/mm/dump.c | 26 +++++++++++++++++++-------
1 file changed, 19 insertions(+), 7 deletions(-)
diff --git a/arch/arm64/mm/dump.c b/arch/arm64/mm/dump.c
index f0f0be7..bb36649 100644
--- a/arch/arm64/mm/dump.c
+++ b/arch/arm64/mm/dump.c
@@ -50,6 +50,18 @@ static const struct addr_marker address_markers[] = {
{ -1, NULL },
};
+#define pt_dump_seq_printf(m, fmt, args...) \
+({ \
+ if (m) \
+ seq_printf(m, fmt, ##args); \
+})
+
+#define pt_dump_seq_puts(m, fmt) \
+({ \
+ if (m) \
+ seq_printf(m, fmt); \
+})
+
/*
* The page dumper groups page table entries of the same type into a single
* description. It uses pg_state to track the range information while
@@ -186,7 +198,7 @@ static void dump_prot(struct pg_state *st, const struct prot_bits *bits,
s = bits->clear;
if (s)
- seq_printf(st->seq, " %s", s);
+ pt_dump_seq_printf(st->seq, " %s", s);
}
}
@@ -200,14 +212,14 @@ static void note_page(struct pg_state *st, unsigned long addr, unsigned level,
st->level = level;
st->current_prot = prot;
st->start_address = addr;
- seq_printf(st->seq, "---[ %s ]---\n", st->marker->name);
+ pt_dump_seq_printf(st->seq, "---[ %s ]---\n", st->marker->name);
} else if (prot != st->current_prot || level != st->level ||
addr >= st->marker[1].start_address) {
const char *unit = units;
unsigned long delta;
if (st->current_prot) {
- seq_printf(st->seq, "0x%016lx-0x%016lx ",
+ pt_dump_seq_printf(st->seq, "0x%016lx-0x%016lx ",
st->start_address, addr);
delta = (addr - st->start_address) >> 10;
@@ -215,17 +227,17 @@ static void note_page(struct pg_state *st, unsigned long addr, unsigned level,
delta >>= 10;
unit++;
}
- seq_printf(st->seq, "%9lu%c %s", delta, *unit,
+ pt_dump_seq_printf(st->seq, "%9lu%c %s", delta, *unit,
pg_level[st->level].name);
if (pg_level[st->level].bits)
dump_prot(st, pg_level[st->level].bits,
pg_level[st->level].num);
- seq_puts(st->seq, "\n");
+ pt_dump_seq_puts(st->seq, "\n");
}
if (addr >= st->marker[1].start_address) {
st->marker++;
- seq_printf(st->seq, "---[ %s ]---\n", st->marker->name);
+ pt_dump_seq_printf(st->seq, "---[ %s ]---\n", st->marker->name);
}
st->start_address = addr;
@@ -235,7 +247,7 @@ static void note_page(struct pg_state *st, unsigned long addr, unsigned level,
if (addr >= st->marker[1].start_address) {
st->marker++;
- seq_printf(st->seq, "---[ %s ]---\n", st->marker->name);
+ pt_dump_seq_printf(st->seq, "---[ %s ]---\n", st->marker->name);
}
}
--
2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Mark Rutland <mark.rutland@arm.com> |
|---|---|
| Date | 2016-10-17 13:10 +0200 |
| Subject | Re: [PATCHv2 2/4] arm64: dump: Make the page table dumping seq_file optional |
| Message-ID | <stdXQ-2H4-21@gated-at.bofh.it> |
| In reply to | #1499946 |
On Wed, Oct 12, 2016 at 03:32:00PM -0700, Laura Abbott wrote: > > The page table dumping code always assumes it will be dumping to a > seq_file to userspace. Future code will be taking advantage of > the page table dumping code but will not need the seq_file. Make > the seq_file optional for these cases. > > Acked-by: Mark Rutland <mark.rutland@arm.com> Now that I'm back in the office with access to hardware, I've been able to give this a spin. FWIW, feel free to upgrade the above to: Reviewed-by: Mark Rutland <mark.rutland@arm.com> Tested-by: Mark Rutland <mark.rutland@arm.com> Thanks, Mark.
[toc] | [prev] | [next] | [standalone]
| From | Laura Abbott <labbott@redhat.com> |
|---|---|
| Date | 2016-10-13 00:40 +0200 |
| Subject | [PATCHv2 3/4] arm64: dump: Remove max_addr |
| Message-ID | <srAlQ-2op-33@gated-at.bofh.it> |
| In reply to | #1499945 |
max_addr was added as part of struct ptdump_info but has never actually
been used. Remove it.
Signed-off-by: Laura Abbott <labbott@redhat.com>
---
New for v2 of the series
---
arch/arm64/include/asm/ptdump.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/arch/arm64/include/asm/ptdump.h b/arch/arm64/include/asm/ptdump.h
index 7c35689..8fc0957 100644
--- a/arch/arm64/include/asm/ptdump.h
+++ b/arch/arm64/include/asm/ptdump.h
@@ -30,7 +30,6 @@ struct ptdump_info {
struct mm_struct *mm;
const struct addr_marker *markers;
unsigned long base_addr;
- unsigned long max_addr;
};
void ptdump_walk_pgd(struct seq_file *s, struct ptdump_info *info);
--
2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Mark Rutland <mark.rutland@arm.com> |
|---|---|
| Date | 2016-10-17 13:10 +0200 |
| Subject | Re: [PATCHv2 3/4] arm64: dump: Remove max_addr |
| Message-ID | <stdXP-2H4-19@gated-at.bofh.it> |
| In reply to | #1499947 |
On Wed, Oct 12, 2016 at 03:32:01PM -0700, Laura Abbott wrote:
>
> max_addr was added as part of struct ptdump_info but has never actually
> been used. Remove it.
>
> Signed-off-by: Laura Abbott <labbott@redhat.com>
Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Tested-by: Mark Rutland <mark.rutland@arm.com>
Thanks,
Mark.
> ---
> New for v2 of the series
> ---
> arch/arm64/include/asm/ptdump.h | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/arch/arm64/include/asm/ptdump.h b/arch/arm64/include/asm/ptdump.h
> index 7c35689..8fc0957 100644
> --- a/arch/arm64/include/asm/ptdump.h
> +++ b/arch/arm64/include/asm/ptdump.h
> @@ -30,7 +30,6 @@ struct ptdump_info {
> struct mm_struct *mm;
> const struct addr_marker *markers;
> unsigned long base_addr;
> - unsigned long max_addr;
> };
>
> void ptdump_walk_pgd(struct seq_file *s, struct ptdump_info *info);
> --
> 2.7.4
>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web