public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@bergmann-dalldorf.de>
To: kernel-janitor-discuss@lists.sourceforge.net,
	Linux Kernel <linux-kernel@vger.kernel.org>
Cc: Jaroslav Kysela <perex@suse.cz>
Subject: might_sleep() in copy_{from,to}_user and friends?
Date: Fri, 1 Nov 2002 13:02:19 +0100	[thread overview]
Message-ID: <200211011302.05461.arnd@bergmann-dalldorf.de> (raw)

I have been looking for more places in 2.5 that can be marked 
might_sleep() and noticed that all the functions in asm/uaccess.h
are not marked although they sleep if the memory they access
has to be paged in.

After adding might_sleep() in ten places in asm-i386/uaccess.h
and arch/i386/lib/usercopy.c, I have been running this kernel
for about two weeks. So far, I have found only one place where
the kernel actually hits this and that one is trivially
fixable (maintainer cc'd, fix see below).

The question is if we can expect to find more bugs like
that if we have might_sleep() in uaccess.h or if the 
extra cycles and the work of changing ~100 places (for all
architectures) are just not worth it.

	Arnd <><

===== sound/core/pcm_native.c 1.17 vs edited =====
--- 1.17/sound/core/pcm_native.c	Sun Oct 13 21:19:17 2002
+++ edited/sound/core/pcm_native.c	Fri Nov  1 12:43:38 2002
@@ -2014,8 +2014,6 @@
 			n = snd_pcm_playback_hw_avail(runtime);
 		else
 			n = snd_pcm_capture_avail(runtime);
-		if (put_user(n, res))
-			err = -EFAULT;
 		break;
 	case SNDRV_PCM_STATE_XRUN:
 		err = -EPIPE;
@@ -2026,6 +2024,9 @@
 		break;
 	}
 	spin_unlock_irq(&runtime->lock);
+	if (!ret)
+		if (put_user(n, res))
+			err = -EFAULT;
 	return err;
 }
 		


             reply	other threads:[~2002-11-01  9:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-01 12:02 Arnd Bergmann [this message]
2002-11-01 10:10 ` might_sleep() in copy_{from,to}_user and friends? Jaroslav Kysela
2002-11-01 10:51 ` Andrew Morton
2002-11-01 14:13   ` Dave Jones
2002-11-01 14:42   ` Arnd Bergmann
2002-11-01 22:34   ` Randy.Dunlap
  -- strict thread matches above, loose matches on Subject: below --
2002-11-01 13:47 Manfred Spraul
2002-11-01 16:49 ` Arnd Bergmann

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=200211011302.05461.arnd@bergmann-dalldorf.de \
    --to=arnd@bergmann-dalldorf.de \
    --cc=kernel-janitor-discuss@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@suse.cz \
    /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