Bug 1358 - sched_setaffinity is busted on alpha
Summary: sched_setaffinity is busted on alpha
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: 2.3.5
: P2 normal
Target Milestone: ---
Assignee: Richard Henderson
URL:
Keywords:
Depends on:
Blocks: libc236
  Show dependency treegraph
 
Reported: 2005-09-19 23:02 UTC by Colin Gibbs
Modified: 2018-04-19 14:28 UTC (History)
1 user (show)

See Also:
Host: alpha-linux
Target: alpha-linux
Build:
Last reconfirmed:
fweimer: security-


Attachments
assign to temporary variables before the register variables (616 bytes, patch)
2005-09-19 23:04 UTC, Colin Gibbs
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Colin Gibbs 2005-09-19 23:02:53 UTC
The problem stems from this call (sched_setaffinity.c:51):
     while (res = INTERNAL_SYSCALL (sched_getaffinity, err, 3, getpid (),
                                     psize, p),
             INTERNAL_SYSCALL_ERROR_P (res, err)
             && INTERNAL_SYSCALL_ERRNO (res, err) == EINVAL)

When the macro is expanded the call to getpid clobbers the system call number.

There was a similar problem on ppc documented here:
  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=311053
Comment 1 Colin Gibbs 2005-09-19 23:04:57 UTC
Created attachment 663 [details]
assign to temporary variables before the register variables
Comment 2 Roland McGrath 2005-09-19 23:23:18 UTC
Richard, please dtrt for the alpha magic.
Comment 3 Sourceware Commits 2005-09-20 05:35:53 UTC
Subject: Bug 1358

CVSROOT:	/cvs/glibc
Module name:	libc
Changes by:	rth@sources.redhat.com	2005-09-20 05:35:42

Modified files:
	.              : ChangeLog 
	sysdeps/unix/alpha: sysdep.h 

Log message:
	[BZ #1358]
	* sysdeps/unix/alpha/sysdep.h (inline_syscall1): Copy argument(s)
	to a temporary first.
	(inline_syscall2, inline_syscall3, inline_syscall4): Likewise.
	(inline_syscall5, inline_syscall6): Likewise.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/ChangeLog.diff?cvsroot=glibc&r1=1.9531&r2=1.9532
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/unix/alpha/sysdep.h.diff?cvsroot=glibc&r1=1.26&r2=1.27

Comment 4 Richard Henderson 2005-09-20 05:36:11 UTC
Fixed.
Comment 5 Sourceware Commits 2005-09-20 06:11:59 UTC
Subject: Bug 1358

CVSROOT:	/cvs/glibc
Module name:	libc
Branch: 	glibc-2_3-branch
Changes by:	rth@sources.redhat.com	2005-09-20 06:11:44

Modified files:
	.              : ChangeLog 
	sysdeps/alpha  : ldiv.S 
	sysdeps/unix/alpha: sysdep.h 

Log message:
	[BZ #1358]
	* sysdeps/unix/alpha/sysdep.h (inline_syscall1): Copy argument(s)
	to a temporary first.
	(inline_syscall2, inline_syscall3, inline_syscall4): Likewise.
	(inline_syscall5, inline_syscall6): Likewise.
	
	* sysdeps/alpha/ldiv.S (lldiv): Add alias.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/ChangeLog.diff?cvsroot=glibc&only_with_tag=glibc-2_3-branch&r1=1.9088.2.60&r2=1.9088.2.61
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/alpha/ldiv.S.diff?cvsroot=glibc&only_with_tag=glibc-2_3-branch&r1=1.6&r2=1.6.4.1
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/unix/alpha/sysdep.h.diff?cvsroot=glibc&only_with_tag=glibc-2_3-branch&r1=1.26&r2=1.26.2.1