Improve gcore and support dumping ELF headers
Back in 2016, when life was simpler, a Fedora GDB user
reported a bug
(or a feature request, depending on how you interpret it) saying that
gcore command did not respect the
flag, which instructs it to dump memory pages containing ELF headers.
As you may or may not remember, I have
written about the broader topic of revamping GDB's internal corefile dump algorithm;
it's an interesting read and I recommend it if you don't know how
Linux (or GDB) decides which mappings to dump to a corefile.
Anyway, even though the bug was interesting and had to do with a work I'd done before, I couldn't really work on it at the time, so I decided to put it in the TODO list. Of course, the "TODO list" is actually a crack where most things fall through and are usually never seen again, so I was blissfully ignoring this request because I had other major priorities to deal with. That is, until a seemingly unrelated problem forced me to face this once and for all!
What? A regression? Since when?
As the Fedora GDB maintainer, I'm routinely preparing new releases for Fedora Rawhide distribution, and sometimes for the stable versions of the distro as well. And I try to be very careful when dealing with new releases, because a regression introduced now can come and bite us (i.e., the Red Hat GDB team) back many years in the future, when it's sometimes too late or too difficult to fix things. So, a mandatory part of every release preparation is to actually run a regression test against the previous release, and make sure that everything is working correctly.
One of these days, some weeks ago, I had finished running the regression check for the release I was preparing when I noticed something strange: a specific, Fedora-only corefile test was FAILing. That's a no-no, so I started investigating and found that the underlying reason was that, when the corefile was being generated, the build-id note from the executable was not being copied over. Fedora GDB has a local patch whose job is to, given a corefile with a build-id note, locate the corresponding binary that generated it. Without the build-id note, no binary was being located.
Coincidentally or not, at the same I started noticing some users
reporting very similar build-id issues on the freenode's
channel, and I thought that this bug had a potential to become a big
headache for us if nothing was done to fix it right now.
I asked for some help from the team, and we managed to discover that
the problem was also happening with upstream
gcore, and that it was
probably something that binutils was doing, and not GDB. Hmm...
Ah, so it's
ld's fault. Or is it?
So there I went, trying to confirm that it was binutils's fault, and not GDB's. Of course, if I could confirm this, then I could also tell the binutils guys to fix it, which meant less work for us :-).
With a lot of help from Keith Seitz, I was able to bisect the problem and found that it started with the following commit:
commit f6aec96dce1ddbd8961a3aa8a2925db2021719bb Author: H.J. Lu <firstname.lastname@example.org> Date: Tue Feb 27 11:34:20 2018 -0800 ld: Add --enable-separate-code
This is a commit that touches the linker, which is part of binutils. So that means this is not GDB's problem, right?!? Hmm. No, unfortunately not.
What the commit above does is to simply enable the use of
-z separate-code) by default when
linking an ELF program on x86_64 (more on that later). On a first
glance, this change should not impact the corefile generation, and
indeed, if you tell the Linux kernel to generate a corefile (for
example, by doing
sleep 60 & and then hitting
C-\), you will
notice that the build-id note is included into it! So GDB was
still a suspect here. The investigation needed to continue.
-z separate-code option makes the code segment in the ELF file
to put in a completely separated segment than data segment. This was
done to increase the security of generated binaries. Before it,
everything (code and data) was put together in the same memory
region. What this means in practice is that, before, you would see
something like this when you examined
00400000-00401000 r-xp 00000000 fc:01 798593 /file Size: 4 kB KernelPageSize: 4 kB MMUPageSize: 4 kB Rss: 4 kB Pss: 4 kB Shared_Clean: 0 kB Shared_Dirty: 0 kB Private_Clean: 0 kB Private_Dirty: 4 kB Referenced: 4 kB Anonymous: 4 kB LazyFree: 0 kB AnonHugePages: 0 kB ShmemPmdMapped: 0 kB Shared_Hugetlb: 0 kB Private_Hugetlb: 0 kB Swap: 0 kB SwapPss: 0 kB Locked: 0 kB THPeligible: 0 VmFlags: rd ex mr mw me dw sd
And now, you will see two memory regions instead, like this:
00400000-00401000 r--p 00000000 fc:01 799548 /file Size: 4 kB KernelPageSize: 4 kB MMUPageSize: 4 kB Rss: 4 kB Pss: 4 kB Shared_Clean: 0 kB Shared_Dirty: 0 kB Private_Clean: 4 kB Private_Dirty: 0 kB Referenced: 4 kB Anonymous: 0 kB LazyFree: 0 kB AnonHugePages: 0 kB ShmemPmdMapped: 0 kB Shared_Hugetlb: 0 kB Private_Hugetlb: 0 kB Swap: 0 kB SwapPss: 0 kB Locked: 0 kB THPeligible: 0 VmFlags: rd mr mw me dw sd 00401000-00402000 r-xp 00001000 fc:01 799548 /file Size: 4 kB KernelPageSize: 4 kB MMUPageSize: 4 kB Rss: 4 kB Pss: 4 kB Shared_Clean: 0 kB Shared_Dirty: 0 kB Private_Clean: 0 kB Private_Dirty: 4 kB Referenced: 4 kB Anonymous: 4 kB LazyFree: 0 kB AnonHugePages: 0 kB ShmemPmdMapped: 0 kB Shared_Hugetlb: 0 kB Private_Hugetlb: 0 kB Swap: 0 kB SwapPss: 0 kB Locked: 0 kB THPeligible: 0 VmFlags: rd ex mr mw me dw sd
A few minor things have changed, but the most important of them is the
fact that, before, the whole memory region had anonymous data in
it, which means that it was considered an anonymous private
mapping (anonymous because of the non-zero Anonymous amount of
data; private because of the
p in the
r-xp permission bits).
-z separate-code was made default, the first memory mapping
does not have Anonymous contents anymore, which means that it is
now considered to be a file-backed private mapping instead.
GDB, corefile, and coredump_filter
It is important to mention that, unlike the Linux kernel, GDB doesn't
have all of the necessary information readily available to decide the
exact type of a memory mapping, so when I revamped this code back in
2015 I had to create some heuristics to try and determine this
information. If you're curious, take a look at the
file on GDB's source tree, specifically at the
When GDB is deciding which memory regions should be dumped into the
corefile, it respects the value found at the
/proc/PID/coredump_filter file. The default value for this file is
0x33, which, according to
Dump memory pages that are either anonymous private, anonymous shared, ELF headers or HugeTLB.
GDB had the support implemented to dump almost all of these pages,
except for the ELF headers variety. And, as you can probably infer,
this means that, before the
-z separate-code change, the very first
memory mapping of the executable was being dumped, because it was
marked as anonymous private. However, after the change, the first
mapping (which contains only data, no code) wasn't being dumped
anymore, because it was now considered by GDB to be a file-backed
Finally, that is the reason for the difference between corefiles generated by GDB and Linux, and also the reason why the build-id note was not being included in the corefile anymore! You see, the first memory mapping contains not only the program's data, but also its ELF headers, which in turn contain the build-id information.
gcore, meet ELF headers
The solution was "simple": I needed to improve the current heuristics
and teach GDB how to determine if a mapping contains an ELF header or
not. For that, I chose to follow the Linux kernel's algorithm, which
basically checks the first 4 bytes of the mapping and compares them
\177ELF, which is ELF's magic number. If the comparison
succeeds, then we just assume we're dealing with a mapping that
contains an ELF header and dump it.
In all fairness, Linux just dumps the first page (4K) of the mapping, in order to save space. It would be possible to make GDB do the same, but I chose the faster way and just dumped the whole mapping, which, in most scenarios, shouldn't be a big problem.
It's also interesting to mention that GDB will just perform this check if:
- The heuristic has decided not to dump the mapping so far, and;
- The mapping is private, and;
- The mapping's offset is zero, and;
- There is a request to dump mappings with ELF headers (i.e.,
Linux also makes these checks, by the way.
The patch, finally
I submitted the patch to the mailing list, and it was approved fairly quickly (with a few minor nits).
The reason I'm writing this blog post is because I'm very happy and proud with the whole process. It wasn't an easy task to investigate the underlying reason for the build-id failures, and it was interesting to come up with a solution that extended the work I did a few years ago. I was also able to close a few bug reports upstream, as well as the one reported against Fedora GDB.
The patch has
and is also present at the latest version of Fedora GDB for Rawhide.
It wasn't possible to write a self-contained testcase for this
problem, so I had to resort to using an external tool (
in order to guarantee that the build-id note is correctly present in
the corefile. But that's a small detail, of course.
Anyway, I hope this was an interesting (albeit large) read!
This past Saturday, April 27th, 2019, Samuel Vale, Alex Volkov and I organized the Toronto Bug Squashing Party here in the city. I was very happy with the outcome, especially the fact that we had more than 10 people attending, including a bunch of folks that came from Montréal!
It was a cold day in Toronto, and we met at the Mozilla Toronto office at 9 in the morning. Right there at the door I met anarcat, who had just arrived from Montréal. Together with Alex, we waited for Will to arrive and open the door for us. Then, some more folks started showing up, and we waited until 10:30h to start the first presentation of the day.
Anarcat kindly gave us his famous "Packaging 101" presentation, in which he explains the basics of Debian packaging. Here's a picture of the presentation:
And another one:
The presentation was great, and Alex recorded it! You can watch it here (sorry, youtube link...).
During the day, we've also taught a few tricks about the BTS, in order to help people file bugs, add/remove tags, comment on bugs, etc.
Then, we moved on to the actual hacking.
This part took most of the day, as was expected. We started by looking at the RC bugs currently filed against Buster, and deciding which ones would be interesting for us. I won't go into details here, but I think we made great progress, considering this was the first BSP for many of us there (myself included).
I also noticed something interesting. The way we look at bugs can vary wildly between one DD and another. I mean, this is something I always knew, especially when I was more involved with the debian-mentors effort, but it's really amazing to feel this in person. I tend to be more picky when it comes to defining what to do when I start to work on a bug; I try really hard to reproduce it (and spend a lot of time doing so), and will really dive deep into the code trying to understand why some test is failing. Other developer may be less "pedantic", and choose to (e.g.) disable certain test that is failing. In the end, I think everything is a balance and I tried to learn from this experience.
Anyway, given that we looked at 12 bugs and solved 6, I think we did great! And this also helped me to get my head "back in the Debian game"; I was too involved with GDB these past months (there's a post about one of the things I did which is coming soon, stay tunned).
Look at us hacking:
At 19h (or 7p.m.), we had to wrap up and prepare to go. Because we had a sizeable number of Brazilians in the group (5!), the logical thing to do was to go to a pub and resume the conversation there :-). If I say it was one of the first times I went to a pub to drink with newly made friends in Toronto, you probably wouldn't believe, so I won't say anything...
I know one thing for sure: we want to make this again, and soon! In fact, my idea is to do another one after Buster is released (and after the summer is gone, of course), so maybe October. We'll see.
I would like to thank Mozilla Toronto for hosting us; it was awesome to finally visit their office and enjoy their hospitality, personified by Will Hawkins. It is impossible not to thank anarcat, who came all the way from Montréal to give us his Debian Packaging 101 talk. Speaking of the French-Canadian (and Brazilian), it was super awesome meeting Tiago Vaz and Tássia Camões, and it was great seeing Valessio Brito again.
Let me also thank the "locals" who attended the party; it was great seeing everybody there! Hope I can see everybody again when we make the second edition of our BSP :-).
If you're brazilian, don't come here. If you voted for the president-elected, don't come here. If you think it's better to have a dead son than a gay son, don't come here. If you think it's OK to kill first and ask later (or perhaps don't even ask), don't come here. If you would like to say the things he said, don't come here. If you think he didn't really mean what he said, don't come here. If you can't understand why the things he said are horrible, don't come here. If you think he is a myth, don't come here. If you think he is a saviour, don't come here.
If you don't understand the absurdity of living in Canada and voting for him, don't come here (and please go away if you do). If you don't understand the hypocrisy of calling a homosexual names while living in a country where homosexual marriage has been legal for more than a decade, don't come here. If you think everybody should have a gun, don't come here.
If you are inhuman, don't come here. If you like authoritarians, don't come here. If you can't see he is an authoritarian, don't come here. If you are absolutely sure of everything and don't question yourself, don't come here. If you use (anti)social networks to inform yourself, don't come here. If you think torture is not a big deal, don't come here. If you praise a torturer, don't come here. If you think closing the Congress is a good idea, don't come here. If you think economics are what really matter, don't come here. If you can't feel empathy for another human being who is not related to you, don't come here. If you try to rationalize your vote for him, try to justify to yourself that he is not as bad as he himself says, don't come here. If you are not concerned about more deaths, don't come here.
If you think killing more people is going to improve things, don't come here. If you think the police should be allowed to kill without suffering any consequences, don't come here. If you see a dead black person and think "(s)he must have done something wrong, so it's justified that (s)he was killed", don't come here. If you think the slavery should return, don't come here. If you think indigenous people are lazy and should be killed or have no rights, don't come here. If you have no regard for our forests and our environment, don't come here. If you think the climate change is a hoax, don't come here. If you are just interested in the money, don't come here.
If you blame PT for everything bad that's happened to Brazil, don't come here. If you think people who don't blame PT for everything bad that's happened to Brazil are communists, don't come here. If you think everyone who disagrees with you is a communist, don't come here. If you think Francis Fukuyama is a communist, don't come here. If you think you know what communism is, but only read about it on (anti)social networks, don't come here.
If you are already here, then I have everything against you, and I think you should leave.
Com essa maré de notícias ruins que tá assolando o mundo, fica difícil saber o que dizer quando tento explicar, pra mim mesmo, o que anda acontecendo no Brasil. Não dá pra entender, não dá pra saber, mas mais do que isso: não dá pra acreditar.
Eu poderia falar sobre a burrice generalizada que está brotando nas pessoas, mas aí eu iria soar um pouco presunçoso, e isso não é uma coisa boa, né? Eu também poderia contar um pouco sobre essa raiva silenciosa que eu venho sentindo, essa vontade de que esse monte de idiotas se ferrem de "verde e amarelo", literalmente, e que sejam eles os perseguidos, e que sejam eles os que sofram na pele aquilo que desejam pros outros. Mas talvez meus ilustres leitores não entendam, e é possível que alguém diga, com razão, que eu não deveria pensar assim.
Por esses motivos, eu resolvi falar de outra coisa. Vou falar sobre a certeza. Nós vivemos num período que a certeza está à solta, e todos já têm as suas. A certeza é tipo o tamagotchi dos anos 90: se você não tem, você tá por fora! Ter certeza é ter estilo.
Às vezes eu me pego boquiaberto com o tanto de certeza que as pessoas possuem! Por exemplo, no caso da política brasileira, existem certezas que são quase dogmáticas. Ou você tem certeza que o Lula de fato é corrupto e roubou tudo aquilo que dizem, ou você tem certeza que o Lula não é corrupto e está sendo vítima de um golpe político-midiático-jurídico-judaico-papal. Não tem certeza sobre o assunto? Não sabe, ou não se sente seguro o suficiente pra opinar? Então vai pra masmorra, e receba pedradas dos dois lados!
Como é que faz pra viver nesse mundo? Como é que faz pra se ter tanta certeza sobre tantas coisas? Sinto que faltei a essa aula no colégio, enquanto todo mundo foi e se certificou de ter certeza.
É. Parece que, sem dúvida, eu acho que certamente não sei de nada.
Hey, there. This is long overdue: my entry
in Planet Debian! I'm creating this
post because, until now, I didn't have a
debian tag in my blog!
Well, not anymore.
Back then, I still wanted to write something. Back then, life was different, and I had another view of myself and of others. Back then, my house of cards was still standing, giving the impression that it was safe and sound, that its foundation was solid, and that nothing would shake it. But that was back then.
Right now, I have lost my will and my power to concentrate, to focus on what really matters, because what really matters is still undefined. Right now, things don't seem to fit as they once did; the vision blurs and I am not so sure what it is that I should be doing but am not. Right now, my self has become another one. Someone that doesn't remind me of anybody in particular.
Struggling, defining, living and knowing. These are constant words, constant feelings and actions that live with me. Who am I? What do I like? What do I don't like? Am I good in what I thought I was good? Am I feeling what I think I'm feeling?
This is more than the impostor syndrome. But it is less than the Stockholm syndrome. It's somewhere in between, or maybe nowhere. When I woke up and decided to keep going, I knew it was a temporary decision. It still is. I still have to find what I missed, or what I have never found. What to do? Too hard of a question to answer right now. Here's hoping that time will help me with this hard, but long-wanted task.
Às vezes, é preciso combater. É preciso dizer que o outro está errado, que ele está falando besteira sobre um assunto que não conhece (e não quer conhecer). É preciso dizer o que é ético, o que é certo. É preciso discernir tudo o que é errado e anti-ético, imoral, e que faz mal. É preciso combater o ódio, muitas vezes com amor, outras tantas com força e integridade.
É preciso falar praquele ignorante que ele não sabe o que é Software Livre. É preciso dizer que o Software Livre é muito maior do que o GNU, muito maior do que uma pessoa ou do que suas declarações. É preciso dizer que o ignorante tornou-se troll. É preciso dizer que ele não sabe o que fala, e que deve calar-se. É preciso deixar que ele viva sua adolescência conturbada e por vezes medíocre, mas tomando cuidado para que isso não influencie outras pessoas ignorantes a tornarem-se trolls também. É preciso que esse troll saia do Twitter, saia do BR-[GNU/]Linux, saia dos fóruns movidos a coisas proprietárias; ou talvez seja preciso que ele fique lá, destilando seu ódio, veneno e ignorância para seus semelhantes.
É preciso combater o liberalismo de fachada, que é um veículo para o ódio. É preciso combater o ódio. É preciso combater a ignorância, novamente. É preciso combater o reacionarismo disfarçado de “livre mercado”, é preciso combater a falta de bom senso que ocorre quando se generaliza um partido político por um comportamento, é preciso combater o comportamento, é preciso fazer progresso social sempre, é preciso parar de se importar tanto com aqueles que não se importam.
É preciso combater o pastor ignorante. É preciso combater a ignorância, uma terceira vez. É preciso combater a “trollagem” do pastor, dos fiéis e dos simpatizantes a eles. É preciso combater a onda de “radicalismo conservador” que aflige a todos. É preciso combater a falta de amor ao próximo e o excesso de arrogância. É preciso combater as falsas palavras divinas, as falsas vontades de uma entidade, as falsas aglomerações públicas em torno de um erro.
É preciso combater o apresentador idiota, ignorante e presunçoso. É preciso combater o que se destila de ódio naquele país, porque nem todos têm um soro contra veneno de cobra criada. É preciso combater a ignorância, novamente, porque ela é o caminho mais fácil para o ódio, e o ódio retroalimenta a ignorância num ciclo difícil de ser quebrado. É preciso ensinar a aprender, e aprender a ensinar. É preciso combater a preguiça, essa desculpa tão usada e repetida que chega a dar preguiça de combatê-la. É preciso sair do sofá, mas não para ir para o Twitter ou Facebook; é preciso sair do sofá e ser crítico o suficiente para saber o que se deve fazer, porque não sou eu quem vou falar.
Memory mappings, core dumps, GDB and Linux
After spending the last weeks struggling with this, I decided to write a blog post. First, what is “this” that you are talking about? The answer is: Linux kernel's concept of memory mapping. I found it utterly confused, beyond my expectations, and so I believe that a blog post is the write way to (a) preserve and (b) share this knowledge. So, let's do it!
First things first
First, I cannot begin this post without a few acknowledgements and “thank you's”. The first goes to Oleg Nesterov (sorry, I could not find his website), a Linux kernel guru who really helped me a lot through the whole task. Another “thank you” goes to Jan Kratochvil, who also provided valuable feedback by commenting my GDB patch. Now, back to the point.
The task was requested
needed to respect the
/proc/<PID>/coredump_filter file when generating
a coredump (i.e., when you use the
Currently, GDB has his own coredump mechanism implemented which, despite its limitations and bugs, has been around for quite some time. However, and maybe you don't know that, but the Linux kernel has its own algorithm for generating the corefile of a process. And unfortunately, GDB and Linux were not really following the same standards here...
So, in the end, the task was about synchronizing GDB and Linux. To do
that, I first had to decipher the contents of the
This special file, generated by the Linux kernel when you read it,
contains detailed information about each memory mapping of a certain
process. Some of the fields on this file are documented in the
manpage, but others are missing there (asking for a patch!). Here is an
explanation of everything I needed:
The first line of each memory mapping has the following format:
The fields here are:
a) address is the address range, in the process' address space, that the mapping occupies. This part was already treated by GDB, so I did not have to worry about it.
b) perms is a set of permissions (r ead, w rite, e x ecute, s hared, p rivate [COW -- copy-on-write]) applied to the memory mapping. GDB was already dealing with
rwxpermissions, but I needed to include the
pflag as well. I also made GDB ignore the mappings that did not have the
rflag active, because it does not make sense to dump something that you cannot read.
c) offset is the offset into the applied to the file, if the mapping is file-backed (see below). GDB already handled this correctly.
d) dev is the device (major:minor) related to the file, if there is one. GDB already handled this correctly, though I was using this field for more things (continue reading).
e) inode is the inode on the device above. The value of zero means that no inode is associated with the memory mapping. Nothing to do here.
f) pathname is the file associate with this mapping, if there is one. This is one of the most important fields that I had to use, and one of the most complicated to understand completely. GDB now uses this to heuristically identify whether the mapping is anonymous or not.
GDB is now also interested in
AnonHugePages:fields from the
smapsfile. Those fields represent the content of anonymous data on the mapping; if GDB finds that this content is greater than zero, this means that the mapping is anonymous.
The last, but perhaps most important field, is the
VmFlags:field. It contains a series of two-letter flags that provide very useful information about the mapping. A description of the fields is: a)
sh: the mapping is shared (
dd: this mapping should not be dumped in a corefile (
ht: this is HugeTLB mapping
With that in hands, the following task was to be able to determine whether a memory mapping is anonymous or file-backed, private or shared.
Types of memory mappings
There can be four types of memory mappings:
- Anonymous private mapping
- Anonymous shared mapping
- File-backed private mapping
- File-backed shared mapping
It should be possible to uniquely identify each mapping based on the
information provided by the
smaps file; however, you will see that
this is not always the case. Below, I will explain how to determine each
of the four characteristics that define a mapping.
A mapping is anonymous if one of these conditions apply:
pathnameassociated with it is either
/SYSV%08x (deleted), or
<filename> (deleted)(see below).
- There is content in the
Anonymous:or in the
AnonHugePages:fields of the mapping in the
A special explanation is needed for the
<filename> (deleted) case. It
is not always guaranteed that it identifies an anonymous mapping; in
fact, it is possible to have the
(deleted) part for file-backed
mappings as well (say, when you are running a program that uses shared
libraries, and those shared libraries have been removed because of an
update, for example). However, we are trying to mimic the behavior of
the Linux kernel here, which checks to see if a file has no hard links
associated with it (and therefore is truly deleted).
Although it may be possible for the userspace to do an extensive check
stat ing the file, for example), the Linux kernel certainly could
give more information about this.
A mapping is file-backed (i.e., not anonymous) if:
pathnameassociated with it contains a
<filename>, without the
As has been explained above, a mapping whose
pathname contains the
(deleted) string could still be file-backed, but we decide to consider
It is also worth mentioning that a mapping can be simultaneously
anonymous and file-backed: this happens when the mapping contains a
pathname (without the
(deleted) part), but also contains
A mapping is considered to be private (i.e., not shared) if:
- In the absence of the
VmFlagsfield (in the
smapsfile), its permission field has the flag
- If the
VmFlagsfield is present, then the mapping is private if we do not find the
A mapping is shared (i.e., not private) if:
- In the absence of
smapsfile, the permission field of the mapping does not have the
pflag. Not having this flag actually means
VM_MAYSHAREand not necessarily
VM_SHARED(which is what we want), but it is the best approximation we have.
- If the
VmFlagsfield is present, then the mapping is shared if we find the
With all that in mind, I hacked GDB to improve the coredump mechanism for GNU/Linux operating systems. The main function which decides the memory mappings that will or will not be dumped on GNU/Linux is linux_find_memory_regions_full; the Linux kernel obviously uses its own function, vma_dump_size, to do the same thing.
Linux has one advantage: it is a kernel, and therefore has much more
knowledge about processes' internals than a userspace program. For
example, inside Linux it is trivial to check if a file marked as
(deleted)" in the output of the
smaps file has no hard links
associated with it (and therefore is not really deleted); the same
operation on userspace, however, would require root access to inspect
the contents of the
The case described above, if you remember, is something that impacts the
ability to tell whether a mapping is anonymous or not. I am talking to
the Linux kernel guys to see if it is possible to export this
information directly via the
smaps file, instead of having to do the
While doing this work, some strange behaviors were found in the Linux
kernel. Oleg is working on them, along with other Linux hackers. From
our side, there is still room for improvement on this code. The first
thing I can think of is to improve the heuristics for finding anonymous
mappings. Another relatively easy thing to do would be to let the user
specify a value for
coredump_filter on the command line, without
/proc file. And of course, keep this code always updated
with its counterpart in the Linux kernel.
Upstream discussions and commit
If you are interested, you can see the discussions that happened upstream by going to this link. This is the fourth (and final) submission of the patch; you should be able to find the other submissions in the archive.
The final commit can be found in the official repository.
Deu saudade de escrever em português :-). E deu saudade, também, de fazer algum post mais “filosófico”.
Não sei dizer o porquê, mas às vezes tenho uma mania besta: gosto de ficar procurando “sarna pra me coçar”. Em outras palavras, eu fico procurando coisas que me deixam mal, mesmo sabendo que vou ficar mal depois de vê-las.
Não tenho explicação pra esse comportamento. É algo meio sabotador, meio sofredor, meio... Não sei. Às vezes, quando me vejo novamente nesse ciclo vicioso, consigo parar. No entanto, na maioria das vezes, eu entro num estado estranho: é como se eu estivesse me observando, estudando quais consequências aquele ato traz para mim. Fico me perguntando se sou a única pessoa desse mundo que faz isso...
Acho que um exemplo bom desse tipo de comportamento é o que tenho feito ultimamente. Às vezes, por algum motivo que me é estranho, leio coisas ruins escritas por pessoas extremamente insensatas. E, talvez pelo mesmo motivo misterioso, eu fico mal com o que leio, mesmo sabendo que, colocando na balança o que essas pessoas fazem e o que eu faço, a diferença é gigantesca. Então por que raios eu fico mal quando leio as besteiras que são praticamente vomitadas por essas pessoas?
Talvez algumas pessoas (eu incluso) tenham um radar pra sentimentos fortes. Por exemplo, um gesto de altruísmo é algo que consegue tocar o fundo da alma, e merece ser apreciado como um vinho raro. Mas, em contrapartida, uma expressão de raiva, desprezo ou incompreensão também capta a atenção de uma forma quase inevitável. O mistério que esse gesto, muitas vezes incoerente, esconde é algo que me deixa quase aficcionado, como se eu estivesse lendo um livro e não quisesse parar antes de chegar no final. Por que uma pessoa se coloca num papel por vezes ridículo, apenas por conta de uma opinião? Por que essa pessoa, na ânsia de criticar um comportamento, um pensamento, ou uma ideologia, muitas vezes exibe exatamente as mesmas características que repudia? O que faz um ser humano, cheio de falhas e limitações, subir num (muitas vezes falso) pedestal e esquecer que já esteve lá embaixo?
Felizmente, as questões acima, por mais intrigantes que sejam, não têm me prendido por muito tempo. Acho que, nesse processo de aprendizagem a que chamamos de “vida”, estou num ponto em que percebo claramente o caos que reina na cabeça dessas pessoas, e tento me afastar dele. Mas, mais importante que isso, acho que me dou conta de você pode escolher ser a mudança que quer ver no mundo (Gandhi), ou ficar ladrando enquanto a caravana passa... E eu definitivamente não quero perder meu tempo comparando códigos pra dizer quem é melhor.
A friend of mine, Blaise, once told me not to introduce myself as “... what you would call a radical...”. He had listened to me talking to a person who were questioning what a Free Software activist does. My friend's rationale, to which I totally agree, is that you must let the other person decide whether she thinks you are a “radical” or not. In other words, if you say you are a “radical” from the beginning, it will probably induce the other person to a pre-judgement about you, which is not good for you and for her.
As I said, I agree with him. But I am going through a lot of situations in my life that are constantly reminding me that, maybe, I am that “radical” after all. I do not know whether this is good or bad, and I can say I have been questioning myself for a while now. This post, by the way, is going to be a lot about self-questioning.
Maybe the problem is that I am expecting too much from those that have the same beliefs that I do. Or maybe the cause is that I do not know what to expect from them in certain situations, and I am disappointed when I see that they do not follow what I think is best sometimes. On the other hand, when I look myself in the mirror, I do not know whether I am totally following what I think is best; and if I am not, then how can I even consider telling others to do that? And even if I am following my own advices, how can I be sure that they are good enough for others?
One good example of this is my opinion about FSF's use of Twitter. The opinion is public, and has been criticized by many people already, including Free Software supporters. Shortly after I wrote the post, I mentioned it to Richard Stallman, and he told me he was not going to read it because he considered it “too emotional”. I felt deeply sad because of his reaction, especially because it came from someone who often appeals to emotions in order to teach what he has to say. But I also started questioning myself about the topic.
Is it really bad to use Twitter? This is what I ask myself sometimes. I see so many people using it, including those who defend Free Software as I do (like Matt Lee), or those who stand against privacy abuses (like Jacob Appelbaum), or who are worried about social causes, or... Yeah, you got the point. I refuse to believe that they did not think about Twitter's issues, or about how they would be endorsing its use by using it themselves. Yet, they are there, and a lot of people is following their posts and discussing their opinions and ideas for a better world. As much as I try to understand their motivation for using Twitter (or even Facebook), I cannot convince myself that what they are doing is good for their goals. Am I being too narrow minded? Am I missing something?
Another example are my thoughts about Free Software programs that support (and sometimes even promote) unethical services. They (the thoughts) are also public. And it seems that this opinion, which is about something I called “Respectful Software”, is too strong (or “radical”?) for the majority of the developers, even considering Free Software developers. I saw very good arguments on why Free Software should support unethical services, and it is hard to disagree with them. I guess the best of those arguments is that when you support unethical services like Facebook, you are offering a Free Software option for those who want or need to use the service. In other words, you are helping them to slowly get rid of the digital handcuffs.
It seems like all those arguments (about Twitter, about implementing support for proprietary systems on Free Software, and others) are ultimately about reaching users that would otherwise remain ignorant of the Free Software philosophy. And how can someone have counter-arguments for this? It is impossible to argue that we do not need to take the Free Software message to everybody, because when someone does not use Free Software, she is doing harm to her community (thus, we want more people using Free Software, of course). When the Free Software Foundation makes use of Twitter to bring more people to the movement, and when I see that despite talking to people all around me I can hardly convince them to try GNU/Linux, who am I to criticize the FSF?
So, I have been thinking to myself whether it is time to change. What I am realizing more and more is that my fight for coherence perhaps is flawed. We are incoherent by nature. And the truth is that, no matter what we do, people change according to their own time, their own will, and their own beliefs (or to the lack of them). I remembered something that I once heard: changing is not binary, changing is a process. So, after all, maybe it is time to stop being a “GNU radical” (in the sense that I am radical even for the GNU project), and become a new type of activist.