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:   Tue, 7 Feb 2017 12:00:45 -0300
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     Borislav Petkov <bp@...en8.de>
Cc:     Ingo Molnar <mingo@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Robert Richter <rric@...nel.org>,
        Vince Weaver <vince@...ter.net>,
        lkml <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/2] tools/lib/api/fs: Add procfs int read/write helpers

Em Tue, Feb 07, 2017 at 11:30:01AM +0100, Borislav Petkov escreveu:
> On Mon, Feb 06, 2017 at 10:43:56PM -0300, Arnaldo Carvalho de Melo wrote:
> > >  int sysctl__read_int(const char *sysctl, int *value);
> > 
> > Isn't sysctl__read_int() what you want?
> 
> Right, so looking at this: don't you think that having both sysctl__*
> and procfs__* is a little redundant?
> 
> The sysctl* things are doing the accesses over proc so shouldn't it all
> be procfs__* interfaces and no sysctl__* ones at all
> 
> or
> 
> at least the sysctl__* ones should call the procfs__* ones?

Well, I see this as: sysctls are implemented as files in procfs, but
could conceivably be implemented somewhere else, just like the events
file was implemented in debugfs but then was moved to a separate
filesystem type, tracefs.

So it being in procfs is an implementation detail, what I'm interested
are sysctls, and names for sysctls will be appended to wherever the
sysctl is made available in the file system.

For instance:

[root@...et ~]# sysctl kernel.watchdog
kernel.watchdog = 1
[root@...et ~]#

So the sysctl is "kernel.watchdog" and it is set to one.

So, I suggest you use:

	if (sysctl__read_int("kernel/watchdog", &watchdog_value) == 0)
		/* do whatever you want with it */

And forget that under the hood this is in something called "procfs".

:-)

- Arnaldo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ