GNU bug report logs - #77621
coreutils-9.6.53-14af8 on OpenBSD 7.6

Previous Next

Package: coreutils;

Reported by: Bruno Haible <bruno <at> clisp.org>

Date: Mon, 7 Apr 2025 22:42:02 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 77621 in the body.
You can then email your comments to 77621 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#77621; Package coreutils. (Mon, 07 Apr 2025 22:42:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Bruno Haible <bruno <at> clisp.org>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Mon, 07 Apr 2025 22:42:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Bruno Haible <bruno <at> clisp.org>
To: bug-coreutils <at> gnu.org, Pádraig Brady <P <at> draigbrady.com>
Subject: Re: coreutils-9.6.53-14af8 on OpenBSD 7.6
Date: Tue, 08 Apr 2025 00:41:18 +0200
[Message part 1 (text/plain, inline)]
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

[openbsd76-test-suite.log (text/x-log, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#77621; Package coreutils. (Mon, 07 Apr 2025 23:07:01 GMT) Full text and rfc822 format available.

Message #8 received at 77621 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Bruno Haible <bruno <at> clisp.org>, 77621 <at> debbugs.gnu.org
Subject: Re: bug#77621: coreutils-9.6.53-14af8 on OpenBSD 7.6
Date: Tue, 8 Apr 2025 00:06:34 +0100
On 07/04/2025 23:41, Bruno Haible via GNU coreutils Bug Reports wrote:
> 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.

I have access to cfarm220.cfarm.net,
so I'll look at this tomorrow.

thanks for testing!

Pádraig




Information forwarded to bug-coreutils <at> gnu.org:
bug#77621; Package coreutils. (Tue, 08 Apr 2025 07:43:01 GMT) Full text and rfc822 format available.

Message #11 received at 77621 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Pádraig Brady <P <at> draigBrady.com>
Cc: 77621 <at> debbugs.gnu.org, Bruno Haible <bruno <at> clisp.org>
Subject: Re: bug#77621: coreutils-9.6.53-14af8 on OpenBSD 7.6
Date: Tue, 8 Apr 2025 00:41:51 -0700
On 2025-04-07 16:06, Pádraig Brady wrote:
> I have access to cfarm220.cfarm.net,
> so I'll look at this tomorrow.

I don't see the problem on cfarm220.cfarm.net with the current coreutils 
commit (42f6201aa554fde4c78a3c5d0207d85392eb742e), using "./configure && 
make -j5 check" . The command "src/ls -Z" does not dump core: it outputs 
a bunch of file names with "?" before them. "make check" outputs a line:

PASS: tests/ls/selinux-segfault.sh

That is, it does not output a line "FAIL: tests/ls/selinux-segfault", as 
Bruno reported.

All tests pass, including gnulib tests.

You can temporarily see my build on that machine in the directory 
~eggert/coreutils-9.6.59-42f62.

Maybe the bug has been fixed since coreutils-9.6.53-14af8?




Information forwarded to bug-coreutils <at> gnu.org:
bug#77621; Package coreutils. (Tue, 08 Apr 2025 10:23:02 GMT) Full text and rfc822 format available.

Message #14 received at 77621 <at> debbugs.gnu.org (full text, mbox):

From: Bruno Haible <bruno <at> clisp.org>
To: Pádraig Brady <P <at> draigbrady.com>,
 Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 77621 <at> debbugs.gnu.org
Subject: Re: bug#77621: coreutils-9.6.53-14af8 on OpenBSD 7.6
Date: Tue, 08 Apr 2025 12:22:15 +0200
[Message part 1 (text/plain, inline)]
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.

[0001-ls-Fix-crash-of-ls-Z-.-on-OpenBSD-s-dev-wd0a-disk.patch (text/x-patch, attachment)]

Reply sent to Pádraig Brady <P <at> draigBrady.com>:
You have taken responsibility. (Tue, 08 Apr 2025 11:08:01 GMT) Full text and rfc822 format available.

Notification sent to Bruno Haible <bruno <at> clisp.org>:
bug acknowledged by developer. (Tue, 08 Apr 2025 11:08:02 GMT) Full text and rfc822 format available.

Message #19 received at 77621-done <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Bruno Haible <bruno <at> clisp.org>, Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 77621-done <at> debbugs.gnu.org
Subject: Re: bug#77621: coreutils-9.6.53-14af8 on OpenBSD 7.6
Date: Tue, 8 Apr 2025 12:07:45 +0100
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





Information forwarded to bug-coreutils <at> gnu.org:
bug#77621; Package coreutils. (Tue, 08 Apr 2025 11:49:02 GMT) Full text and rfc822 format available.

Message #22 received at 77621-done <at> debbugs.gnu.org (full text, mbox):

From: Bruno Haible <bruno <at> clisp.org>
To: Pádraig Brady <P <at> draigbrady.com>
Cc: 77621-done <at> debbugs.gnu.org, Paul Eggert <eggert <at> cs.ucla.edu>
Subject: Re: bug#77621: coreutils-9.6.53-14af8 on OpenBSD 7.6
Date: Tue, 08 Apr 2025 13:48:43 +0200
Pádraig Brady wrote:
> I'll also apply this logic to has_capability_cache().

Yes, the same mistake is lurking there as well.

Bruno







bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 07 May 2025 11:24:12 GMT) Full text and rfc822 format available.

This bug report was last modified 29 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.