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: <Z8-znMyjTx0kw4-l@bombadil.infradead.org>
Date: Mon, 10 Mar 2025 20:53:00 -0700
From: Luis Chamberlain <mcgrof@...nel.org>
To: Ruiwu Chen <rwchen404@...il.com>
Cc: corbet@....net, joel.granados@...nel.org, keescook@...omium.org,
	linux-doc@...r.kernel.org, linux-fsdevel@...r.kernel.org,
	linux-kernel@...r.kernel.org, viro@...iv.linux.org.uk,
	zachwade.k@...il.com
Subject: Re: [PATCH v2] drop_caches: re-enable message after disabling

On Sat, Mar 08, 2025 at 04:05:49PM +0800, Ruiwu Chen wrote:
> >> When 'echo 4 > /proc/sys/vm/drop_caches' the message is disabled,
> >> but there is no interface to enable the message, only by restarting
> >> the way, so add the 'echo 0 > /proc/sys/vm/drop_caches' way to
> >> enabled the message again.
> >> 
> >> Signed-off-by: Ruiwu Chen <rwchen404@...il.com>
> >
> > You are overcomplicating things, if you just want to re-enable messages
> > you can just use:
> >
> > -		stfu |= sysctl_drop_caches & 4;
> > +		stfu = sysctl_drop_caches & 4;
> >
> > The bool is there as 4 is intended as a bit flag, you can can figure
> > out what values you want and just append 4 to it to get the expected
> > result.
> >
> >  Luis
> 
> Is that what you mean ?
> 
> -               stfu |= sysctl_drop_caches & 4;
> +               stfu ^= sysctl_drop_caches & 4;
> 
> 'echo 4 > /sys/kernel/vm/drop_caches' can disable or open messages,
> This is what I originally thought, but there is uncertainty that when different operators execute the command,
> It is not possible to determine whether this time is enabled or turned on unless you operate it twice.

The way these flags are designed are bits in a flag. If you want to
disable the flag, it'll be disabled. If you want it added it must be
added as a flag. So what I did was just remove the or logic as that
just keeps it on forever. With XOR you end up where if you had it
enabled and then want to enable it again, you disable it.

1 xor 1 = 0

The simple variable setting just always sets it and puts the burden on
the operators to read the existing setting if they don't want to disable
prior settings.

  Luis

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ