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]
Date:   Thu, 13 Apr 2023 00:54:43 +0800
From:   Wen Yang <wenyang.linux@...mail.com>
To:     Andrew Morton <akpm@...ux-foundation.org>
Cc:     Mel Gorman <mgorman@...hsingularity.net>,
        Oscar Salvador <osalvador@...e.de>,
        William Lam <william.lam@...edance.com>,
        Fu Wei <wefu@...hat.com>, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm: compaction: optimize compact_memory to comply with
 the admin-guide


在 2023/4/12 04:48, Andrew Morton 写道:
> On Wed, 12 Apr 2023 02:24:26 +0800 wenyang.linux@...mail.com wrote:
>
>> For the /proc/sys/vm/compact_memory file, the admin-guide states:
>> When 1 is written to the file, all zones are compacted such that free
>> memory is available in contiguous blocks where possible. This can be
>> important for example in the allocation of huge pages although processes
>> will also directly compact memory as required
>>
>> But it was not strictly followed, writing any value would cause all
>> zones to be compacted. In some critical scenarios, some applications
>> operating it, such as echo 0, have caused serious problems.
> Really?  You mean someone actually did this and didn't observe the
> effect during their testing?

Thanks for your reply.

Since /proc/sys/vm/compact_memory has been well documented for over a 
decade:

https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/Documentation/admin-guide/sysctl/vm.rst#n109

it is believed that only writing 1 will trigger trigger all zones to be 
compacted.

Especially for those who write applications, they may only focus on 
documentation and generally do not read kernel code.  Moreover, such 
problems are not easily detected through testing on low pressure machines.

Writing any meaningful or meaningless values will trigger it and affect 
the entire server:

# echo 1 > /proc/sys/vm/compact_memory
# echo 0 > /proc/sys/vm/compact_memory
# echo dead > /proc/sys/vm/compact_memory
# echo "hello world" > /proc/sys/vm/compact_memory

The implementation of this high-risk operation may require following the 
admin-guides.

--

Best wishes,

Wen


>> It has been slightly optimized to comply with the admin-guide.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ