:: Re: [DNG] Nasty Linux systemd secur…
Página Inicial
Delete this message
Reply to this message
Autor: Steve Litt
Data:  
Para: dng
Assunto: Re: [DNG] Nasty Linux systemd security bug revealed
aitor said on Thu, 12 Aug 2021 13:41:44 +0200

>On 12/8/21 13:12, aitor wrote:
>>     struct sbuf s  __cleanbuf__(free_buf);
>I rectify:
>
>struct sbuf s  __cleanbuf__;
>
>being:
>
>#define __cleanbuf__ __attribute__((cleanup(free_buf)))


I see the attraction, Aitor, but doing this has some downsides:

1) GCC only. Everything going into the Void distro must be MUSL also,
so the question is whether MUSL can accommodate it.

2) You'd better do *a lot* of commenting to explain that, because
nobody learned about it in K&R. In your comments I'd have pointers
to other resources like
http://unixwiz.net/techtips/gnu-c-attributes.html as well as
something you author yourself.

So the question becomes whether this barrier to forgetting to free() is
worth those downsides, which complicate your code and get the
programmer in the habit of NOT free()ing when needed.

SteveT

Steve Litt
Spring 2021 featured book: Troubleshooting Techniques of the Successful
Technologist http://www.troubleshooters.com/techniques