Messages in this thread | | | From | Miguel Ojeda <> | Date | Tue, 25 Jul 2023 12:33:41 +0200 | Subject | Re: [PATCH] scripts/kallsyms: Fix build failure by setting errno before calling getline() |
| |
On Tue, Jul 25, 2023 at 10:55 AM James Clark <james.clark@arm.com> wrote: > > But I just checked now and it's just bear [1] that causes the issue. > Maybe it sets errno before forking and that persists in the child > processes? Not 100% sure how it works. I did debug scripts/kallsyms and > errno was already set on the first line of main(), so it's not some > other library call in kallsyms that is setting it but not being checked.
I think this is https://github.com/rizsotto/Bear/issues/469: bear preloads a library which was setting it to non-zero.
Now, even if bear was breaking a guarantee C programs have (`errno` for the initial thread at program startup is meant to be 0 according to the C standard), it is still a good idea to set `errno` to zero here in case something else happens to change `errno` within `kallsyms` in the future.
With the repro and the `bear` link issue added:
Reviewed-by: Miguel Ojeda <ojeda@kernel.org>
Cheers, Miguel
| |