Re: [PATCH v8 05/14] x86: conditionally place regular ASM functions into separate sections

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Date: Fri, 3 Dec 2021 10:44:10 +0100

> On Thu, Dec 02, 2021 at 11:32:05PM +0100, Alexander Lobakin wrote:
> > Use the newly introduces macros to create unique separate sections
> > for (almost) every "regular" ASM function (i.e. for those which
> > aren't explicitly put into a specific one).
> > There should be no leftovers as input .text will be size-asserted
> > in the LD script generated for FG-KASLR.
> 
> *groan*...
> 
> Please, can't we do something like:
> 
> #define SYM_PUSH_SECTION(name)	\
> .if section == .text		\
> .push_section .text.##name	\
> .else				\
> .push_section .text		\
> .endif

This condition

.pushsection .text
.if section == .text
# do something
.endif
.popsection

doesn't really works. `do something` doesn't happen.
This works only when

.pushsection .text
.equ section, .text

but it's not really okayish I'd say to find all .{,push}section
occurences and replace them with a macro (which would also do .equ).

I don't really know how %S with --sectname-subst should help me as

.if %S == .text
# do something
.endif

doesn't work at all (syntax error) -- and it shouldn't, %S is
supposed to work only inside .{,push}section directives.

I could do unconditional

.pushsection %S.##name
                ^^^^^^ function name

but this would involve changing LDS scripts (and vmlinux.lds.h) to
let's say replace *(.noinstr.text) with *(.noinstr.text*).

So I hope there is a way to get current section name? If not, then
the last option is the least harmful I suppose.
At least not as harmful as current approach with alternative macros,
far from it lol.

> 
> #define SYM_POP_SECTION()	\
> .pop_section
> 
> and wrap that inside the existing SYM_FUNC_START*() SYM_FUNC_END()
> macros.

Thanks,
Al



[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux