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]
Message-ID: <CAKgze5YFMugCsum8SX+qE26BwxQRW0Uu2qKjEYusFerqk3cEMA@mail.gmail.com>
Date:   Tue, 15 Feb 2022 11:14:39 -0300
From:   Martin Fernandez <martin.fernandez@...ypsium.com>
To:     Mike Rapoport <rppt@...nel.org>
Cc:     Kees Cook <keescook@...omium.org>, linux-kernel@...r.kernel.org,
        linux-efi@...r.kernel.org, platform-driver-x86@...r.kernel.org,
        linux-mm@...ck.org, tglx@...utronix.de, mingo@...hat.com,
        bp@...en8.de, dave.hansen@...ux.intel.com, x86@...nel.org,
        hpa@...or.com, ardb@...nel.org, dvhart@...radead.org,
        andy@...radead.org, gregkh@...uxfoundation.org, rafael@...nel.org,
        akpm@...ux-foundation.org, daniel.gutson@...ypsium.com,
        hughsient@...il.com, alex.bazhaniuk@...ypsium.com,
        alison.schofield@...el.com
Subject: Re: [PATCH v6 3/6] x86/e820: Refactor range_update and range_remove

On 2/15/22, Mike Rapoport <rppt@...nel.org> wrote:
> Hi Martin,
>
> On Tue, Feb 08, 2022 at 06:01:21PM -0300, Martin Fernandez wrote:
>> On 2/8/22, Mike Rapoport <rppt@...nel.org> wrote:
>> > On Mon, Feb 07, 2022 at 01:45:40PM -0800, Kees Cook wrote:
>> >> On Thu, Feb 03, 2022 at 01:43:25PM -0300, Martin Fernandez wrote:
>> >> > __e820__range_update and e820__range_remove had a very similar
>> >> > implementation with a few lines different from each other, the lines
>> >> > that actually perform the modification over the e820_table. The
>> >> > similiraties were found in the checks for the different cases on how
>> >> > each entry intersects with the given range (if it does at all).
>> >> > These
>> >> > checks were very presice and error prone so it was not a good idea
>> >> > to
>> >> > have them in both places.
>> >>
>> >> Yay removing copy/paste code! :)
>> >
>> > Removing copy/paste is nice but diffstat of
>> >
>> >  arch/x86/kernel/e820.c | 383 ++++++++++++++++++++++++++++++-----------
>> >  1 file changed, 283 insertions(+), 100 deletions(-)
>> >
>> > does not look nice even accounting for lots of comments :(
>> >
>> > I didn't look closely, but diffstat clues that the refactoring making
>> > things much more complex.
>> >
>>
>> Yes, that diffstat surprised me as well.
>>
>> I have to mention that 110 of those lines are kerneldocs and blank
>> lines, which is quite a lot. Also you have to take into account that I
>> expanded most of the function definitions for better formatting, which
>> also took some space.
>
> At last I had time to look more closely and I think that using a set of
> callbacks is over-complicated.
>
> I think this can be done way simpler, e.g like this (untested) draft:
>
> https://git.kernel.org/rppt/h/x86/e820-update-range
>

Thanks for taking the time to reviewing it.

Yeah, I did something like that in a previous version. Altough I
wasn't really happy with that.

https://lore.kernel.org/linux-efi/20220113213027.457282-4-martin.fernandez@eclypsium.com/

I think that with the struct with the function arguments looks more
clear than what I did, but you have to take into account that I need
to create yet
another function similar to those and another parameter to the struct,
and with that I think that __e820__range_update will look scary.

I'll give it a try anyway!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ