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: <1402671597.7963.15.camel@misato.fc.hp.com>
Date:	Fri, 13 Jun 2014 08:59:57 -0600
From:	Toshi Kani <toshi.kani@...com>
To:	Tang Chen <tangchen@...fujitsu.com>
Cc:	gregkh@...uxfoundation.org, akpm@...ux-foundation.org,
	tj@...nel.org, hpa@...or.com, mingo@...e.hu, laijs@...fujitsu.com,
	isimatu.yasuaki@...fujitsu.com, hutao@...fujitsu.com,
	guz.fnst@...fujitsu.com, linux-kernel@...r.kernel.org,
	linux-mm@...ck.org
Subject: Re: [PATCH v2 1/2] mem-hotplug: Avoid illegal state prefixed with
 legal state when changing state of memory_block.

On Fri, 2014-06-06 at 11:58 +0800, Tang Chen wrote:
> We use the following command to online a memory_block:
> 
> echo online|online_kernel|online_movable > /sys/devices/system/memory/memoryXXX/state
> 
> But, if we do the following:
> 
> echo online_fhsjkghfkd > /sys/devices/system/memory/memoryXXX/state
> 
> the block will also be onlined.
> 
> This is because the following code in store_mem_state() does not compare the whole string,
> but only the prefix of the string.
> 
> store_mem_state()
> {
> 	......
>  328         if (!strncmp(buf, "online_kernel", min_t(int, count, 13)))
> 
> Here, only compare the first 13 letters of the string. If we give "online_kernelXXXXXX",
> it will be recognized as online_kernel, which is incorrect.
> 
>  329                 online_type = ONLINE_KERNEL;
>  330         else if (!strncmp(buf, "online_movable", min_t(int, count, 14)))
> 
> We have the same problem here,
> 
>  331                 online_type = ONLINE_MOVABLE;
>  332         else if (!strncmp(buf, "online", min_t(int, count, 6)))
> 
> here,
> 
> (Here is more problematic. If we give online_movalbe, which is a typo of online_movable,
>  it will be recognized as online without noticing the author.)
> 
>  333                 online_type = ONLINE_KEEP;
>  334         else if (!strncmp(buf, "offline", min_t(int, count, 7)))
> 
> and here.
> 
>  335                 online_type = -1;
>  336         else {
>  337                 ret = -EINVAL;
>  338                 goto err;
>  339         }
> 	......
> }
> 
> This patch fix this problem by using sysfs_streq() to compare the whole string.
> 
> Reported-by: Hu Tao <hutao@...fujitsu.com>
> Signed-off-by: Tang Chen <tangchen@...fujitsu.com>

Acked-by: Toshi Kani <toshi.kani@...com>

Thanks,
-Toshi


--
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