Message ID | 20190926175602.33098-19-keescook@chromium.org (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | vmlinux.lds.h: Refactor EXCEPTION_TABLE and NOTES | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/apply_patch | success | Successfully applied on branch next (6edfc6487b474fe01857dc3f1a9cd701bb9b21c8) |
snowpatch_ozlabs/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 18 lines checked |
Hi Kees, On Thu, Sep 26, 2019 at 10:55:51AM -0700, Kees Cook wrote: > The EXCEPTION_TABLE is read-only, so collapse it into RO_DATA. > > Signed-off-by: Kees Cook <keescook@chromium.org> > --- > arch/arm64/kernel/vmlinux.lds.S | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S > index 81d94e371c95..c6ba2eee0ee8 100644 > --- a/arch/arm64/kernel/vmlinux.lds.S > +++ b/arch/arm64/kernel/vmlinux.lds.S > @@ -5,6 +5,8 @@ > * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz> > */ > > +#define RO_DATA_EXCEPTION_TABLE_ALIGN 8 > + > #include <asm-generic/vmlinux.lds.h> > #include <asm/cache.h> > #include <asm/kernel-pgtable.h> > @@ -135,8 +137,8 @@ SECTIONS > . = ALIGN(SEGMENT_ALIGN); > _etext = .; /* End of text section */ > > - RO_DATA(PAGE_SIZE) /* everything from this point to */ > - EXCEPTION_TABLE(8) /* __init_begin will be marked RO NX */ > + /* everything from this point to __init_begin will be marked RO NX */ > + RO_DATA(PAGE_SIZE) > > . = ALIGN(PAGE_SIZE); Do you reckon it would be worth merging this last ALIGN directive into the RO_DATA definition too? Given that we want to map the thing read-only, it really has to be aligned either side. Anyway, that's only a nit, so: Acked-by: Will Deacon <will@kernel.org> Will P.S. Please CC the arm64 maintainers on arm64 patches -- I nearly missed this one!
On Tue, Oct 01, 2019 at 10:03:56AM +0100, Will Deacon wrote: > Hi Kees, > > On Thu, Sep 26, 2019 at 10:55:51AM -0700, Kees Cook wrote: > > The EXCEPTION_TABLE is read-only, so collapse it into RO_DATA. > > > > Signed-off-by: Kees Cook <keescook@chromium.org> > > --- > > arch/arm64/kernel/vmlinux.lds.S | 6 ++++-- > > 1 file changed, 4 insertions(+), 2 deletions(-) > > > > diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S > > index 81d94e371c95..c6ba2eee0ee8 100644 > > --- a/arch/arm64/kernel/vmlinux.lds.S > > +++ b/arch/arm64/kernel/vmlinux.lds.S > > @@ -5,6 +5,8 @@ > > * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz> > > */ > > > > +#define RO_DATA_EXCEPTION_TABLE_ALIGN 8 > > + > > #include <asm-generic/vmlinux.lds.h> > > #include <asm/cache.h> > > #include <asm/kernel-pgtable.h> > > @@ -135,8 +137,8 @@ SECTIONS > > . = ALIGN(SEGMENT_ALIGN); > > _etext = .; /* End of text section */ > > > > - RO_DATA(PAGE_SIZE) /* everything from this point to */ > > - EXCEPTION_TABLE(8) /* __init_begin will be marked RO NX */ > > + /* everything from this point to __init_begin will be marked RO NX */ > > + RO_DATA(PAGE_SIZE) > > > > . = ALIGN(PAGE_SIZE); > > Do you reckon it would be worth merging this last ALIGN directive into the > RO_DATA definition too? Given that we want to map the thing read-only, it > really has to be aligned either side. Actually, taking a closer look, this appears to be redundant: RO_DATA() ends with: . = ALIGN(align) (where "align" is the "PAGE_SIZE" argument to RO_DATA()) > Anyway, that's only a nit, so: > > Acked-by: Will Deacon <will@kernel.org> Thanks! > P.S. Please CC the arm64 maintainers on arm64 patches -- I nearly missed > this one! Okay, I can re-expand my list. I originally had done this but it was getting to be a rather large set of people. :)
diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S index 81d94e371c95..c6ba2eee0ee8 100644 --- a/arch/arm64/kernel/vmlinux.lds.S +++ b/arch/arm64/kernel/vmlinux.lds.S @@ -5,6 +5,8 @@ * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz> */ +#define RO_DATA_EXCEPTION_TABLE_ALIGN 8 + #include <asm-generic/vmlinux.lds.h> #include <asm/cache.h> #include <asm/kernel-pgtable.h> @@ -135,8 +137,8 @@ SECTIONS . = ALIGN(SEGMENT_ALIGN); _etext = .; /* End of text section */ - RO_DATA(PAGE_SIZE) /* everything from this point to */ - EXCEPTION_TABLE(8) /* __init_begin will be marked RO NX */ + /* everything from this point to __init_begin will be marked RO NX */ + RO_DATA(PAGE_SIZE) . = ALIGN(PAGE_SIZE); idmap_pg_dir = .;
The EXCEPTION_TABLE is read-only, so collapse it into RO_DATA. Signed-off-by: Kees Cook <keescook@chromium.org> --- arch/arm64/kernel/vmlinux.lds.S | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)