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] [day] [month] [year] [list]
Message-ID: <CAC5umygk+KnmkQ5O-YV+5a_rEyPbRvK6nkipJiw4Hg8uXXGHQA@mail.gmail.com>
Date:	Fri, 1 Jun 2012 21:38:13 +0900
From:	Akinobu Mita <akinobu.mita@...il.com>
To:	Anton Blanchard <anton@...ba.org>
Cc:	akpm@...ux-foundation.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] fault-inject: Avoid call to random32() if fault injection
 is disabled

2012/6/1 Anton Blanchard <anton@...ba.org>:
>
> After enabling CONFIG_FAILSLAB I noticed random32 in profiles even
> if slub fault injection wasn't enabled at runtime.
>
> should_fail forces a comparison against random32() even if
> probability is 0:
>
>        if (attr->probability <= random32() % 100)
>                return false;
>
> Add a check up front for probability == 0 and avoid all of the more
> complicated checks.
>
> Signed-off-by: Anton Blanchard <anton@...ba.org>
> ---
>
> Index: linux-build/lib/fault-inject.c
> ===================================================================
> --- linux-build.orig/lib/fault-inject.c 2012-02-11 21:22:32.303459860 +1100
> +++ linux-build/lib/fault-inject.c      2012-02-11 22:38:10.470977505 +1100
> @@ -101,6 +101,10 @@ static inline bool fail_stacktrace(struc
>
>  bool should_fail(struct fault_attr *attr, ssize_t size)
>  {
> +       /* No need to check any other properties if the probability is 0 */
> +       if (attr->probability == 0)
> +               return false;
> +
>        if (attr->task_filter && !fail_task(attr, current))
>                return false;
>

Looks good to me.

Acked-by: Akinobu Mita <akinobu.mita@...il.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ