[PATCH 2/2] powerpc/crypto: don't build aes-gcm-p10 by default
From: Omar Sandoval None of the other accelerated crypto modules are built by default. Signed-off-by: Omar Sandoval --- arch/powerpc/crypto/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/powerpc/crypto/Kconfig b/arch/powerpc/crypto/Kconfig index 81ae015861c0..97802c72317c 100644 --- a/arch/powerpc/crypto/Kconfig +++ b/arch/powerpc/crypto/Kconfig @@ -101,7 +101,6 @@ config CRYPTO_AES_GCM_P10 select CRYPTO_ALGAPI select CRYPTO_AEAD select CRYPTO_SKCIPHER - default m help AEAD cipher: AES cipher algorithms (FIPS-197) GCM (Galois/Counter Mode) authenticated encryption mode (NIST SP800-38D) -- 2.41.0
[PATCH 1/2] powerpc/crypto: fix missing skcipher dependency for aes-gcm-p10
From: Omar Sandoval My stripped down configuration fails to build with: ERROR: modpost: "skcipher_walk_aead_encrypt" [arch/powerpc/crypto/aes-gcm-p10-crypto.ko] undefined! ERROR: modpost: "skcipher_walk_done" [arch/powerpc/crypto/aes-gcm-p10-crypto.ko] undefined! ERROR: modpost: "skcipher_walk_aead_decrypt" [arch/powerpc/crypto/aes-gcm-p10-crypto.ko] undefined! Fix it by selecting CRYPTO_SKCIPHER. Signed-off-by: Omar Sandoval --- arch/powerpc/crypto/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/crypto/Kconfig b/arch/powerpc/crypto/Kconfig index ad1872518992..81ae015861c0 100644 --- a/arch/powerpc/crypto/Kconfig +++ b/arch/powerpc/crypto/Kconfig @@ -100,6 +100,7 @@ config CRYPTO_AES_GCM_P10 select CRYPTO_LIB_AES select CRYPTO_ALGAPI select CRYPTO_AEAD + select CRYPTO_SKCIPHER default m help AEAD cipher: AES cipher algorithms (FIPS-197) -- 2.41.0
Re: [PATCH 2/2] Discard .note.gnu.property sections in generic NOTES
On Mon, Sep 19, 2022 at 06:33:40PM +0100, Mark Brown wrote: > On Mon, Sep 19, 2022 at 10:26:17AM -0700, Omar Sandoval wrote: > > In general if you're going to CC someone into a thread please put > a note at the start of your mail explaining why, many of us get > copied on a lot of irrelevant things for no apparently reason so > if it's not immediately obvious why we were sent a mail there's > every chance it'll just be deleted. Sorry about that. > > I'm not sure what exactly arch/arm64/include/asm/assembler.h is doing > > with this file. Perhaps the author, Mark Brown, can clarify? > > I don't understand the question, what file are you talking about > here? arch/arm64/include/asm/assembler.h is itself a file and I > couldn't find anything nearby in your mail talking about a file... Oops, that was a typo, I meant to say "I'm not sure what arch/arm64/include/asm/assembler.h is doing with this *note*". To be more explicit: does ARM64 need .note.gnu.property/NT_GNU_PROPERTY_TYPE_0 in vmlinux? Thanks, Omar
Re: [PATCH 2/2] Discard .note.gnu.property sections in generic NOTES
On Sat, Sep 17, 2022 at 06:31:20AM +, Christophe Leroy wrote: > > > Le 16/09/2022 à 21:40, Omar Sandoval a écrit : > > [Vous ne recevez pas souvent de courriers de osan...@osandov.com. D?couvrez > > pourquoi ceci est important ? https://aka.ms/LearnAboutSenderIdentification > > ] > > > > On Tue, Apr 28, 2020 at 06:21:05AM -0700, H.J. Lu wrote: > >> With the command-line option, -mx86-used-note=yes, the x86 assembler > >> in binutils 2.32 and above generates a program property note in a note > >> section, .note.gnu.property, to encode used x86 ISAs and features. But > >> kernel linker script only contains a single NOTE segment: > >> > >> PHDRS { > >> text PT_LOAD FLAGS(5); > >> data PT_LOAD FLAGS(6); > >> percpu PT_LOAD FLAGS(6); > >> init PT_LOAD FLAGS(7); > >> note PT_NOTE FLAGS(0); > >> } > >> SECTIONS > >> { > >> ... > >> .notes : AT(ADDR(.notes) - 0x8000) { __start_notes = .; > >> KEEP(*(.not > >> e.*)) __stop_notes = .; } :text :note > >> ... > >> } > >> > >> The NOTE segment generated by kernel linker script is aligned to 4 bytes. > >> But .note.gnu.property section must be aligned to 8 bytes on x86-64 and > >> we get > >> > >> [hjl@gnu-skx-1 linux]$ readelf -n vmlinux > >> > >> Displaying notes found in: .notes > >>OwnerData size Description > >>Xen 0x0006 Unknown note type: (0x0006) > >> description data: 6c 69 6e 75 78 00 > >>Xen 0x0004 Unknown note type: (0x0007) > >> description data: 32 2e 36 00 > >>xen-3.0 0x0005 Unknown note type: (0x006e6558) > >> description data: 08 00 00 00 03 > >> readelf: Warning: note with invalid namesz and/or descsz found at offset > >> 0x50 > >> readelf: Warning: type: 0x, namesize: 0x006e6558, descsize: > >> 0x8000, alignment: 8 > >> [hjl@gnu-skx-1 linux]$ > >> > >> Since note.gnu.property section in kernel image is never used, this patch > >> discards .note.gnu.property sections in kernel linker script by adding > >> > >> /DISCARD/ : { > >>*(.note.gnu.property) > >> } > >> > >> before kernel NOTE segment in generic NOTES. > >> > >> Signed-off-by: H.J. Lu > >> Reviewed-by: Kees Cook > >> --- > >> include/asm-generic/vmlinux.lds.h | 7 +++ > >> 1 file changed, 7 insertions(+) > >> > >> diff --git a/include/asm-generic/vmlinux.lds.h > >> b/include/asm-generic/vmlinux.lds.h > >> index 71e387a5fe90..95cd678428f4 100644 > >> --- a/include/asm-generic/vmlinux.lds.h > >> +++ b/include/asm-generic/vmlinux.lds.h > >> @@ -833,7 +833,14 @@ > >> #define TRACEDATA > >> #endif > >> > >> +/* > >> + * Discard .note.gnu.property sections which are unused and have > >> + * different alignment requirement from kernel note sections. > >> + */ > >> #define NOTES > >> \ > >> + /DISCARD/ : { \ > >> + *(.note.gnu.property) \ > >> + } \ > >>.notes : AT(ADDR(.notes) - LOAD_OFFSET) { \ > >>__start_notes = .; \ > >>KEEP(*(.note.*))\ > >> -- > >> 2.25.4 > >> > > > > Hi, H.J., > > > > I recently ran into this same .notes corruption when building kernels on > > Arch Linux. > > > > What ended up happening to this patch? It doesn't appear to have been > > merged, and I couldn't find any further discussion about it. I'm happy > > to resend it for you if you need a hand. > > As far as I can see, ARM64 is doing something with that section, see > arch/arm64/include/asm/assembler.h > > Instead of discarding that section, would it be enough to force > alignment of .notes to 8 bytes ? > > Thanks > Christophe Unfortunately, "alignment requirement" here isn't just the starting alignment of the .notes section; it also refers to internal padding in the note metadata to keep things aligned. Changing this would break anyone who
Re: [PATCH 2/2] Discard .note.gnu.property sections in generic NOTES
On Tue, Apr 28, 2020 at 06:21:05AM -0700, H.J. Lu wrote: > With the command-line option, -mx86-used-note=yes, the x86 assembler > in binutils 2.32 and above generates a program property note in a note > section, .note.gnu.property, to encode used x86 ISAs and features. But > kernel linker script only contains a single NOTE segment: > > PHDRS { > text PT_LOAD FLAGS(5); > data PT_LOAD FLAGS(6); > percpu PT_LOAD FLAGS(6); > init PT_LOAD FLAGS(7); > note PT_NOTE FLAGS(0); > } > SECTIONS > { > ... > .notes : AT(ADDR(.notes) - 0x8000) { __start_notes = .; > KEEP(*(.not > e.*)) __stop_notes = .; } :text :note > ... > } > > The NOTE segment generated by kernel linker script is aligned to 4 bytes. > But .note.gnu.property section must be aligned to 8 bytes on x86-64 and > we get > > [hjl@gnu-skx-1 linux]$ readelf -n vmlinux > > Displaying notes found in: .notes > OwnerData size Description > Xen 0x0006 Unknown note type: (0x0006) >description data: 6c 69 6e 75 78 00 > Xen 0x0004 Unknown note type: (0x0007) >description data: 32 2e 36 00 > xen-3.0 0x0005 Unknown note type: (0x006e6558) >description data: 08 00 00 00 03 > readelf: Warning: note with invalid namesz and/or descsz found at offset 0x50 > readelf: Warning: type: 0x, namesize: 0x006e6558, descsize: > 0x8000, alignment: 8 > [hjl@gnu-skx-1 linux]$ > > Since note.gnu.property section in kernel image is never used, this patch > discards .note.gnu.property sections in kernel linker script by adding > > /DISCARD/ : { > *(.note.gnu.property) > } > > before kernel NOTE segment in generic NOTES. > > Signed-off-by: H.J. Lu > Reviewed-by: Kees Cook > --- > include/asm-generic/vmlinux.lds.h | 7 +++ > 1 file changed, 7 insertions(+) > > diff --git a/include/asm-generic/vmlinux.lds.h > b/include/asm-generic/vmlinux.lds.h > index 71e387a5fe90..95cd678428f4 100644 > --- a/include/asm-generic/vmlinux.lds.h > +++ b/include/asm-generic/vmlinux.lds.h > @@ -833,7 +833,14 @@ > #define TRACEDATA > #endif > > +/* > + * Discard .note.gnu.property sections which are unused and have > + * different alignment requirement from kernel note sections. > + */ > #define NOTES > \ > + /DISCARD/ : { \ > + *(.note.gnu.property) \ > + } \ > .notes : AT(ADDR(.notes) - LOAD_OFFSET) { \ > __start_notes = .; \ > KEEP(*(.note.*))\ > -- > 2.25.4 > Hi, H.J., I recently ran into this same .notes corruption when building kernels on Arch Linux. What ended up happening to this patch? It doesn't appear to have been merged, and I couldn't find any further discussion about it. I'm happy to resend it for you if you need a hand. Thanks, Omar