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: <CAP4=nvS08OtNdGdFfVNst09HnZjR6fsoCMPKsbTb-Vey8wyX8g@mail.gmail.com>
Date: Thu, 1 Aug 2024 11:44:52 +0200
From: Tomas Glozar <tglozar@...hat.com>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: linux-trace-kernel@...r.kernel.org, linux-kernel@...r.kernel.org, 
	jwyatt@...hat.com, jkacur@...hat.com
Subject: Re: [PATCH v2 3/6] rtla/utils: Add idle state disabling via libcpupower

>
> Need to check if the calloc failed and return an error if it did.
>

Definitely, I completely missed that.

>
> Hmm, should this warn if state is not zero and disabled is negative.
>

rtla timerlat hist/top will error out if save_cpu_idle_disable_state
returns a negative value, so I don't think a warning is necessary
here.
```
            if (save_cpu_idle_disable_state(i) < 0) {
                err_msg("Could not save cpu idle state.\n");
                goto out_free;
            }
```

>
> Should probably have a check to see if saved_cpu_idle_disable exists.
>
> > +     nr_states = cpuidle_state_count(cpu);
> > +
> > +     if (nr_states == 0)
> > +             return 0;
> > +
>
> As well as saved_cpu_idle_disable_state[cpu] exists.
>
> Just for robustness.
>

Right, that would help catch some possible bugs if
restore_cpu_idle_disable_state is ever called before
save_cpu_idle_disable_state. The values of
saved_cpu_idle_disable_state and saved_cpu_idle_disable_state[cpu]
have to be read anyway, checking for zero should not make any
noticeable difference.

>
> No need to check here. free() works fine with passing NULL to it.
>

Ah, I see, I need to check that for saved_cpu_idle_disable_state so
that I won't be accessing null memory in the for loop, but not for
saved_cpu_idle_disable_state[cpu], where I just call free().

Tomas


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ