public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/10129] New: Add the invalid attr checking for pthread_mutexattr_gettype()
@ 2009-05-05 2:12 zhangxiliang at cn dot fujitsu dot com
2009-05-05 14:50 ` [Bug libc/10129] " drepper at redhat dot com
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: zhangxiliang at cn dot fujitsu dot com @ 2009-05-05 2:12 UTC (permalink / raw)
To: glibc-bugs
I tested the mutex type, and found that when I got a mutex type from an
invalid pthread_mutexattr by pthread_mutexattr_gettype(), the function
returns 0.
In pthread_mutexattr_gettype() manual, it directs that the function should
return EINVAL when the mutex type in struct pthread_mutexattr is invalid.
Signed-off-by: Zhang Xiliang <zhangxiliang@cn.fujitsu.com>
---
nptl/pthread_mutexattr_gettype.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/nptl/pthread_mutexattr_gettype.c
b/nptl/pthread_mutexattr_gettype.c
index 7303703..40ed531 100644
--- a/nptl/pthread_mutexattr_gettype.c
+++ b/nptl/pthread_mutexattr_gettype.c
@@ -17,6 +17,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <errno.h>
#include <pthreadP.h>
@@ -30,6 +31,8 @@ pthread_mutexattr_gettype (attr, kind)
iattr = (const struct pthread_mutexattr *) attr;
*kind = iattr->mutexkind & ~PTHREAD_MUTEXATTR_FLAG_BITS;
+ if (*kind < PTHREAD_MUTEX_NORMAL || *kind > PTHREAD_MUTEX_ADAPTIVE_NP)
+ return EINVAL;
return 0;
}
--
Summary: Add the invalid attr checking for
pthread_mutexattr_gettype()
Product: glibc
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: libc
AssignedTo: drepper at redhat dot com
ReportedBy: zhangxiliang at cn dot fujitsu dot com
CC: glibc-bugs at sources dot redhat dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=10129
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libc/10129] Add the invalid attr checking for pthread_mutexattr_gettype()
2009-05-05 2:12 [Bug libc/10129] New: Add the invalid attr checking for pthread_mutexattr_gettype() zhangxiliang at cn dot fujitsu dot com
@ 2009-05-05 14:50 ` drepper at redhat dot com
2009-05-06 1:43 ` zhangxiliang at cn dot fujitsu dot com
2009-05-07 16:50 ` drepper at redhat dot com
2 siblings, 0 replies; 5+ messages in thread
From: drepper at redhat dot com @ 2009-05-05 14:50 UTC (permalink / raw)
To: glibc-bugs
------- Additional Comments From drepper at redhat dot com 2009-05-05 14:49 -------
Nonsense. If the value is stored it better be correct.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
http://sourceware.org/bugzilla/show_bug.cgi?id=10129
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libc/10129] Add the invalid attr checking for pthread_mutexattr_gettype()
2009-05-05 2:12 [Bug libc/10129] New: Add the invalid attr checking for pthread_mutexattr_gettype() zhangxiliang at cn dot fujitsu dot com
2009-05-05 14:50 ` [Bug libc/10129] " drepper at redhat dot com
@ 2009-05-06 1:43 ` zhangxiliang at cn dot fujitsu dot com
2009-05-07 16:50 ` drepper at redhat dot com
2 siblings, 0 replies; 5+ messages in thread
From: zhangxiliang at cn dot fujitsu dot com @ 2009-05-06 1:43 UTC (permalink / raw)
To: glibc-bugs
------- Additional Comments From zhangxiliang at cn dot fujitsu dot com 2009-05-06 01:43 -------
(In reply to comment #1)
> Nonsense. If the value is stored it better be correct.
OK. I have make a corrected version.
Signed-off-by: Zhang Xiliang <zhangxiliang@cn.fujitsu.com>
---
nptl/pthread_mutexattr_gettype.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/nptl/pthread_mutexattr_gettype.c b/nptl/pthread_mutexattr_gettype.c
index 7303703..4da2dc1 100644
--- a/nptl/pthread_mutexattr_gettype.c
+++ b/nptl/pthread_mutexattr_gettype.c
@@ -17,6 +17,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#include <errno.h>
#include <pthreadP.h>
@@ -26,11 +27,15 @@ pthread_mutexattr_gettype (attr, kind)
int *kind;
{
const struct pthread_mutexattr *iattr;
+ int ikind;
iattr = (const struct pthread_mutexattr *) attr;
- *kind = iattr->mutexkind & ~PTHREAD_MUTEXATTR_FLAG_BITS;
+ ikind = iattr->mutexkind & ~PTHREAD_MUTEXATTR_FLAG_BITS;
+ if (ikind < PTHREAD_MUTEX_NORMAL || ikind > PTHREAD_MUTEX_ADAPTIVE_NP)
+ return EINVAL;
+ *kind = ikind;
return 0;
}
weak_alias (pthread_mutexattr_gettype, pthread_mutexattr_getkind_np)
--
http://sourceware.org/bugzilla/show_bug.cgi?id=10129
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libc/10129] Add the invalid attr checking for pthread_mutexattr_gettype()
2009-05-05 2:12 [Bug libc/10129] New: Add the invalid attr checking for pthread_mutexattr_gettype() zhangxiliang at cn dot fujitsu dot com
2009-05-05 14:50 ` [Bug libc/10129] " drepper at redhat dot com
2009-05-06 1:43 ` zhangxiliang at cn dot fujitsu dot com
@ 2009-05-07 16:50 ` drepper at redhat dot com
2 siblings, 0 replies; 5+ messages in thread
From: drepper at redhat dot com @ 2009-05-07 16:50 UTC (permalink / raw)
To: glibc-bugs
------- Additional Comments From drepper at redhat dot com 2009-05-07 16:49 -------
(In reply to comment #2)
> OK. I have make a corrected version.
No. The get functions never verify the state. They can assume it is correct.
There will be no change.
--
http://sourceware.org/bugzilla/show_bug.cgi?id=10129
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libc/10129] Add the invalid attr checking for pthread_mutexattr_gettype()
[not found] <bug-10129-131@http.sourceware.org/bugzilla/>
@ 2014-06-30 9:15 ` fweimer at redhat dot com
0 siblings, 0 replies; 5+ messages in thread
From: fweimer at redhat dot com @ 2014-06-30 9:15 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=10129
Florian Weimer <fweimer at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Flags| |security-
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-06-30 9:15 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-05 2:12 [Bug libc/10129] New: Add the invalid attr checking for pthread_mutexattr_gettype() zhangxiliang at cn dot fujitsu dot com
2009-05-05 14:50 ` [Bug libc/10129] " drepper at redhat dot com
2009-05-06 1:43 ` zhangxiliang at cn dot fujitsu dot com
2009-05-07 16:50 ` drepper at redhat dot com
[not found] <bug-10129-131@http.sourceware.org/bugzilla/>
2014-06-30 9:15 ` fweimer at redhat dot com
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 read-only IMAP folder(s) and NNTP newsgroup(s).