unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ken Raeburn <raeburn@raeburn.org>
To: emacs-devel@gnu.org
Subject: Re: [mituharu@math.s.chiba-u.ac.jp: Re: emacs-22.1 with GTK dumps core	when Gnome wigets clicked]
Date: Mon, 25 Jun 2007 01:33:59 -0400	[thread overview]
Message-ID: <CABA3F30-D7B3-42FF-89E1-3DFA278305D0@raeburn.org> (raw)
In-Reply-To: <467A4F49.9040906@swipnet.se>

On Jun 21, 2007, at 06:13, Jan Djärv wrote:
> YAMAMOTO Mitsuharu skrev:
>>>>>>> On Sun, 17 Jun 2007 17:49:28 -0400, Richard Stallman  
>>>>>>> <rms@gnu.org> said:
>>> Would someone else (other that Mitsuharu) please study this patch to
>>> check whether it is really correct?  Things like this can be tricky.
>> Please take a look at the following one instead.  It tries to fix the
>> following problems of gmalloc.c with HAVE_GTK_AND_PTHREAD in Emacs  
>> 22.1.
>> * HAVE_GTK_AND_PTHREAD was checked before including config.h.
>> * malloc_initialize_1 called pthread_mutexattr_init that may call  
>> malloc.
>> * _aligned_blocks was not protected.
>> * __malloc_hook etc. may be modified between its NULL-check and  
>> the use.
>
> The patch was corrupted by some mailer so I could not apply it, but:
>
> !   /* Copy the value of __malloc_hook to an automatic variable in  
> case
> !      __malloc_hook is modified in another thread between its
> !      NULL-check and the use.  */
> !   hook = __malloc_hook;
> !   return (hook != NULL ? *hook : _malloc_internal) (size);
>   }
>
> Assignment is not guaranteed to be atomic.  It probably is on 32- 
> bit systems, but you should not assume it.

Nor is this change guaranteed to cause there to be only one access to  
"__malloc_hook", unless you change it to be declared volatile.  (And,  
in fact, if you're optimizing, I would've expected it to be only one  
access in the original code on nearly all platforms.)  Mutex  
protection around accesses to the hook variable would be the safest  
(and wouldn't require temporary variables or volatile qualifiers),  
though performance would not be as good.

Ken

  parent reply	other threads:[~2007-06-25  5:33 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-17 21:49 [mituharu@math.s.chiba-u.ac.jp: Re: emacs-22.1 with GTK dumps core when Gnome wigets clicked] Richard Stallman
2007-06-18  1:11 ` YAMAMOTO Mitsuharu
2007-06-21 10:13   ` Jan Djärv
2007-06-21 11:36     ` YAMAMOTO Mitsuharu
2007-06-25  5:33     ` Ken Raeburn [this message]
2007-06-25  8:30       ` YAMAMOTO Mitsuharu
2007-06-25  9:30         ` Ken Raeburn
2007-06-25 10:05           ` YAMAMOTO Mitsuharu
2007-06-25 15:46             ` Richard Stallman
2007-06-26  3:45               ` YAMAMOTO Mitsuharu
2007-06-26 22:48                 ` Richard Stallman
2007-06-25 15:46             ` Richard Stallman
2007-06-25 16:33               ` Stefan Monnier
2007-06-25 17:04                 ` Chong Yidong
2007-06-26 16:58                   ` Richard Stallman
2007-06-26 21:20                     ` David Kastrup
2007-06-26 23:01                       ` Jason Rumney
2007-06-27 16:47                       ` Richard Stallman
2007-06-26 23:35                     ` Chong Yidong
2007-06-27  1:31                       ` Stefan Monnier
2007-06-27 19:50                       ` Richard Stallman
2007-06-26 16:58                 ` Richard Stallman
2007-06-24 23:47   ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABA3F30-D7B3-42FF-89E1-3DFA278305D0@raeburn.org \
    --to=raeburn@raeburn.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).