All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Thiago Macieira <thiago.macieira@intel.com>
Cc: linux-fsdevel@vger.kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: fcntl(F_DUPFD) causing apparent file descriptor table corruption
Date: Tue, 19 May 2020 23:28:32 +0100	[thread overview]
Message-ID: <20200519222832.GU23230@ZenIV.linux.org.uk> (raw)
In-Reply-To: <6266026.WxYS4g2YVZ@tjmaciei-mobl1>

On Tue, May 19, 2020 at 03:18:13PM -0700, Thiago Macieira wrote:

> > I really wonder about the missing couple of syscalls in your strace, though;
> > could you verify that they _are_ missing and see what the fix above does to
> > your testcase?
> 
> Looking at my terminal backtrace, I might have made a copy & paste mistake of 
> the trace while flipping pages. Unfortunately, the trace file I had in /tmp 
> was lost because I needed to reboot the machine. The other traces I have in my 
> terminal show:
> 
> fcntl(2, F_DUPFD, 134217728)            = 134217728
> close(134217728)                        = 0
> fcntl(2, F_DUPFD, 268435456)            = 268435456
> close(268435456)                        = 0
> fcntl(2, F_DUPFD, 536870912)            = 536870912
> close(536870912)                        = 0
> write(1, "success\n", 8)                = ?
> ^C^Czsh: killed     sudo strace ./dupfd-bug
> 
> I had to killall -9 strace at this point. See the attached oops.

BS values in the array of struct file pointers due to the problem above.
And very likely a memory corruption as well.

> Then I insisted:
> 
> fcntl(2, F_DUPFD, 67108864)             = 67108864
> close(67108864)                         = 0
> fcntl(2, F_DUPFD, 134217728)            = 134217728
> close(134217728)                        = 0
> fcntl(2, F_DUPFD, 268435456Shared connection to <REDACTED> closed.
> 
> At this point, I need to drive to the office to reboot the machine. Building 
> the kernel and testing will take a few days.
> 
> Note to self: don't play with possible kernel bugs without a VM.

... at least not without remote console, complete with ability to
powercycle the box.

      reply	other threads:[~2020-05-19 22:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-19 21:03 fcntl(F_DUPFD) causing apparent file descriptor table corruption Thiago Macieira
2020-05-19 21:45 ` Al Viro
2020-05-19 22:04   ` Al Viro
2020-05-19 22:18   ` Thiago Macieira
2020-05-19 22:28     ` Al Viro [this message]

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=20200519222832.GU23230@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=thiago.macieira@intel.com \
    --cc=torvalds@linux-foundation.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.