all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Fabrice Popineau <fabrice.popineau@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 22526@debbugs.gnu.org, andrewjmoreton@gmail.com
Subject: bug#22526: 25.0.90; Crash starting gnus
Date: Sun, 14 Feb 2016 10:05:12 +0100	[thread overview]
Message-ID: <CAFgFV9PF3fm5jiz6hETBZOLw2ryKXpXTpDvN6GV+OvQ42HU5RA@mail.gmail.com> (raw)
In-Reply-To: <83oabjzvry.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 2889 bytes --]

2016-02-14 6:49 GMT+01:00 Eli Zaretskii <eliz@gnu.org>:

> > From: Fabrice Popineau <fabrice.popineau@gmail.com>
> > Date: Sun, 14 Feb 2016 00:44:01 +0100
> > Cc: andrewjmoreton@gmail.com, 22526@debbugs.gnu.org
> >
> >  What I'm worried about is something else: the code is written under
> >  the assumption that *var is the base address of the allocation, which
> >  is why we use *var + memInfo.RegionSize to get to the next region.
> >  But if *var is not the base address, this is wrong, and we should use
> >  memInfo.BaseAddress instead, I think. WDYT?
> >
> > Yes, that should probably be more correct.
> > But that would also mean someone has changed b->text->beg for some
> buffer b.
> > Is there somewhere a good reason to do that ?
>
> No, there isn't.  But how sure are we that the address VirtualAlloc
> returns to us when we commit is always the base address of the region?
>

This what the documentation says.
https://msdn.microsoft.com/en-us/library/windows/desktop/aa366887(v=vs.85).aspx

Return value

If the function succeeds, the return value is the base address of the
allocated region of pages.
If the function fails, the return value is NULL. To get extended error
information, call GetLastError.



>    (I also tried to google for failure to
> commit reserved memory, but didn't find anything that looked like our
> case.)
>
> I did the same.


> Btw, what exactly is the difference between memInfo.BaseAddress and
> memInfo.AllocationBase?  The MSDN documentation describes both using
> the same words in different order, so it's hard to understand.
>
>
Same question here.
Re-reading the documentation, I would understand it as :
- BaseAddress is the adress that we passed to VirtualQuery, rounded down to
the beginning of the page
- AllocationBase is the start of the bloc of pages that we have committed
previously.
So we should use AllocationBase.

Another thing I wonder: could pages be in a state MEM_RESERVE | MEM_COMMIT?
I hope not.



> > The mmap_alloc() and mmap_realloc() are called each at one place only in
> buffer.c .
> > Maybe we should try to assert *var == memInfo.BaseAddress and see if it
> breaks.
>
> Will do if nothing else come up.
>
> >  > The error codes from VirtualAlloc() here are crucial.
> >
> >  The error is ERROR_INVALID_PARAMETER (87), as Andy just reported.
> >
> > Weird. There is a good chance that *var is wrong and you are right.
>
> Maybe.  I'd actually expect ERROR_INVALID_ADDRESS in that case, but
> this is not explicitly documented anywhere.
>

Something I refer to when I need to understand the inner workings of the
win32 API is the source code for ReactOS:
http://doxygen.reactos.org/d2/d2c/virtual_8c_a39ad5f8f1a5214f4874171695ab2bd6b.html#a39ad5f8f1a5214f4874171695ab2bd6b
(for example).
Not ideal, and it doesn't mean the MS thing works the same way, but at
least it allows to understand some things.

Fabrice

[-- Attachment #2: Type: text/html, Size: 4900 bytes --]

  reply	other threads:[~2016-02-14  9:05 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-01 22:13 bug#22526: 25.0.90; Crash starting gnus Andy Moreton
2016-02-07  5:42 ` Lars Ingebrigtsen
2016-02-07 16:00   ` Eli Zaretskii
2016-02-07 20:58     ` Andy Moreton
2016-02-07 21:05       ` Eli Zaretskii
2016-02-11  2:06         ` Andy Moreton
2016-02-11 20:27           ` Eli Zaretskii
2016-02-11 21:20             ` Andy Moreton
2016-02-11 21:26               ` Eli Zaretskii
2016-02-12 13:34                 ` Andy Moreton
2016-02-12 16:16                   ` Eli Zaretskii
2016-02-12 22:26                     ` Andy Moreton
2016-02-13  8:28                       ` Eli Zaretskii
2016-02-13 10:44                         ` Eli Zaretskii
2016-02-13 16:08                           ` Fabrice Popineau
2016-02-13 16:42                             ` Eli Zaretskii
2016-02-13 21:35                               ` Fabrice Popineau
2016-02-13 22:11                                 ` Eli Zaretskii
2016-02-13 23:44                                   ` Fabrice Popineau
2016-02-14  5:49                                     ` Eli Zaretskii
2016-02-14  9:05                                       ` Fabrice Popineau [this message]
2016-02-14 16:57                                         ` Eli Zaretskii
2016-02-14  5:41                                   ` Eli Zaretskii
2016-02-14 14:17                                     ` Andy Moreton
2016-02-14 16:55                                       ` Eli Zaretskii
2016-02-14 17:51                                         ` Eli Zaretskii
2016-02-14 21:04                                           ` Fabrice Popineau
2016-02-14 21:29                                             ` Eli Zaretskii
2016-02-14 21:31                                               ` Fabrice Popineau
2016-02-14 21:34                                             ` Eli Zaretskii
2016-02-14 21:41                                               ` Fabrice Popineau
2016-02-15  3:32                                                 ` Eli Zaretskii
2016-02-15  8:09                                                   ` Fabrice Popineau
2016-02-15 11:39                                                     ` Eli Zaretskii
2016-02-13 15:16                         ` Andy Moreton
2016-02-13 15:52                           ` Eli Zaretskii
2016-02-13 21:26                             ` Andy Moreton
2016-02-16  1:18                               ` Andy Moreton
2016-02-16  3:46                                 ` Eli Zaretskii
2016-02-20 11:08                                   ` Eli Zaretskii
2016-02-20 16:17                                     ` Andy Moreton
2016-02-20 17:01                                       ` Eli Zaretskii

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

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

  git send-email \
    --in-reply-to=CAFgFV9PF3fm5jiz6hETBZOLw2ryKXpXTpDvN6GV+OvQ42HU5RA@mail.gmail.com \
    --to=fabrice.popineau@gmail.com \
    --cc=22526@debbugs.gnu.org \
    --cc=andrewjmoreton@gmail.com \
    --cc=eliz@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.