[PATCH 2/2] i386/i386/fpu.c: check machine state before setting fp_valid

2013-11-16 Thread Marin Ramesa
When fp_thread is not NULL and is not the current thread, and fp_save() does not alter the machine state, check if ifps is NULL before setting fp_valid to avoid dereference of null pointer. * i386/i386/fpu.c (ifps): Check if it's NULL. --- i386/i386/fpu.c | 3 ++- 1 file changed, 2 insertions(+

[PATCH 1/2] i386/i386/user_ldt.c: check ldt

2013-11-16 Thread Marin Ramesa
When ldt equals zero, and default branch is taken from the switch statement, and sel is not equal to zero, comparison results in a dereference of a null pointer. Avoid this. * i386/i386/user_ldt.c (ldt): Check if it equals zero. --- i386/i386/user_ldt.c | 7 --- 1 file changed, 4 insertions(

Preliminary patches based on dereference of null pointer reports

2013-11-16 Thread Marin Ramesa
These two are preliminary patches generated from dereference of null pointer reports. Let's see how this goes. If I got it right, I'll continue to work on this. If I got it wrong, I'll let someone more experienced deal with these kind of warnings. Below are the links to reports. [PATCH 1/2] i386/

Re: Removal of register qualifiers from kern source

2013-11-16 Thread Samuel Thibault
Marin Ramesa, le Sat 16 Nov 2013 16:39:01 +0100, a écrit : > Plus, it's a repetitive patch series, so I assumed the better solution > is to compress it and send it as an attachment. More than being repetitive, register dropping is trivial to review and obviously correct, so there is essentially no

Re: Removal of register qualifiers from kern source

2013-11-16 Thread Marin Ramesa
On 16.11.2013 17:12:37, Richard Braun wrote: > On Sat, Nov 16, 2013 at 04:39:01PM +0100, Marin Ramesa wrote: > > I assumed it's inconvinient for people to suddenly find 32 messages > > in > > We think of it (and our viewers make us see it) as one thread, not 32 > messages. I have threading turne

Re: Removal of register qualifiers from kern source

2013-11-16 Thread Richard Braun
On Sat, Nov 16, 2013 at 04:39:01PM +0100, Marin Ramesa wrote: > I assumed it's inconvinient for people to suddenly find 32 messages in We think of it (and our viewers make us see it) as one thread, not 32 messages. -- Richard Braun

Re: Removal of register qualifiers from kern source

2013-11-16 Thread Marin Ramesa
On 16.11.2013 16:15:45, Guillem Jover wrote: > Hi! > > On Tue, 2013-11-12 at 15:47:00 +0100, Marin Ramesa wrote: > > Attached is a gzipped series of 32 patches which remove register > > qualifiers from kern source. I did not want to spam the list with > > 32 patches, so I'm sending them as an at

Re: Removal of register qualifiers from kern source

2013-11-16 Thread Guillem Jover
Hi! On Tue, 2013-11-12 at 15:47:00 +0100, Marin Ramesa wrote: > Attached is a gzipped series of 32 patches which remove register > qualifiers from kern source. I did not want to spam the list with 32 > patches, so I'm sending them as an attachment. Personally I find tarred patch series annoying

Small cleanup of the kernel debugger source

2013-11-16 Thread Marin Ramesa
Hello, Attached is a gzipped series of 26 patches which do a small cleanup of the kernel debugger source. Cleanups include: 1. Removal of register qualifiers. 2. Addition of ifndefs in header files. 3. Addition of comments after endifs. ddb_cleanup.tar.gz Description: application/compressed-ta

Re: Clang Static Analyzer reports & more fixes for the Hurd

2013-11-16 Thread Marin Ramesa
On 16.11.2013 10:58:13, Justus Winter wrote: > I've seen Marin has joined in fixing bugs in Mach based on these kind > of analysis, very cool! Yeah, I've been following your reports. It seems this kind of analysis does emit some false alarms, as seen with my recent patch on null pointer derefer

Re: [PATCH] libports: implement lockless management of threads

2013-11-16 Thread Richard Braun
On Sat, Nov 16, 2013 at 11:41:03AM +0100, Justus Winter wrote: > I just realized that I tested these changes *with* the > libports_stability.patch, so the threads do not actually time out and > so this particular code is never reached. Maybe we should defer this > patch until Richards patch destruc

Re: [PATCH] libports: implement lockless management of threads

2013-11-16 Thread Justus Winter
Quoting Samuel Thibault (2013-11-16 11:16:02) > > - pthread_spin_lock (&lock); > > - if (nreqthreads == 1) > > + __atomic_sub_fetch (&totalthreads, 1, __ATOMIC_RELAXED); > > + if (__atomic_sub_fetch (&nreqthreads, 1, __ATOMIC_RELAXED) == 0) > > { > > /*

Re: Clang Static Analyzer reports & more fixes for the Hurd

2013-11-16 Thread Samuel Thibault
Justus Winter, le Sat 16 Nov 2013 10:58:13 +0100, a écrit : > Please pay close attention to this one. The Hurd seems to work fine > with this patch. > > [PATCH 6/6] mach-defpager: do not remove -Wall from CFLAGS Well, -Wall shouldn't have any impact on the generated code. Does that really produc

Re: [PATCH 6/6] mach-defpager: do not remove -Wall from CFLAGS

2013-11-16 Thread Samuel Thibault
Justus Winter, le Sat 16 Nov 2013 10:58:19 +0100, a écrit : > Bother, said Pooh. > > * Makefile: Do not remove -Wall from CFLAGS. Ack. > --- > mach-defpager/Makefile |3 --- > 1 file changed, 3 deletions(-) > > diff --git a/mach-defpager/Makefile b/mach-defpager/Makefile > index 5a98d69..e

Re: [PATCH 5/6] mach-defpager: fix the page offsets returned by pager_pages

2013-11-16 Thread Samuel Thibault
Justus Winter, le Sat 16 Nov 2013 10:58:18 +0100, a écrit : > Previously the increment was outside the loop body, turning it into a > dead increment. > > Move the increment into the loop body as it is done in the true branch > above. This fixes the offsets recorded in the default_pager_page_t > ob

Re: [PATCH 4/6] libshouldbeinlibc: fix dead assignment

2013-11-16 Thread Samuel Thibault
Justus Winter, le Sat 16 Nov 2013 10:58:17 +0100, a écrit : > Found using the Clang Static Analyzer. > > * libshouldbeinlibc/timefmt.c (fmt_past_time): Fix dead assignment, > normalize adjacent white space. Ack. > --- > libshouldbeinlibc/timefmt.c |4 ++-- > 1 file changed, 2 insertions(+

Re: [PATCH 3/6] ext2fs: fix error handling

2013-11-16 Thread Samuel Thibault
Justus Winter, le Sat 16 Nov 2013 10:58:16 +0100, a écrit : > Found using the Clang Static Analyzer. > > * ext2fs/dir.c (diskfs_lookup_hard): Fix error handling. Ack. > --- > ext2fs/dir.c |2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/ext2fs/dir.c b/ext2fs/dir.c > index c075246.

Re: [PATCH 2/6] libdiskfs: fix error handling

2013-11-16 Thread Samuel Thibault
Justus Winter, le Sat 16 Nov 2013 10:58:15 +0100, a écrit : > Found using the Clang Static Analyzer. > > * libdiskfs/dir-renamed.c (diskfs_rename_dir): Fix error handling. Ack! It was really bad, AIUI it meant creating 32000 directories in the same parent leads to leaked locked mutexes. > --- >

Re: [PATCH 1/6] libdiskfs: remove dead assignment

2013-11-16 Thread Samuel Thibault
Justus Winter, le Sat 16 Nov 2013 10:58:14 +0100, a écrit : > Found using the Clang Static Analyzer. > > * libdiskfs/io-write.c (diskfs_S_io_write): Remove dead assignment. Ack > --- > libdiskfs/io-write.c |1 - > 1 file changed, 1 deletion(-) > > diff --git a/libdiskfs/io-write.c b/libdis

Re: [PATCH] libports: implement lockless management of threads

2013-11-16 Thread Samuel Thibault
Justus Winter, le Fri 15 Nov 2013 20:52:23 +0100, a écrit : > @@ -224,30 +216,22 @@ ports_manage_port_operations_multithread (struct > port_bucket *bucket, > >if (master) > { > - pthread_spin_lock (&lock); > - if (totalthreads != 1) > - { > - pthread_s

Re: [PATCH] Clean up the included header files

2013-11-16 Thread Samuel Thibault
Justus Winter, le Fri 15 Nov 2013 20:47:37 +0100, a écrit : > * libihash/ihash.c: Clean up the included header files. > * libshouldbeinlibc/cacheq.c: Likewise. > * libshouldbeinlibc/canon-host.c: Likewise. > * libshouldbeinlibc/fsysops.c: Likewise. > * libshouldbeinlibc/idvec-auth.c: Likewise. > *

Re: [PATCH 5/5] i386/i386/seg.c: remove file

2013-11-16 Thread Samuel Thibault
Marin Ramesa, le Fri 15 Nov 2013 19:39:20 +0100, a écrit : > MACH_INLINE is already defined where needed. Inline functions from seg.h and > tss.h get compiled when included from other files, therefore seg.c serves no > real purpose. I think it's safe to remove. It does serve purpose: the inline is

Re: Clang Static Analyzer reports & more fixes for the Hurd

2013-11-16 Thread Samuel Thibault
Justus Winter, le Sat 16 Nov 2013 10:58:13 +0100, a écrit : > The code in libftpconn and libstore/do-bunzip2.c is very noisy. It's probably better to make libstore just use libbz2 than fixing unmaintained code :) Samuel

[PATCH 6/6] mach-defpager: do not remove -Wall from CFLAGS

2013-11-16 Thread Justus Winter
Bother, said Pooh. * Makefile: Do not remove -Wall from CFLAGS. --- mach-defpager/Makefile |3 --- 1 file changed, 3 deletions(-) diff --git a/mach-defpager/Makefile b/mach-defpager/Makefile index 5a98d69..e38a0be 100644 --- a/mach-defpager/Makefile +++ b/mach-defpager/Makefile @@ -35,6 +35,

[PATCH 4/6] libshouldbeinlibc: fix dead assignment

2013-11-16 Thread Justus Winter
Found using the Clang Static Analyzer. * libshouldbeinlibc/timefmt.c (fmt_past_time): Fix dead assignment, normalize adjacent white space. --- libshouldbeinlibc/timefmt.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libshouldbeinlibc/timefmt.c b/libshouldbeinlibc/t

[PATCH 5/6] mach-defpager: fix the page offsets returned by pager_pages

2013-11-16 Thread Justus Winter
Previously the increment was outside the loop body, turning it into a dead increment. Move the increment into the loop body as it is done in the true branch above. This fixes the offsets recorded in the default_pager_page_t objects. Found using the Clang Static Analyzer. * mach-defpager/default_

Clang Static Analyzer reports & more fixes for the Hurd

2013-11-16 Thread Justus Winter
Hi folks :) I've been using the Clang Static Analyzer to analyze the Hurd and GNU Mach source. The results are here (until a more permanent home is found and an automated build system is in place): http://darnassus.sceen.net/~teythoon/qa/ I've seen Marin has joined in fixing bugs in Mach based o

[PATCH 2/6] libdiskfs: fix error handling

2013-11-16 Thread Justus Winter
Found using the Clang Static Analyzer. * libdiskfs/dir-renamed.c (diskfs_rename_dir): Fix error handling. --- libdiskfs/dir-renamed.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdiskfs/dir-renamed.c b/libdiskfs/dir-renamed.c index d73dc28..9b7ec3a 100644 --- a/libdis

[PATCH 3/6] ext2fs: fix error handling

2013-11-16 Thread Justus Winter
Found using the Clang Static Analyzer. * ext2fs/dir.c (diskfs_lookup_hard): Fix error handling. --- ext2fs/dir.c |2 ++ 1 file changed, 2 insertions(+) diff --git a/ext2fs/dir.c b/ext2fs/dir.c index c075246..a7eeaaa 100644 --- a/ext2fs/dir.c +++ b/ext2fs/dir.c @@ -195,6 +195,8 @@ diskfs_look

[PATCH 1/6] libdiskfs: remove dead assignment

2013-11-16 Thread Justus Winter
Found using the Clang Static Analyzer. * libdiskfs/io-write.c (diskfs_S_io_write): Remove dead assignment. --- libdiskfs/io-write.c |1 - 1 file changed, 1 deletion(-) diff --git a/libdiskfs/io-write.c b/libdiskfs/io-write.c index 26e0be4..2967c4c 100644 --- a/libdiskfs/io-write.c +++ b/libd