Linux Test Project
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [RFC PATCH v3 10/10] ima: Print /proc/cmdline and IMA kernel config
Date: Wed, 25 Apr 2018 15:40:03 +0200	[thread overview]
Message-ID: <20180425134003.GB24333@rei> (raw)
In-Reply-To: <20180425131620.GA27526@x230>

Hi!
> > Just a small remark here: not all distributions have /boot/config-* files
> > in place. I don't remember which ones this were.
> > Wouldn't it make sense to check this file, if it does not exist check
> > if /proc/config.gz is available? 
> I haven't found any normal distro not having config in place (openSUSE/SLE, Debian/Ubuntu,
> CentOS/Red Hat), but there might be some. I guess most of embedded devices don't have
> that (it's a question if they have IKCONFIG_PROC=y) but why not to try it.

Embedded usually dont have neither of them.

Also depending on the existence of /boot/config-* is really bad idea,
just imagine you compiled and kexeced testing kernel and testcases are
starting to fail for no good reason.

> I wonder if we'd benefit from having these functions in shell API:
> is_enabled(CONFIG_FOO)
> is_module(CONFIG_FOO)
> is_builtin(CONFIG_FOO)
> 
> which would do simple grep of either /boot/config-$(uname -r) or /proc/config.gz.

Generally you cannot detect features of the running kernel by the
/boot/config-* files. We tried that and it failed miserably.

We cannot rely on /proc/config.gz because many kernels have that
disabled to spare some space.

It's sad but the only reasonable way how to detect if kernel does
support something is to try to call the syscall/open and read sysfs
file/etc. and detect ENOSYS/ENOTTY/etc.

-- 
Cyril Hrubis
chrubis@suse.cz

  reply	other threads:[~2018-04-25 13:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-24 18:35 [LTP] [RFC PATCH v3 10/10] ima: Print /proc/cmdline and IMA kernel config Petr Vorel
2018-04-25  7:41 ` Michael Moese
2018-04-25 13:16   ` Petr Vorel
2018-04-25 13:40     ` Cyril Hrubis [this message]
2018-04-25 14:02       ` Petr Vorel
2018-04-25 14:07         ` Cyril Hrubis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180425134003.GB24333@rei \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox