mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sharyathi Nagesh <sharyath@in.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: Pavel Emelianov <xemul@sw.ru>, Linus Torvalds <torvalds@osdl.org>,
	Andrew Morton <akpm@osdl.org>
Subject: Patch to fixe Data Acess error in dup_fd
Date: Fri, 10 Nov 2006 15:02:01 +0530	[thread overview]
Message-ID: <1163151121.3539.15.camel@legolas.in.ibm.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1266 bytes --]

On running the Stress Test on machine for more than 72 hours following
error message was observed.

0:mon> e
cpu 0x0: Vector: 300 (Data Access) at [c00000007ce2f7f0]
    pc: c000000000060d90: .dup_fd+0x240/0x39c
    lr: c000000000060d6c: .dup_fd+0x21c/0x39c
    sp: c00000007ce2fa70
   msr: 800000000000b032
   dar: ffffffff00000028
 dsisr: 40000000
  current = 0xc000000074950980
  paca    = 0xc000000000454500
    pid   = 27330, comm = bash

0:mon> t
[c00000007ce2fa70] c000000000060d28 .dup_fd+0x1d8/0x39c (unreliable)
[c00000007ce2fb30] c000000000060f48 .copy_files+0x5c/0x88
[c00000007ce2fbd0] c000000000061f5c .copy_process+0x574/0x1520
[c00000007ce2fcd0] c000000000062f88 .do_fork+0x80/0x1c4
[c00000007ce2fdc0] c000000000011790 .sys_clone+0x5c/0x74
[c00000007ce2fe30] c000000000008950 .ppc_clone+0x8/0xc
--- Exception: c00 (System Call) at 000000000fee9c60
SP (fcb2e770) is in userspace

---------------------------
The problem is because of race window. When if(expand) block is executed in dup_fd 
unlocking of oldf->file_lock give a window for fdtable in oldf to be
modified. So actual open_files in oldf may not match with open_files
variable.
This is the debug patch to fix the problem
  Please let me know of your opinion. It is generated on:2.6.19-rc1

[-- Attachment #2: dup_fd.patch --]
[-- Type: text/x-patch, Size: 322 bytes --]

--- kernel/fork.c.orig	2006-11-10 14:42:02.000000000 +0530
+++ kernel/fork.c	2006-11-10 14:42:30.000000000 +0530
@@ -687,6 +687,7 @@ static struct files_struct *dup_fd(struc
 		 * the latest pointer.
 		 */
 		spin_lock(&oldf->file_lock);
+		open_files = count_open_files(old_fdt);
 		old_fdt = files_fdtable(oldf);
 	}
 

             reply	other threads:[~2006-11-10  9:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-10  9:32 Sharyathi Nagesh [this message]
2006-11-14 15:16 ` Sergey Vlasov
2006-11-14 18:49   ` Vadim Lobanov
2006-11-14 20:42     ` Sergey Vlasov
2006-11-14 21:35       ` Vadim Lobanov
2006-11-15  7:38         ` Sharyathi Nagesh
2006-11-15  8:15           ` Vadim Lobanov
2006-11-15  9:03             ` Sharyathi Nagesh
2006-11-17 13:08             ` Sharyathi Nagesh
2006-11-17 19:26               ` Vadim Lobanov
2007-01-04 13:10               ` Sharyathi Nagesh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1163151121.3539.15.camel@legolas.in.ibm.com \
    --to=sharyath@in.ibm.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    --cc=xemul@sw.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®