This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: What does LAV_CURRENT mean backwards compatibility of LD_AUDIT interface?


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]