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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75Vcd8axwSETRG8eq9Tu7Z0aPTDKfQr__gMsczt1PQ75sdg@mail.gmail.com>
Date:	Thu, 22 Jan 2015 10:59:36 +0200
From:	Andy Shevchenko <andy.shevchenko@...il.com>
To:	"Bryan O'Donoghue" <pure.logic@...us-software.ie>
Cc:	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
	dvhart@...radead.org, boon.leong.ong@...el.com,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 1/1] x86: Add Isolated Memory Regions for Quark X1000

On Thu, Jan 22, 2015 at 3:27 AM, Bryan O'Donoghue
<pure.logic@...us-software.ie> wrote:
> On 21/01/15 20:57, Andy Shevchenko wrote:

[]

>>> +       ret = iosf_mbi_write(QRK_MBI_UNIT_MM, QRK_MBI_MM_WRITE,
>>> +                               reg++, imr->rmask);
>>> +       if (ret)
>>> +               goto done;
>>> +
>>> +       ret = iosf_mbi_write(QRK_MBI_UNIT_MM, QRK_MBI_MM_WRITE,
>>> +                               reg, imr->wmask);
>>
>>
>> Wouldn't be reg++ here as well? Below you substitute full offset which
>> I think points just to next register.
>
>
> I don't think we want to increment below..
>
>>
>>> +       if (ret)
>>> +               goto done;
>>> +
>>> +       /* Lock bit must be set separately to addr_lo address bits */
>>> +       if (lock) {
>>> +               imr->addr_lo |= IMR_LOCK;
>>> +               ret = iosf_mbi_write(QRK_MBI_UNIT_MM, QRK_MBI_MM_WRITE,
>>> +                                       reg - IMR_LOCK_OFF,
>>> imr->addr_lo);
>>> +       }
>
>
> ..because we calculate an offset anyway. An additional increment would just
> be unnecessary cycles.

Offset is a compile-time constant, right? And it should be 4.
Otherwise its meaning somehow looks confusing. I looked again and
would recommend to substitute it by NUM_REGS here and leave register
increment. I don't think it's a really big deal to waste CPU cycles
here since you use slower IOSF communication.

>>> +               pr_info("protecting kernel .text - .rodata: %ldk (%p -
>>> %p)\n",
>>> +                       size / 1024, &_text, &__end_rodata);
>>
>>
>> size >> 10
>
>
> Andy.
>
> It was size >> 10 for V1 and you called it out as a magic number :)
>
> IMO, size / 1024 requires less thought to understand when reading the code.

Oh, my bad. Now a bit modified suggestion, to add KiB inside format
string and leave  / 1024. Would it work for you?

-- 
With Best Regards,
Andy Shevchenko
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ