Re: ce6.0 NKwvsprintfW hard locks system by Dean
Dean
Tue Mar 25 05:57:15 PDT 2008
On a somewhat related note, it is useful to know that the kernel stack is
only 2K. So you must be careful about what you place there. This applies
to the OAL, not to other modules that are loaded into kernel space.
--
Dean Ramsier - eMVP
BSQUARE Corporation
"chris" <none@nothanks.com> wrote in message
news:TZOdnSAUrbzTtnXanZ2dnUVZ_qOdnZ2d@comcast.com...
> Bruce Eitman [eMVP] wrote:
>> You make a good argument that the function is okay to use. Could there
>> be a
>> problem with how you are calling it?
>
> Partly yes. :) As in: the original oal_log library does not use "OALMSGS"
> but rather "OALMSG". Apparently I modified it to use "OALMSGS" at some
> point. I also increased the output buffer size of OALLogSerial() which
> caused problems with the stack as described below.
>
> Please note that, calling OALMSG (vs OALMSGS) works as OALMSG is a wrapper
> to NKDbgPrintfW() which contains internal checks to ensure the necessary
> initialization has taken place before it directly calls NKwvsprintfW().
>
> Looking to see what "work around" is necessary when initialization has
> *not* been completed; it is to declare the output buffer passed to
> NKwvsprintfW() as static so as to avoid the stack. I tested this, and as
> long as the buffer is static, then calling NKwvsprintfW() works just fine
> from within OALLogSerial() when called from OEMInit(). The other option
> is to use a very small (and worthless) output buffer and hope the stack
> can hold it (which is the solution Microsoft chose for their common code
> implementation of OALLogSerial)
>
> So, ignoring my change to OALMSGS vs OALMSG and the buffer size, it still
> remains that OALLogSerial() (as provided by Microsoft in the common
> library code) can not be used *safely* until IOCTL_HAL_POSTINIT is called.
> (Based on the fact that the kernel's internal work around is itself
> disabled just before it calls into the OAL with IOCTL_HAL_POSTINIT)
>
> Anyway, I still assert that the issue remains, just in a slightly
> different use case.
>
> Regardless, I've understood what the issue is, thanks for the responses.
>
> chris