diff mbox

[1/8] tunables: Make tunable_list relro

Message ID 1494427637-14555-2-git-send-email-siddhesh@sourceware.org
State New
Headers show

Commit Message

Siddhesh Poyarekar May 10, 2017, 2:47 p.m. UTC
From: Siddhesh Poyarekar <siddhesh.poyarekar@linaro.org>

As of now we don't need tunables to be writable after they have been
set initially, so there is no point in having them writable.  Put
tunable_list in .data.rel.ro so that it is set as read-only after
relocation.  This also allows us to move some of the dl_* variables
that are tunables controlled into the tunables infrastructure instead
of having two copies.

In future if we ever need specific tunables to be writable at runtime,
we can split the tunable_list into two.

Regression tested on x86_64 to verify that tests continue to pass.

	* scripts/gen-tunables.awk: Add attribute_relro to
	tunable_list.

Change-Id: Ibb398bf3c7f1ea3c5d0a7fdd4cb794005a94b02f
---
 scripts/gen-tunables.awk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Adhemerval Zanella Netto May 11, 2017, 12:01 p.m. UTC | #1
On 10/05/2017 11:47, Siddhesh Poyarekar wrote:
> From: Siddhesh Poyarekar <siddhesh.poyarekar@linaro.org>
> 
> As of now we don't need tunables to be writable after they have been
> set initially, so there is no point in having them writable.  Put
> tunable_list in .data.rel.ro so that it is set as read-only after
> relocation.  This also allows us to move some of the dl_* variables
> that are tunables controlled into the tunables infrastructure instead
> of having two copies.
> 
> In future if we ever need specific tunables to be writable at runtime,
> we can split the tunable_list into two.
> 
> Regression tested on x86_64 to verify that tests continue to pass.
> 
> 	* scripts/gen-tunables.awk: Add attribute_relro to
> 	tunable_list.

LGTM, thanks.

> 
> Change-Id: Ibb398bf3c7f1ea3c5d0a7fdd4cb794005a94b02f
> ---
>  scripts/gen-tunables.awk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/gen-tunables.awk b/scripts/gen-tunables.awk
> index 601240a..defb3e7 100644
> --- a/scripts/gen-tunables.awk
> +++ b/scripts/gen-tunables.awk
> @@ -141,7 +141,7 @@ END {
>  
>    # Finally, the tunable list.
>    print "\n#ifdef TUNABLES_INTERNAL"
> -  print "static tunable_t tunable_list[] = {"
> +  print "static tunable_t tunable_list[] attribute_relro = {"
>    for (t in types) {
>      for (n in types[t]) {
>        for (m in types[t][n]) {
>
diff mbox

Patch

diff --git a/scripts/gen-tunables.awk b/scripts/gen-tunables.awk
index 601240a..defb3e7 100644
--- a/scripts/gen-tunables.awk
+++ b/scripts/gen-tunables.awk
@@ -141,7 +141,7 @@  END {
 
   # Finally, the tunable list.
   print "\n#ifdef TUNABLES_INTERNAL"
-  print "static tunable_t tunable_list[] = {"
+  print "static tunable_t tunable_list[] attribute_relro = {"
   for (t in types) {
     for (n in types[t]) {
       for (m in types[t][n]) {