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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y2/P3cMExRt2fUP5@google.com>
Date:   Sat, 12 Nov 2022 16:54:53 +0000
From:   Joel Fernandes <joel@...lfernandes.org>
To:     Connor O'Brien <connoro@...gle.com>
Cc:     linux-kernel@...r.kernel.org, kernel-team@...roid.com,
        John Stultz <jstultz@...gle.com>,
        Qais Yousef <qais.yousef@....com>,
        Ingo Molnar <mingo@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Juri Lelli <juri.lelli@...hat.com>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        Dietmar Eggemann <dietmar.eggemann@....com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
        Daniel Bristot de Oliveira <bristot@...hat.com>,
        Valentin Schneider <vschneid@...hat.com>,
        Will Deacon <will@...nel.org>,
        Waiman Long <longman@...hat.com>,
        Boqun Feng <boqun.feng@...il.com>,
        "Paul E . McKenney" <paulmck@...nel.org>
Subject: Re: [RFC PATCH 10/11] torture: support randomized shuffling for
 proxy exec testing

On Mon, Oct 03, 2022 at 09:45:00PM +0000, Connor O'Brien wrote:
> Quick hack to better surface bugs in proxy execution.
> 
> Shuffling sets the same cpu affinities for all tasks, which makes us
> less likely to hit paths involving migrating blocked tasks onto a cpu
> where they can't run. Add an element of randomness to allow affinities
> of different writer tasks to diverge.
> 
> Signed-off-by: Connor O'Brien <connoro@...gle.com>
> ---
>  kernel/torture.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/torture.c b/kernel/torture.c
> index 789aeb0e1159..1d0dd88369e3 100644
> --- a/kernel/torture.c
> +++ b/kernel/torture.c
> @@ -54,6 +54,9 @@ module_param(verbose_sleep_frequency, int, 0444);
>  static int verbose_sleep_duration = 1;
>  module_param(verbose_sleep_duration, int, 0444);
>  
> +static int random_shuffle;
> +module_param(random_shuffle, int, 0444);
> +
>  static char *torture_type;
>  static int verbose;
>  
> @@ -518,6 +521,7 @@ static void torture_shuffle_task_unregister_all(void)
>   */
>  static void torture_shuffle_tasks(void)
>  {
> +	DEFINE_TORTURE_RANDOM(rand);
>  	struct shuffle_task *stp;
>  
>  	cpumask_setall(shuffle_tmp_mask);
> @@ -537,8 +541,10 @@ static void torture_shuffle_tasks(void)
>  		cpumask_clear_cpu(shuffle_idle_cpu, shuffle_tmp_mask);
>  
>  	mutex_lock(&shuffle_task_mutex);
> -	list_for_each_entry(stp, &shuffle_task_list, st_l)
> -		set_cpus_allowed_ptr(stp->st_t, shuffle_tmp_mask);
> +	list_for_each_entry(stp, &shuffle_task_list, st_l) {
> +		if (!random_shuffle || torture_random(&rand) & 0x1)
> +			set_cpus_allowed_ptr(stp->st_t, shuffle_tmp_mask);
> +	}
>  	mutex_unlock(&shuffle_task_mutex);

Instead of doing it this way, maybe another approach is to randomize the
sleep interval in:

 */
static int torture_shuffle(void *arg)
{
	VERBOSE_TOROUT_STRING("torture_shuffle task started");
	do {
		schedule_timeout_interruptible(shuffle_interval);
		torture_shuffle_tasks();
		...
	} while (...)
	...
}

Right now with this patch you still wakeup the shuffle thread when skipping
the affinity set operation.

thanks,

 - Joel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ