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]
Date:	Fri, 2 Oct 2009 15:01:48 -0700
From:	Paul Menage <menage@...gle.com>
To:	KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
Cc:	LKML <linux-kernel@...r.kernel.org>, linux-mm <linux-mm@...ck.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Li Zefan <lizf@...fujitsu.com>
Subject: Re: [PATCH 3/3] cgroup: fix strstrip() abuse

On Fri, Oct 2, 2009 at 1:41 AM, KOSAKI Motohiro
<kosaki.motohiro@...fujitsu.com> wrote:
> cgroup_write_X64() and cgroup_write_string() ignore the return
> value of strstrip().
> it makes small inconsistent behavior.
>
> example:
> =========================
>  # cd /mnt/cgroup/hoge
>  # cat memory.swappiness
>  60
>  # echo "59 " > memory.swappiness
>  # cat memory.swappiness
>  59
>  # echo " 58" > memory.swappiness
>  bash: echo: write error: Invalid argument
>
>
> This patch fixes it.
>
> Cc: Li Zefan <lizf@...fujitsu.com>
> Cc: Paul Menage <menage@...gle.com>
> Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>

Acked-by: Paul Menage <menage@...gle.com>

Thanks - although I think I'd s/abuse/misuse/ in the description.

> ---
>  kernel/cgroup.c |    8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
>
> Index: b/kernel/cgroup.c
> ===================================================================
> --- a/kernel/cgroup.c
> +++ b/kernel/cgroup.c
> @@ -1710,14 +1710,13 @@ static ssize_t cgroup_write_X64(struct c
>                return -EFAULT;
>
>        buffer[nbytes] = 0;     /* nul-terminate */
> -       strstrip(buffer);
>        if (cft->write_u64) {
> -               u64 val = simple_strtoull(buffer, &end, 0);
> +               u64 val = simple_strtoull(strstrip(buffer), &end, 0);
>                if (*end)
>                        return -EINVAL;
>                retval = cft->write_u64(cgrp, cft, val);
>        } else {
> -               s64 val = simple_strtoll(buffer, &end, 0);
> +               s64 val = simple_strtoll(strstrip(buffer), &end, 0);
>                if (*end)
>                        return -EINVAL;
>                retval = cft->write_s64(cgrp, cft, val);
> @@ -1753,8 +1752,7 @@ static ssize_t cgroup_write_string(struc
>        }
>
>        buffer[nbytes] = 0;     /* nul-terminate */
> -       strstrip(buffer);
> -       retval = cft->write_string(cgrp, cft, buffer);
> +       retval = cft->write_string(cgrp, cft, strstrip(buffer));
>        if (!retval)
>                retval = nbytes;
>  out:
>
>
>
--
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