All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@infradead.org>
To: Jani Nikula <jani.nikula@intel.com>
Cc: Markus Heiser <markus.heiser@darmarit.de>,
	Jonathan Corbet <corbet@lwn.net>,
	Linux Media Mailing List <linux-media@vger.kernel.org>,
	linux-doc@vger.kernel.org
Subject: Re: [PATCH 0/4] reST-directive kernel-cmd / include contentent from scripts
Date: Thu, 6 Oct 2016 10:31:32 -0300	[thread overview]
Message-ID: <20161006103132.3a56802a@vento.lan> (raw)
In-Reply-To: <87oa2xrhqx.fsf@intel.com>

Em Thu, 06 Oct 2016 11:42:14 +0300
Jani Nikula <jani.nikula@intel.com> escreveu:

> On Thu, 06 Oct 2016, Markus Heiser <markus.heiser@darmarit.de> wrote:
> > with this series a reST-directive kernel-cmd is introduced. The kernel-cmd
> > directive includes contend from the stdout of a command-line (@mchehab asked
> > for).  

Ok, I ran some tests here and it works as expected.

> I like the fact that this removes Documentation/media/Makefile, and
> cleans up the Sphinx build rule in Documentation/Makefile.sphinx.

Yeah, that sounds great.

> Does
> this also make the documentation buildable with sphinx-build directly,
> without the kernel build system? If so, great.

I guess it probably allows that, if you include the extension on
some other tree.

Just curious here: what use case do you see by building the Kernel
documentation without the Kernel tree?

> However, I would have much preferred the approach I proposed months ago,
> having the extension itself do specifically what parse-headers.pl does
> now. While it may seem generic on the surface, I don't think it's a
> clean or a secure approach to allow running of arbitrary scripts from
> PATH while building documentation. It's certainly not an approach that
> should be encouraged.

Sorry, but I disagree. The security threat of having a random command
doing something wrong is the same as we already have with the Kernel
Makefiles, as they can also run a random command. All it is needed
is to add this to a Makefile:

subdir-y                     += run_some_evil_cmd

If we accept the fact that we do need to run commands when running "make",
it doesn't really matter if such command is at a makefile, inside a 
perl/python script or called via some Sphinx directive. In all cases,
patches need to be reviewed by the community, to be sure that they won't
introduce any vulnerabilities.

Btw, with regards to security, a way bigger threat is if someone
introduces a vulnerable code inside the Kernel code, as this will
affect a lot more systems than a vulnerability at the documentation
build process.

Yet, if you think security is still a high risk, my suggestion
would be to restrict the kernel-cmd script to only run scripts
inside trusted places, like Documentation/sphinx.


-

The real issue here is that Sphinx itself doesn't provide what
it is needed to build the Kernel documentation. Some extra
scripts are required. Right now, we converted maybe 5% of the
documentation to ReST, and we're using running two perl scripts:
	- kernel-doc
	- parse-headers.pl

We also identified that, if we want to add the MAINTAINERS file to
some documentation (or a parsed version of it), we would need an extra
script to filter it[1].

I can think on other use cases to run such scripts[2].

What I'm saying is that, we can keep adding a Sphinx-specific
extension for every such needs, with will result in code duplication
and will make harder to maintain it, or we can use a generic
solution like this kernel-cmd extension.

IMO, a generic solution is a way better, as it sounds easier to
maintain.

Regards,
Mauro

[1] https://git.linuxtv.org/mchehab/experimental.git/commit/?h=lkml-books&id=c8b07684c0278d7f9d0e30f575eb4be3a2da4c3b

[2] There's another possible usecase, with I'm not convinced yet
whether should be addressed or not.

At the media subsystem, we use 8 out-of-tree scripts that update
the list of supported USB and PCI media boards, e. g. the files under:
	Documentation/media/v4l-drivers/*cardlist.rst

Such scripts used to be part of the mercurial tree, before we moved the 
media development to git, like this one:
	https://linuxtv.org/hg/v4l-dvb/file/3724e93f7af5/v4l/scripts/bttv.pl

Currently, I'm using a local fork of the old scripts, and, when I
notice a patch for a driver with a cardlist, if I remember, I run the
scripts to add to update the cardlists. While it could be kept
OOT forever, if moved it to the Kernel tree,  the documentation will 
always reflect the Kernel status, with is, IMHO, a good thing.

  reply	other threads:[~2016-10-06 13:31 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-06  7:20 [PATCH 0/4] reST-directive kernel-cmd / include contentent from scripts Markus Heiser
2016-10-06  7:20 ` [PATCH 1/4] doc-rst: " Markus Heiser
2016-10-17 16:46   ` Mauro Carvalho Chehab
2016-10-18  6:07     ` Jani Nikula
2016-10-18  6:52       ` Markus Heiser
2016-10-18  9:13       ` Mauro Carvalho Chehab
2016-10-18  7:03     ` Markus Heiser
2016-10-18  8:59       ` Mauro Carvalho Chehab
2016-10-18 10:06       ` Mauro Carvalho Chehab
2016-10-18 11:36         ` Markus Heiser
2016-10-06  7:20 ` [PATCH 2/4] doc-rst: customize RTD theme; literal-block Markus Heiser
2016-10-06  7:20 ` [PATCH 3/4] doc-rst: migrated media build kernel-cmd directive Markus Heiser
2016-10-06 11:46   ` Mauro Carvalho Chehab
2016-10-06  7:20 ` [PATCH 4/4] doc-rst: remove the kernel-include directive Markus Heiser
2016-10-06  8:42 ` [PATCH 0/4] reST-directive kernel-cmd / include contentent from scripts Jani Nikula
2016-10-06 13:31   ` Mauro Carvalho Chehab [this message]
2016-10-06 14:21     ` Jani Nikula
2016-10-06 16:50       ` Mauro Carvalho Chehab
2016-10-07  5:56         ` Jani Nikula
2016-10-11  7:26           ` Markus Heiser
2016-10-11 14:28             ` Mauro Carvalho Chehab
2016-10-11 15:34               ` Jani Nikula
2016-10-11 16:06                 ` Markus Heiser
2016-10-11 16:45                   ` Mauro Carvalho Chehab
2016-10-12  6:57                     ` Markus Heiser
2016-10-12  8:20                   ` Jani Nikula
2016-10-21 22:05             ` Jonathan Corbet
2016-10-22 10:56               ` Mauro Carvalho Chehab
2016-10-22 15:04                 ` Jonathan Corbet
2016-10-22 16:46                   ` Markus Heiser
2016-10-22 19:10                   ` Mauro Carvalho Chehab
2016-10-23 11:20                 ` Mauro Carvalho Chehab

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=20161006103132.3a56802a@vento.lan \
    --to=mchehab@infradead.org \
    --cc=corbet@lwn.net \
    --cc=jani.nikula@intel.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=markus.heiser@darmarit.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.