linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 1/1] fix syscallN() macro errno value checking for i386
@ 2005-01-29  1:01 blaisorblade
  2005-01-30 17:00 ` Arnd Bergmann
  0 siblings, 1 reply; 5+ messages in thread
From: blaisorblade @ 2005-01-29  1:01 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, blaisorblade, dhowells


From: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: David Howells <dhowells@redhat.com>

The errno values which are visible for userspace are actually in the range 
-1 - -129, not until -128 (): this value was added:

#define	EKEYREJECTED	129	/* Key was rejected by service */

And this would break ucLibc (for what I heard).

This is just a quick-fix, because putting a macro inside errno.h instead of
having it copied in two places would be probably nicer.

However, I've heard by D. Howells it wasn't accepted, so this is the solution for now.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
---

 linux-2.6.11-paolo/include/asm-i386/unistd.h |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff -puN include/asm-i386/unistd.h~fix-syscall-macro include/asm-i386/unistd.h
--- linux-2.6.11/include/asm-i386/unistd.h~fix-syscall-macro	2005-01-29 00:42:48.000000000 +0100
+++ linux-2.6.11-paolo/include/asm-i386/unistd.h	2005-01-29 00:44:51.000000000 +0100
@@ -298,12 +298,12 @@
 #define NR_syscalls 289
 
 /*
- * user-visible error numbers are in the range -1 - -128: see
- * <asm-i386/errno.h>
+ * user-visible error numbers are in the range -1 - -129: see
+ * <asm-i386/errno.h> (currently it includes <asm-generic/errno.h>)
  */
 #define __syscall_return(type, res) \
 do { \
-	if ((unsigned long)(res) >= (unsigned long)(-(128 + 1))) { \
+	if ((unsigned long)(res) >= (unsigned long)(-(129 + 1))) { \
 		errno = -(res); \
 		res = -1; \
 	} \
_

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch 1/1] fix syscallN() macro errno value checking for i386
  2005-01-29  1:01 [patch 1/1] fix syscallN() macro errno value checking for i386 blaisorblade
@ 2005-01-30 17:00 ` Arnd Bergmann
  2005-01-30 18:30   ` jerome lacoste
  0 siblings, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2005-01-30 17:00 UTC (permalink / raw)
  To: blaisorblade; +Cc: akpm, linux-kernel, dhowells

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

On Sünnavend 29 Januar 2005 02:01, blaisorblade@yahoo.it wrote:
> 
> From: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
> Cc: David Howells <dhowells@redhat.com>
> 
> The errno values which are visible for userspace are actually in the range 
> -1 - -129, not until -128 (): this value was added:
> 
> #define	EKEYREJECTED	129	/* Key was rejected by service */
> 
> And this would break ucLibc (for what I heard).
> 
> This is just a quick-fix, because putting a macro inside errno.h instead of
> having it copied in two places would be probably nicer.

Yes. Note that your patch only fixes the bug on i386. The code has been
copied to many other architectures, and some of them have been updated
less recently and are checking for values lower than 128. There should
really be a way to keep them all in sync.

	Arnd <><

[-- Attachment #2: signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch 1/1] fix syscallN() macro errno value checking for i386
  2005-01-30 17:00 ` Arnd Bergmann
@ 2005-01-30 18:30   ` jerome lacoste
  2005-02-04  0:36     ` H. Peter Anvin
  2005-03-05 17:59     ` Blaisorblade
  0 siblings, 2 replies; 5+ messages in thread
From: jerome lacoste @ 2005-01-30 18:30 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: blaisorblade, akpm, linux-kernel, dhowells

On Sun, 30 Jan 2005 18:00:22 +0100, Arnd Bergmann <arnd@arndb.de> wrote:
> On Sünnavend 29 Januar 2005 02:01, blaisorblade@yahoo.it wrote:
> >
> > From: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
> > Cc: David Howells <dhowells@redhat.com>
> >
> > The errno values which are visible for userspace are actually in the range
> > -1 - -129, not until -128 (): this value was added:
> >
> > #define       EKEYREJECTED    129     /* Key was rejected by service */
> >
> > And this would break ucLibc (for what I heard).
> >
> > This is just a quick-fix, because putting a macro inside errno.h instead of
> > having it copied in two places would be probably nicer.
> 
> Yes. Note that your patch only fixes the bug on i386. The code has been
> copied to many other architectures, and some of them have been updated
> less recently and are checking for values lower than 128. There should
> really be a way to keep them all in sync.


what about something along?

#define EKEYNEXT    130     /* key counter */

and 

 if ((unsigned long)(res) >= (unsigned long)(-EKEYNEXT)) {

JL

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch 1/1] fix syscallN() macro errno value checking for i386
  2005-01-30 18:30   ` jerome lacoste
@ 2005-02-04  0:36     ` H. Peter Anvin
  2005-03-05 17:59     ` Blaisorblade
  1 sibling, 0 replies; 5+ messages in thread
From: H. Peter Anvin @ 2005-02-04  0:36 UTC (permalink / raw)
  To: linux-kernel

Followup to:  <5a2cf1f605013010305f8270de@mail.gmail.com>
By author:    jerome lacoste <jerome.lacoste@gmail.com>
In newsgroup: linux.dev.kernel
> 
> what about something along?
> 
> #define EKEYNEXT    130     /* key counter */
> 
> and 
> 
>  if ((unsigned long)(res) >= (unsigned long)(-EKEYNEXT)) {
> 

What you really need is EMAX.

	-hpa

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch 1/1] fix syscallN() macro errno value checking for i386
  2005-01-30 18:30   ` jerome lacoste
  2005-02-04  0:36     ` H. Peter Anvin
@ 2005-03-05 17:59     ` Blaisorblade
  1 sibling, 0 replies; 5+ messages in thread
From: Blaisorblade @ 2005-03-05 17:59 UTC (permalink / raw)
  To: jerome lacoste, David Howells; +Cc: Arnd Bergmann, akpm, linux-kernel

On Sunday 30 January 2005 19:30, jerome lacoste wrote:
> On Sun, 30 Jan 2005 18:00:22 +0100, Arnd Bergmann <arnd@arndb.de> wrote:
> > On Sünnavend 29 Januar 2005 02:01, blaisorblade@yahoo.it wrote:
> > > From: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
> > > Cc: David Howells <dhowells@redhat.com>
> > >
> > > The errno values which are visible for userspace are actually in the
> > > range -1 - -129, not until -128 (): this value was added:
> > >
> > > #define       EKEYREJECTED    129     /* Key was rejected by service */
> > >
> > > And this would break ucLibc (for what I heard).
> > >
> > > This is just a quick-fix, because putting a macro inside errno.h
> > > instead of having it copied in two places would be probably nicer.
> >
> > Yes. Note that your patch only fixes the bug on i386. The code has been
> > copied to many other architectures, and some of them have been updated
> > less recently and are checking for values lower than 128. There should
> > really be a way to keep them all in sync.
>
> what about something along?
>
> #define EKEYNEXT    130     /* key counter */
>
> and
>
>  if ((unsigned long)(res) >= (unsigned long)(-EKEYNEXT)) {
Yes, I agree with you... I didn't do it that way because of this mail:

"Subject: Re: Fw: Re: [patch 02/11] uml: fix compilation for missing headers
From: David Howells <dhowells@redhat.com>
To: Andrew Morton <akpm@osdl.org>
CC: blaisorblade_spam@yahoo.it
Date: Fri Jan 14 12:19:33 2005
[....]
> I think that the max errno value should become a macro defined in errno.h.

I agree with him on this, but I seem to remember that this didn't go down very
well.

David"

Now, I don't know why it was not done that way, but I wanted to do a quick-fix 
to merge it. Somebody please fix it definitively... in 2.6.11 official this 
is still unfixed.

-- 
Paolo Giarrusso, aka Blaisorblade
Linux registered user n. 292729
http://www.user-mode-linux.org/~blaisorblade



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-03-08  3:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-29  1:01 [patch 1/1] fix syscallN() macro errno value checking for i386 blaisorblade
2005-01-30 17:00 ` Arnd Bergmann
2005-01-30 18:30   ` jerome lacoste
2005-02-04  0:36     ` H. Peter Anvin
2005-03-05 17:59     ` Blaisorblade

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).