This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH] fopencookie: Mangle function pointers stored on the heap [BZ #20222]
- From: Carlos O'Donell <carlos at redhat dot com>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Fri, 10 Jun 2016 13:50:52 -0400
- Subject: Re: [PATCH] fopencookie: Mangle function pointers stored on the heap [BZ #20222]
- Authentication-results: sourceware.org; auth=none
- References: <20160610104919 dot 479B340176C1C at oldenburg dot str dot redhat dot com> <70a76084-d96b-11d9-9427-2a0a604e0976 at redhat dot com> <5ba072f8-f763-0f0b-f2ec-fb08ba14eb85 at redhat dot com>
On 06/10/2016 11:56 AM, Florian Weimer wrote:
> On 06/10/2016 05:55 PM, Carlos O'Donell wrote:
>>> +/* Copy the callbacks from SOURCE to *TARGET, with pointer
>>> + mangling. */
>>> +static void
>>> +set_callbacks (_IO_cookie_io_functions_t *target,
>>> + _IO_cookie_io_functions_t source)
>>> + PTR_MANGLE (source.read);
>>> + PTR_MANGLE (source.write);
>>> + PTR_MANGLE (source.seek);
>>> + PTR_MANGLE (source.close);
>> Isn't this modifying the user's copy of the callbacks
>> passed in during the call to fopencookie?
> No, C function arguments are pass-by-value. It's not a
> pointer-to-struct, it's the struct object itself.
Sorry yes, I misread that as pointer-to-struct.
You are absolutely right, these are just struct copies
being passed around so we don't care.
Patch looks good to me then.