John Steele Scott | 23 Jan 06:58 2015
Picon

sem_post: How does the implementation work?

An attempt to debug a deadlock has led me and a colleague to look at the implementation of sem_wait()/sem_post().

Looking at sem_post.c and sem_wait.c in nptl/sysdeps/unix/sysv/linux/x86_64, what stops a race
between updating nwaiters in __new_sem_wait(), and querying nwaiters in __new_sem_post()?

It looks like it's possible for __new_sem_post() to read a zero value for nwaiters just before
__new_sem_wait() increments nwaiters (just after __new_sem_wait() failed to decrement value).

Can someone explain what stops this from happening?

Also, (I assume) we're actually running the hand-coded x86_64 assembly implementation, which looks to
work the same way as the C. What stops the race there?

I have a bit of an understanding about how atomic operations work, but it's non-obvious how they are
actually preventing a deadlock on the contended path here. It looks like we really need value and nwaiters
to be considered as a single atomic value, rather than two separate atomics. How are changes to these two
made atomically?

Cheers,

John

Adhemerval Zanella | 8 Jan 13:52 2015
Picon

Re: Fwd: Re: [Meta?] Where do I post proposals/ideas?

On 08-01-2015 10:50, Soni L. wrote:
>
>
> On 08/01/15 10:46 AM, Adhemerval Zanella wrote:
>> On 08-01-2015 09:58, Soni L. wrote:
>>> Eh, I forgot to reply to the list...
>>>
>>>
>>> -------- Forwarded Message --------
>>> Subject:     Re: [Meta?] Where do I post proposals/ideas?
>>> Date:     Thu, 08 Jan 2015 09:49:51 -0200
>>> From:     Soni L. <fakedme+libc@...>
>>> To:     Adhemerval Zanella <azanella@...>
>>>
>>>
>>>
>>> On 08/01/15 09:33 AM, Adhemerval Zanella wrote:
>>>> On 08-01-2015 07:06, Soni L. wrote:
>>>>>
>>>>> On 08/01/15 02:13 AM, Paul Pluzhnikov wrote:
>>>>>> On Wed, Jan 7, 2015 at 5:56 PM, Soni L. <fakedme@...> wrote:
>>>>>>
>>>>>>> This is my proposal/idea:
>>>>>> 1. What actual problem does your proposal solve?
>>>>>> 2. Are you aware of dlmopen ?
>>>>>>
>>>>>
>>>>> Oh great I derped when configuring that gmail alias >.>
>>>>>
>>>>> 1. It solves a problem when loading 2 different <Lua/Python/insert something else> versions where
(Continue reading)

Soni L. | 8 Jan 12:58 2015
Picon

Fwd: Re: [Meta?] Where do I post proposals/ideas?

Eh, I forgot to reply to the list...

-------- Forwarded Message --------
Subject: 	Re: [Meta?] Where do I post proposals/ideas?
Date: 	Thu, 08 Jan 2015 09:49:51 -0200
From: 	Soni L. <fakedme+libc@...>
To: 	Adhemerval Zanella <azanella@...>

On 08/01/15 09:33 AM, Adhemerval Zanella wrote:
> On 08-01-2015 07:06, Soni L. wrote:
>>
>> On 08/01/15 02:13 AM, Paul Pluzhnikov wrote:
>>> On Wed, Jan 7, 2015 at 5:56 PM, Soni L. <fakedme@...> wrote:
>>>
>>>> This is my proposal/idea:
>>> 1. What actual problem does your proposal solve?
>>> 2. Are you aware of dlmopen ?
>>>
>>
>> Oh great I derped when configuring that gmail alias >.>
>>
>> 1. It solves a problem when loading 2 different <Lua/Python/insert something else> versions where you
can't load extensions. For example, if you load Python 2 and Python 3, you can make it so trying to load
Python 2 modules works, but then you wouldn't be able to load Python 3 modules, or vice-versa.
>>
>> 2. `man dlmopen`: No manual entry for dlmopen
>>
> dlfcn/dlfcn.h :
>
> #ifdef __USE_GNU
(Continue reading)

Mohsen Pahlevanzadeh | 8 Jan 07:43 2015

mktime has problem with 00 year

Dear all,

mktime crach with 00 time : 1900 - 1900:
//////////////////////////////////////////////////////////
#include <stdio.h>
#include <time.h>

int
main(int argc, char ** argv)
{

     struct tm tm = {0};
     time_t t;

     tm.tm_year = 1900 - 1900;
     tm.tm_mon = 2;
     tm.tm_mday = 1;

     t = mktime(&tm);
     if ( t == -1 )
         printf ("mktime has been crashed!!!!");

}
/////////////////////////////

Do you have any solution?

--Regards,
Mohsen

(Continue reading)

Soni L. | 8 Jan 02:56 2015
Picon

[Meta?] Where do I post proposals/ideas?

Hi, I'm new here, and I'd like to know where I can post proposals/ideas?

This is my proposal/idea: ( also available on 
https://gist.github.com/SoniEx2/32ba4caf50c96ad0d9bc )

[ THIS IS A WIP AND MAY CHANGE AT ANY TIME! ]

Let's talk about shared objects and my "namespace" idea.

Let's say we have

```C
void *dlnewns(void);
void *dlcopyns(void *namespace);
void *dlthisns(void);
void *dlnsopen(void *namespace, const char *filename, int flag);
void *dlnssym(void *namespace, const char *symbol);
int dlnsclose(void *namespace, void *handle);
int dldelns(void *namespace);
```

(If you notice, I didn't include a `dlnserror()`, we can just use 
`dlerror()` for that)

dlnewns() creates a new **empty** namespace and returns it. This is a 
**completely** isolated namespace.

dlcopyns() makes a copy of a namespace and returns that copy. This 
technically reopens all the handles inside the namespace, so the copy is 
isolated from the original namespace. (This lets libdl tweak all the 
(Continue reading)

Geoff Winkless | 7 Jan 18:29 2015
Picon

register_printf_specifier

Hi

I'm working on a printf hook and the example code
https://sourceware.org/bugzilla/attachment.cgi?id=3874 is very useful;
however I'm a little confused by the xmm_ais function - it doesn't
seem to be checking info->user for any of the modifier values.

I was expecting something like:

static int
xmm_ais (const struct printf_info *info, size_t n, int *argtype, int *size)
{
  if (info->user & mod_v4f) {
    argtype[0] = pa_xmm;
    size[0] = sizeof (__m128);
    return 1;
  } else if (info->user & mod_v2d) {
    argtype[0] = pa_xmm;
    size[0]=sizeof(__m128d);
  } else if /* other mod_ checks here */ .... {

// now do the original sizes

  } else if (info->is_long_double) {
    argtype[0]=PA_DOUBLE | PA_FLAG_LONG_DOUBLE;
    size[0]=sizeof(long double);
  } else if (info->is_long) {
    argtype[0]=PA_DOUBLE;
    size[0]=sizeof(double);
  } else {
(Continue reading)

attonie | 6 Jan 20:56 2015
Picon

utf8 varable length encoding support

Dear help mail list:

I need POSIX utf8 supporting variable length encoding.

So, is utf8 variable length encoding supported in glibc ? no relevant documents found. 

Best regards,
Neil 		 	   		  
Mohsen Pahlevanzadeh | 5 Jan 00:19 2015

GVariant , decompile or not

Dear all,

I have a GVariant file, But i don't any information about GVarinat and 
the given file.I have been started to reading devhelp, (GVariant section)
My file information:
////////////////////////////////
mohsen <at> debian:~$file gschemas.compiled
gschemas.compiled: GVariant Database file, version 0
mohsen <at> debian:~$file -ib gschemas.compiled
application/octet-stream; charset=binary
//////////////////////////////////////////////////
Questions : Does GVariant format need to compile? Do i need to decompile 
it?  If true, How can i decompile it?

--Regards,
Mohsen

Martin Lambers | 1 Jan 08:03 2015
Picon

getaddrinfo() AI_IDN feature test

Dear glibc folks,

I recently changed two programs to use the AI_IDN flag for
getaddrinfo() instead of using libidn.

Users reported runtime failure (EAI_BADFLAGS) on systems where glibc
was build without libidn support.

On these systems, AI_IDN was defined nevertheless -- is this intended
behaviour? If so, then #ifdef AI_IDN is not enough; what is the
recommended way to check if AI_IDN actually works?

Best regards,
Martin

Steve Ellcey | 17 Dec 19:22 2014

Minimum bison requirement for building glibc/gettext

Sometime in the last couple of days I have noticed my glibc builds 
failing with:

/usr/bin/bison --yacc --name-prefix=__gettext --output plural.c plural.y
/usr/share/bison/yacc.c:94: error: invalid pure value: pure
/usr/share/bison/yacc.c:94: the top level
plural.y:46.9-16: invalid value for %define Boolean variable `api.pure'
make[2]: *** [plural.c] Error 1
make[2]: Leaving directory `/scratch/sellcey/repos/nightly2/src/glibc/intl'
make[1]: *** [intl/subdir_lib] Error 2
make[1]: Leaving directory `/scratch/sellcey/repos/nightly2/src/glibc'
make: *** [all] Error 2
Error: Make command failed, stopping build.

I haven't changed plural.y locally, I think the recent gettext merge just
caused my git checkout to create plural.y with a later timestamp then plural.c.

I am building on ubuntu 12.04 with bison 2.5.  Do I need to use a newer
bison?  It looks like the plural.c in the source tree was created by bison
2.7.  Is the required version documented somewhere?  I didn't see anything
in the glibc Wiki about the build requirements for glibc.

I can work around this by touching plural.c or updating the bison on my
build machines but I was wondering if there was a better way to handle
this.

Steve Ellcey
sellcey@...

(Continue reading)

Eric Neblock | 2 Dec 15:52 2014
Picon
Picon

Disabling Consistency Checks


Hello all,
  I'm working on a program based on this (
http://mainisusuallyafunction.blogspot.com/2011/01/implementing-breakpoints-on-x86-linux.html
) that will stop a child when a certain function is called.

When trying to implement a hardware break for a separate program (by
using an execv) that is dynamically linked, ld.so complains with the
following:

  Inconsistency detected by ld.so: ../elf/dl-runtime.c: 79: _dl_fixup:
Assertion `((reloc->r_info) & 0xffffffff) == 7' failed!

Now, I'm sure this has to deal with altering another program's code
section and there are obvious reasons why we don't want that to happen;
however, is there a way that I can disable this check? Or (perhaps even
better), what would be the correct way of having Program A stop Program
B when a certain line of code is executed that doesn't involve preloading.

I want to avoid preloading, because right now I want to stop whenever a
C program executes a malloc; however, tomorrow I may want to stop at a
printf so I'm trying to make things as dynamic as possible.

If there is any other information that I can provide, please let me know.

Thanks,
Eric

Helpful information:
uname -a:
(Continue reading)


Gmane