lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221216162500.3023331-1-alexandr.lobakin@intel.com>
Date:   Fri, 16 Dec 2022 17:25:00 +0100
From:   Alexander Lobakin <alexandr.lobakin@...el.com>
To:     Jim Cromie <jim.cromie@...il.com>
Cc:     Alexander Lobakin <alexandr.lobakin@...el.com>, jbaron@...mai.com,
        gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] vmlinux.lds.h: add HEADERED_SECTION_* macros

From: Jim Cromie <jim.cromie@...il.com>
Date: Wed, 16 Nov 2022 17:20:22 -0700

> These macros elaborate on BOUNDED_SECTION_(PRE|POST)_LABEL macros,
> prepending an optional KEEP(.gnu.linkonce##_sec_) reservation, and a
> linker-symbol to address it.
> 
> This allows a developer to define a header struct (which must fit with
> the section's base struct-type), and could contain:

[...]

> diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
> index 85d5d5b203dc..a3b6aa30a525 100644
> --- a/include/asm-generic/vmlinux.lds.h
> +++ b/include/asm-generic/vmlinux.lds.h
> @@ -214,6 +214,21 @@
>  
>  #define BOUNDED_SECTION(_sec)	 BOUNDED_SECTION_BY(_sec, _sec)
>  
> +#define HEADERED_SECTION_PRE_LABEL(_sec_, _label_, _BEGIN_, _END_, _HDR_) \
> +	_HDR_##_label_	= .;						\
> +	KEEP(*(.gnu.linkonce.##_sec_))					\
> +	BOUNDED_SECTION_PRE_LABEL(_sec_, _label_, _BEGIN_, _END_)
> +
> +#define HEADERED_SECTION_POST_LABEL(_sec_, _label_, _BEGIN_, _END_, _HDR_) \
> +	_label_##_HDR_ = .;						\
> +	KEEP(*(.gnu.linkonce.##_sec_))					\
> +	BOUNDED_SECTION_POST_LABEL(_sec_, _label_, _BEGIN_, _END_)
> +
> +#define HEADERED_SECTION_BY(_sec_, _label_)				\
> +	HEADERED_SECTION_PRE_LABEL(_sec_, _label_, __start, __stop)

Now HEADERED_SECTION_PRE_LABEL() takes 5 arguments, but this line
passes only 4 to it. This went unnoticed probably due to that the
macro is not used anywhere, thus can't trigger a compiler error.
Would you prefer to fix it yourself or me to send the fix?[*]

> +
> +#define HEADERED_SECTION(_sec)	 HEADERED_SECTION_BY(_sec, _sec)
> +
>  #ifdef CONFIG_TRACE_BRANCH_PROFILING
>  #define LIKELY_PROFILE()						\
>  	BOUNDED_SECTION_BY(_ftrace_annotated_branch, _annotated_branch_profile)
> -- 
> 2.38.1

[*] If it needs fixing at all -- some people over the MLs say that
    if there's no trigger, then there's nothing to fix :clownface:

Thanks,
Olek

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ