svn commit: r362126 - head/sys/vm

John Baldwin jhb at FreeBSD.org
Fri Jun 19 15:08:46 UTC 2020


On 6/18/20 10:53 AM, Conrad Meyer wrote:
> On Thu, Jun 18, 2020 at 10:19 AM John Baldwin <jhb at freebsd.org> wrote:
>>
>> On 6/17/20 5:48 PM, Conrad Meyer wrote:
>>> db_printf checks the pager, via db_putc.
>>
>> It doesn't break out of the loops for you though (e.g. via setjmp or the
>> like).  Commands still have to check db_pager_quit directly if they wish
>> to abort early to honor a user entering 'q' at the pager prompt.
> 
> It does for Ctrl-C, but not 'q', true.  It could easily do the same
> for 'q' as Ctrl-C: db_error(NULL) => kdb_reenter_silent().

That's only safe if commands are always idempotent.  Some commands can
use try locks (though they really shouldn't).  Having printf() auto-convert
is potentially worse for this as it affects doing a 'call' of an arbitrary
function (which is likely not written to be safe for DDB).  Though that's
already a bit fraught with dragons since any nested panic already does the
longjmp.  We skip locking (though only somewhat, you can "unlock" a lock
held by the interrupted code in your thread by calling a function).

It may be that having 'q' longjmp is ok and wouldn't really be more fragile
than what is already there.  That is still orthogonal to your patch (which
is printf -> db_printf in effect) (and so 2 separate things to consider).

-- 
John Baldwin


More information about the svn-src-all mailing list