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]
Date:	Mon, 24 Sep 2007 16:16:48 -0400
From:	Bob Bell <b_lkml@...bellsplace.com>
To:	Matthew Wilcox <matthew@....cx>
Cc:	Andrew Morton <akpm@...l.org>, Linus Torvalds <torvalds@...l.org>,
	trond@...app.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] TASK_KILLABLE version 2

On Sat, Sep 01, 2007 at 08:43:49PM -0600, Matthew Wilcox wrote:
> Here's the second version of TASK_KILLABLE.  A few changes since version 1:
<snip>
> I obviously haven't covered every place that can result in a process
> sleeping uninterruptibly while attempting an operation.  But sync_page
> (patch 4/5) covers about 90% of the times I've attempted to kill cat,
> and I hope that by providing the two examples, I can help other people
> to fix the cases that they find interesting.

I've been testing this patch on my systems.  It's working for me when
I read() a file.  Asynchronous write()s seem okay, too.  However,
synchronous writes (caused by either calling fsync() or fcntl() to
release a lock) prevent the process from being killed when the NFS
server goes down.

When the process is sent SIGKILL, it's waiting with the following call
tree:
    do_fsync
    nfs_fsync
    nfs_wb_all
    nfs_sync_mapping_wait
    nfs_wait_on_requests_locks (I believe)
    nfs_wait_on_request
    out_of_line_wait_on_bit
    __wait_on_bit
    nfs_wait_bit_interruptible
    schedule

When the process is later viewed after being deemed "stuck", it's
waiting with the following call tree:
    do_fsync
    filemap_fdatawait
    wait_on_page_writeback_range
    wait_on_page_writeback
    wait_on_page_bit
    __wait_on_bit
    sync_page
    io_schedule
    schedule

If I hazard a guess as to what might be wrong here, I believe that when
the processes catches SIGKILL, nfs_wait_bit_interruptible is returning
-ERESTARTSYS.  That error bubbles back up to nfs_fsync.  However,
nfs_fsync returns ctx->error, not -ERESTARTSYS, and ctx->error is 0.
do_fsync proceeds to call filemap_fdatawait.  I question whether 
nfs_sync should return an error, and if do_fsync should skip 
filemap_fdatawait if the fsync op returned an error.

I did try replacing the call to sync_page in __wait_on_bit with 
sync_page_killable and replacing TASK_UNINTERRUPTIBLE with 
TASK_KILLABLE.  That seemed to work once, but then really screwed things 
up on subsequent attempts.

-- 
Bob Bell
-
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