This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: What does LAV_CURRENT mean backwards compatibility of LD_AUDIT interface?
- From: Ben Woodard <woodard at redhat dot com>
- To: "Carlos O'Donell" <carlos at redhat dot com>
- Cc: GNU C Library <libc-alpha at sourceware dot org>, Roland McGrath <roland at hack dot frob dot com>, "Joseph S. Myers" <joseph at codesourcery dot com>, Matt Legendre <legendre1 at llnl dot gov>
- Date: Fri, 27 Feb 2015 11:36:09 -0800
- Subject: Re: What does LAV_CURRENT mean backwards compatibility of LD_AUDIT interface?
- Authentication-results: sourceware.org; auth=none
- References: <54EFBC96 dot 7010608 at redhat dot com> <D662FD8B-23A9-48B9-8CB0-AA6B7C976627 at redhat dot com> <54EFEEBC dot 2010001 at redhat dot com> <3AE4DFDF-66EA-4760-94EE-19C4AE3D4E97 at redhat dot com> <54F0C1D0 dot 7060902 at redhat dot com>
First attempt bounced â trying again.
> On Feb 27, 2015, at 11:13 AM, Carlos O'Donell <carlos@redhat.com> wrote:
>
> On 02/27/2015 01:59 PM, Ben Woodard wrote:
>> The reason that I thought a warning was appropriate was the case
>> where someone for some reason had a version of sotruss-lib.c or had
>> copied and pasted code from it and then glibc moved on to a new
>> interface version. In other words, this was making it more overt that
>> backward compatibility was the intended behavior and hopefully
>> preventing something that is appropriate in a file which is part of
>> glibc, not introduce a bug in some externally audit library that
>> happened to be implemented beginning with a cut and paste from
>> sotruss-lib.c
>
> Understood. In which case one should write:
>
> /* Audit interface verification. We also initialize everything if
> everything checks out OK. */
> unsigned int
> la_version (unsigned int v)
> {
> if (v < LAV_CURRENT)
> error (1, 0, "cannot handle interface version %u", v);
> if (v > LAV_CURRENT)
> warn (1, 0, "recompile for newer audit interface version %u", v);
>
> init ();
>
> return v;
> }
>
> Would you agree?
I could mostly agree with that but assuming everything else in sotruss-lib.c stays the same I think what I would really do is:
#define LAV_MIN 1
#define LAV_MAX 2
#if LAV_CURRENT > LAV_MAX
#error Verify that changes to the LD_AUDIT interface are still compatible
/* once you have verified that the changes to the audit interface are compatible update
LAV_MAX to the current value of LAV_CURRENT found in elf/link.h */
#endif
#define LAV_DESIGN LAV_CURRENT
/* Audit interface verification. We also initialize everything if
everything checks out OK. */
unsigned int
la_version (unsigned int v)
{
if (v < LAV_MIN)
error (1, 0, "cannot handle interface version %u", v);
if (v > LAV_DESIGN){
warn (1, 0, "recompile for newer audit interface version %u", v);
v=LAV_DESIGN;
}
init ();
return v;
}
>
> Cheers,
> Carlos.