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: <CAF1ivSYFp7duSCNb+_5teM83icx1O-rY0YVFm7Laq_JLZuzerw@mail.gmail.com>
Date:	Wed, 25 Apr 2012 18:06:21 +0800
From:	Lin Ming <mlin@...pku.edu.cn>
To:	Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
Cc:	Ian Campbell <Ian.Campbell@...rix.com>,
	Andrew Cooper <Andrew.Cooper3@...rix.com>,
	"xen-devel@...ts.xensource.com" <xen-devel@...ts.xensource.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [Xen-devel] [PATCH] xen/apic: implement io apic read with hypercall

On Wed, Apr 25, 2012 at 12:23 AM, Konrad Rzeszutek Wilk
<konrad.wilk@...cle.com> wrote:
> On Tue, Apr 24, 2012 at 10:43:53PM +0800, Lin Ming wrote:
>> On Mon, Apr 23, 2012 at 11:11 PM, Konrad Rzeszutek Wilk
>> <konrad.wilk@...cle.com> wrote:
>> >> >> > How about return -1 on error?
>> >> >> > The calling function can check -1 for error.
>> >> >>
>> >> >> Isn't -1 potentially (at least theoretically) a valid value to read from
>> >> >> one of these registers?
>> >> >
>> >> > Yeah, but then we are back to crashing at bootup (with dom0) :-)
>> >> >
>> >> > Perhaps the fallback is to emulate (so retain some of the original code)
>> >> > as we have been since .. uh 3.0?
>> >>
>> >> Do you mean the return value of io_apic_read in 3.0?
>> >
>> > No. I meant that we would continue to emulate. The improvement
>> > is that now we do:
>> >
>> >       if (reg == 0x1)
>> >               return 0x00170020;
>> >       else if (reg == 0x0)
>> >               return apic << 24;
>> >
>> > instead of 0xfdfdfdfd.
>> >
>> >> It's 0xffffffff.
>> >
>> > Now it is 0xfdfdfdfd.
>> >
>> > I am suggesting that instead of BUG_ON(), we fallback to do returning
>> > an emulatated IO_APIC values - like the ones that this original patch
>> > cooked up..
>>
>> But we still need to return some value if the register is not emulated.
>
> Right. 0xfd;
>>
>> How about below?
>
>
> Almost perfect.
>>
>> unsigned int xen_io_apic_read(unsigned apic, unsigned reg)
>> {
>>         struct physdev_apic apic_op;
>>         int ret;
>>
>>         apic_op.apic_physbase = mpc_ioapic_addr(apic);
>>         apic_op.reg = reg;
>>         ret = HYPERVISOR_physdev_op(PHYSDEVOP_apic_read, &apic_op);
>>         if (!ret)
>>                 return apic_op.value;
>>
>>         /* emulate register */
>>         if (reg == 0x1)
>>                 return 0x00170020;
>>         else if (reg == 0x0)
>>                 return apic << 24;
>>         else
>>                 return -1;
>
>        return 0xfd;

Where does this magic number 0xfd come from?

Both native_io_apic_read and xen_io_apic_read does not return 0xfd on error.
--
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