mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: jmerkey@ns1.utah-nac.org
To: "linux-os (Dick Johnson)" <linux-os@analogic.com>
Cc: "Jeff V. Merkey" <jmerkey@wolfmountaingroup.com>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: 2.6.14 kernels and above copy_to_user stupidity with IRQ disabled check
Date: Fri, 27 Jan 2006 13:22:54 -0700	[thread overview]
Message-ID: <20060127202254.GA19029@ns1.utah-nac.org> (raw)
In-Reply-To: <20060127201058.GA18805@ns1.utah-nac.org>

On Fri, Jan 27, 2006 at 01:10:58PM -0700, jmerkey@ns1.utah-nac.org wrote:


Also, allowing page faults in kernel to swap in user space memory 
seems dangerous.  Now I understand why I see the page fault handler
recurse in some cases with other code.  

W2K does the same thing for performance reasons, so I guess it doesn't really
matter.  I would assume there would be a safer place to fault in the memory, but
given people rolling their own ioctl requests, I can see where determining
this would be difficult.

Jeff

> 
> 
> OK.  Got it.  I guess I need to restructure.  And BTW, This was a code fragment
> only, the spinlock gets released when -EFAULT is called -- was just an example.
> 
> Jeff
> 
> On Fri, Jan 27, 2006 at 03:18:06PM -0500, linux-os (Dick Johnson) wrote:
> > 
> > On Fri, 27 Jan 2006, Jeff V. Merkey wrote:
> > 
> > >
> > > Is there a good reason someone set a disabled_irq() check on 2.6.14 and
> > > above for copy_to_user to barf out
> > > tons of bogus stack dump messages if the function is called from within
> > > a spinlock:
> > >
> > 
> > This is a joke, right????
> > 
> > > i.e.
> > >
> > > spin_lock_irqsave(&regen_lock, regen_flags);
> > >    v = regen_head;
> > >    while (v)
> > >    {
> > >       if (i >= count)
> > >          return -EFAULT;
> > 
> > ** BUG **  return with spin-lock held!
> > 
> > >
> > >
> > >       err = copy_to_user(&s[i++], v, sizeof(VIRTUAL_SETUP));
> > 
> > ** BUG ** copy to user with spinlock held!
> > 
> > >       if (err)
> > >          return err;
> > >
> > 
> > ** BUG ** Return with spin-lock held!
> > >
> > >       v = v->next;
> > >    }
> > >    spin_unlock_irqrestore(&regen_lock, regen_flags);
> > >
> > > is now busted and worked in kernels up to this point.  The error message
> > > is annoying but non-fatal.
> > >
> > > Jeff
> > 
> > It was NEVER supposed to work! The only reason it worked is because
> > your page(s) copied to, were not swapped out. If they were swapped
> > out, you are stuck, the page-fault won't occur.
> > 
> > Cheers,
> > Dick Johnson
> > Penguin : Linux version 2.6.13.4 on an i686 machine (5589.66 BogoMips).
> > Warning : 98.36% of all statistics are fiction.
> > .
> > 
> > ****************************************************************
> > The information transmitted in this message is confidential and may be privileged.  Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited.  If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to DeliveryErrors@analogic.com - and destroy all copies of this information, including any attachments, without reading or disclosing them.
> > 
> > Thank you.
> > -
> > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > Please read the FAQ at  http://www.tux.org/lkml/
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

  reply	other threads:[~2006-01-27 20:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-27 18:13 Jeff V. Merkey
2006-01-27 19:30 ` Phillip Susi
2006-01-27 20:18 ` linux-os (Dick Johnson)
2006-01-27 20:10   ` jmerkey
2006-01-27 20:22     ` jmerkey [this message]
2006-01-27 20:39     ` Phillip Susi
2006-01-27 19:28       ` Jeff V. Merkey

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=20060127202254.GA19029@ns1.utah-nac.org \
    --to=jmerkey@ns1.utah-nac.org \
    --cc=jmerkey@wolfmountaingroup.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-os@analogic.com \
    /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®