Subject: bug#77621: closed (Re: bug#77621: coreutils-9.6.53-14af8 on OpenBSD 7.6)

From: [email-masked] (GNU bug Tracking System)
Date: Tue, 08 Apr 2025 11:08:02 +0000

Your bug report

#77621: coreutils-9.6.53-14af8 on OpenBSD 7.6

which was filed against the coreutils package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
77621: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=77621
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#77621: coreutils-9.6.53-14af8 on OpenBSD 7.6
From: Pádraig Brady <[email-masked]>
To: Bruno Haible <[email-masked]>, Paul Eggert <[email-masked]>
Cc: [email-masked]
Date: Tue, 8 Apr 2025 12:07:45 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

On 08/04/2025 11:22, Bruno Haible wrote:
> Paul Eggert wrote:
>> I don't see the problem on cfarm220.cfarm.net with the current coreutils
> 
> That's because you are not on the /dev/wd0a disk on that machine.
> 
> What I see by single-stepping through "ls -Z ." in gdb is:
> 1. f->scontext gets set to "?".
> 2. Upon the first entry to function file_has_aclinfo_cache,
>     all 4 variables
>       static int unsupported_return;
>       static char *unsupported_scontext;
>       static int unsupported_scontext_err;
>       static dev_t unsupported_device;
>     are 0 or NULL, respectively. (As expected, since it's the first call
>     to this function.)
>     f->stat.st_dev is 0 (since "." is on the /dev/wd0a disk and this device
>     has major and minor number both 0).
>     Thus the condition (f->stat_ok && f->stat.st_dev == unsupported_device)
>     evaluates to true, and four lines later, in
>       ai->scontext = unsupported_scontext;
>     an scontext gets set to NULL.
> 
> The fix is obviously to ignore these 4 static variables if they have not
> been initialized. Done through the attached patch, which fixes the crash.

Excellent.
I'll also apply this logic to has_capability_cache().

Marking this as done.

thanks!
Pádraig

Subject: Re: coreutils-9.6.53-14af8 on OpenBSD 7.6
From: Bruno Haible <[email-masked]>
To: [email-masked], Pádraig Brady <[email-masked]>
Date: Tue, 08 Apr 2025 00:41:18 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

On OpenBSD 7.6 there is a test failure:

FAIL: tests/ls/selinux-segfault

Find attached the log file.

To reproduce the issue, just run

$ src/ls -Z .
Segmentation fault (core dumped)

It crashes at strlen(), due to a NULL argument,
invoked from gobble_file (name = ".", type = arg_directory, inode = 0,
command_line_arg = true, dirname = NULL) at ls.c:3642,
invoked from ls.c:1812.

This reminds me the commit
https://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=915004f403cb25fadb207ddfdbe6a2f43bd44fac
that was supposed to fix the bug reported in
https://lists.gnu.org/archive/html/coreutils/2025-01/msg00051.html

Apparently this bug has reappeared, at least on OpenBSD.

Bruno