[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAErMHp9ZvUiCO4RUSin3jCBghBFNg=xPaLGyB+3vOPjD0zTBgA@mail.gmail.com>
Date: Sun, 3 Dec 2017 11:32:24 +0900
From: park jinbum <jinb.park7@...il.com>
To: Laura Abbott <labbott@...hat.com>
Cc: linux-arm-kernel@...ts.infradead.org,
LKML <linux-kernel@...r.kernel.org>,
kernel-hardening@...ts.openwall.com,
Afzal Mohammed <afzal.mohd.ma@...il.com>,
Mark Rutland <mark.rutland@....com>, linux@...linux.org.uk,
gregkh@...uxfoundation.org, Kees Cook <keescook@...omium.org>,
vladimir.murzin@....com, Arnd Bergmann <arnd@...db.de>
Subject: Re: [kernel-hardening][PATCH v2 3/3] arm: mm: dump: add checking for
writable and executable pages
I agree with your opinion, Laura.
I'll make a new version to take advantage of the existing pg_level and
bits arrays.
Thanks,
Jinbum Park.
2017-12-02 6:59 GMT+09:00 Laura Abbott <labbott@...hat.com>:
> On 12/01/2017 03:34 AM, Jinbum Park wrote:
>>
>> +static inline bool is_prot_ro(struct pg_state *st)
>> +{
>> + if (st->level < 4) {
>> + #ifdef CONFIG_ARM_LPAE
>> + if ((st->current_prot &
>> + (L_PMD_SECT_RDONLY | PMD_SECT_AP2)) ==
>> + (L_PMD_SECT_RDONLY | PMD_SECT_AP2))
>> + return true;
>> + #elif __LINUX_ARM_ARCH__ >= 6
>> + if ((st->current_prot &
>> + (PMD_SECT_APX | PMD_SECT_AP_READ | PMD_SECT_AP_WRITE)) ==
>> + (PMD_SECT_APX | PMD_SECT_AP_WRITE))
>> + return true;
>> + #else
>> + if ((st->current_prot &
>> + (PMD_SECT_AP_READ | PMD_SECT_AP_WRITE)) == 0)
>> + return true;
>> + #endif
>> + } else {
>> + if ((st->current_prot & L_PTE_RDONLY) == L_PTE_RDONLY)
>> + return true;
>> + }
>> +
>> + return false;
>> +}
>> +
>> +static inline bool is_prot_nx(struct pg_state *st)
>> +{
>> + if (st->level < 4) {
>> + if ((st->current_prot & PMD_SECT_XN) == PMD_SECT_XN)
>> + return true;
>> + } else {
>> + if ((st->current_prot & L_PTE_XN) == L_PTE_XN)
>> + return true;
>> + }
>> +
>> + return false;
>> +}
>
>
> I know arm64 checks the bits directly, but the arm32 code is a bit
> more fiddly and I have mixed feelings about copying and pasting
> the checks. It would be cleaner if we could take advantage of
> the existing pg_level and bits arrays. I also don't have my heart
> set on this so if nobody else objects, the code can stay as is.
>
> Thanks,
> Laura
Powered by blists - more mailing lists