Subject: Re: bug#75322: SAFE_ALLOCA assumed to root Lisp_Objects/SSDATA(string)

From: Gerd Möllmann <[email-masked]>
Date: Sat, 04 Jan 2025 05:40:09 +0100

Pip Cet <[email-masked]> writes:

> Gerd Möllmann <[email-masked]> writes:
>
>> Gerd Möllmann <[email-masked]> writes:
>>
>>>
>>> The pointers to string data case probably requires adding yet another
>>> macro SAFE_ALLOCA_FIND_A_GOOD_NAME, which, for MPS, allocates a root,
>>> possibly and exact one which would be good.
>
> Note that might still EFAULT if there's a memory barrier.  I think.
>
> Do we really need to move all arguments to syscalls and libc functions
> which might use a syscall into non-MPS memory?  That would be bad.
>
> And which libc functions might use a syscall?  I think we can agree
> fprintf might, and memcpy() doesn't (note to self: destroy all evidence
> I ever considered making memcpy() use MMU tricks for very large
> buffers), but what about all the others?
>
> Maybe I'm panicking too much and fixing read/write/exec* is good
> enough?

Don't Panic! Quote from The Hitchhiker's Guide to Emacs (non-NS edition)
:-).

TBH, I couldn't follow your thoughts above with the EFAULT, syscalls and
so on.

>> Or one does it as you did in b0a209e9204, that's of course also safe.
>> For both old and new GC. (Don't remember if you mentioned it Pip, but
>> old GC moves string data as well, during string compaction, should GC
>> run).
>
> Ouch.  Yes, I remember now.
>
> Pip

And today I see you reverted that commit. Is there something wrong with
it? I couldn't see something wrong, and for me VALUE(no root) >
VALUE(exact) VALUE(ambig).

WRT Lisp_Object allocas, please tell if I should do that.

(I think this all could also be done on master, but since this is there
forever, I don't think it's absolutely necessary. Agree?)