linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Jinbum Park <jinb.park7@gmail.com>
Cc: linux-arm-kernel@lists.infradead.org,
	LKML <linux-kernel@vger.kernel.org>,
	kernel-hardening@lists.openwall.com,
	Afzal Mohammed <afzal.mohd.ma@gmail.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Laura Abbott <labbott@redhat.com>,
	Russell King <linux@armlinux.org.uk>,
	Greg KH <gregkh@linuxfoundation.org>,
	Vladimir Murzin <vladimir.murzin@arm.com>,
	Arnd Bergmann <arnd@arndb.de>
Subject: Re: [kernel-hardening][PATCH v3 1/3] arm: mm: dump: make page table dumping reusable
Date: Wed, 6 Dec 2017 15:26:22 -0800	[thread overview]
Message-ID: <CAGXu5jJ+BbTwoM1DvwAJGRh=4EiMU1SOoPDPX2VmOC5w2cNHSw@mail.gmail.com> (raw)
In-Reply-To: <CAErMHp9BBaJ8iNyjOS3nU+LUWNijL6FSOKSmVAYY_20nfB9nAQ@mail.gmail.com>

On Wed, Dec 6, 2017 at 1:45 AM, Jinbum Park <jinb.park7@gmail.com> wrote:
>>> +#ifndef __ASM_PTDUMP_H
>>> +#define __ASM_PTDUMP_H
>>> +
>>> +#ifdef CONFIG_ARM_PTDUMP_CORE
>>
>> Is this #ifdef needed? I think this file is only included in dump.c
>> and ptdump_debugfs.c, both of which are only built when
>> CONFIG_ARM_PTDUMP_CORE is defined.
>
> Looking at next patch in this patch-set series ([PATCH v3 3/3] arm:
> mm: dump: add checking for writable and executable pages),
> Not only dump.c and ptdump_debugfs.c but also arch/arm/mm/init.c
> include this file (ptdump.h) to call debug_checkwx().
> mm/init.c is not built only when CONFIG_ARM_PTDUMP_CORE is defined.
> So, This #ifdef seems not be needed for this patch, but is needed for
> this patch-set series.
>
>
>>> +static int ptdump_init(void)
>>> +{
>>> +       ptdump_initialize();
>>> +       return ptdump_debugfs_register(&kernel_ptdump_info,
>>> +                                       "kernel_page_tables");
>>
>> This changes the return value of ptdump_init. This should do similar
>> to what was done before:
>>
>> return ptdump_debugfs_register(&kernel_ptdump_info,
>> "kernel_page_tables") ? 0 : -ENOMEM;
>
>
> ptdump_debugfs_register() already returns what you think.
>
>>> +int ptdump_debugfs_register(struct ptdump_info *info, const char *name)
>>> +{
>>> +       struct dentry *pe;
>>> +
>>> +       pe = debugfs_create_file(name, 0400, NULL, info, &ptdump_fops);
>>> +       return pe ? 0 : -ENOMEM;
>>> +
>>> +}
>
> So "return ptdump_debugfs_register(~~)" is fine.

Ah! Yes, I totally missed the change from create_file to
debugfs_register. Sorry for the noise!

-Kees

-- 
Kees Cook
Pixel Security

      reply	other threads:[~2017-12-06 23:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-04 14:25 [kernel-hardening][PATCH v3 1/3] arm: mm: dump: make page table dumping reusable Jinbum Park
2017-12-05 19:53 ` Kees Cook
2017-12-06  9:45   ` Jinbum Park
2017-12-06 23:26     ` Kees Cook [this message]

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='CAGXu5jJ+BbTwoM1DvwAJGRh=4EiMU1SOoPDPX2VmOC5w2cNHSw@mail.gmail.com' \
    --to=keescook@chromium.org \
    --cc=afzal.mohd.ma@gmail.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=jinb.park7@gmail.com \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=labbott@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mark.rutland@arm.com \
    --cc=vladimir.murzin@arm.com \
    /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;
as well as URLs for NNTP newsgroup(s).