Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Mar 2025 13:10:09 +0100
From:      Alexander Leidinger <Alexander@Leidinger.net>
To:        Kyle Evans <kevans@freebsd.org>
Cc:        freebsd-current@freebsd.org, Michael Gmelin <grembo@freebsd.org>
Subject:   Re: -fstack-clash-protection triggers something in setfstab()
Message-ID:  <62ea7e3809ca3146e0868cb06ef1fbdc@Leidinger.net>
In-Reply-To: <a44b6132-3f48-419f-ab94-49cf2ebd2240@FreeBSD.org>
References:  <5ebbe12dc6cb4e3fc00f0a07c03856e4@Leidinger.net> <2400b4d10d4804eef784768d050f6953@Leidinger.net> <a44b6132-3f48-419f-ab94-49cf2ebd2240@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)

--=_9f9dd6b77dc32804b898bc206665df1e
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=US-ASCII;
 format=flowed

Am 2025-03-15 14:33, schrieb Kyle Evans:
> [+grembo@ for iocage]
> 
> On 3/15/25 06:26, Alexander Leidinger wrote:
>> Am 2025-02-26 16:20, schrieb Alexander Leidinger:
>>> Hi,
>>> 
>>> the working system is from 2025-01-25-141603, the non working system 
>>> is from 2025-02-21-115311.
>>> 
>>> I'm not sure what the issue is exactly. I have traced down the change 
>>> of behavior to
>>> ---snip---
>>> if not LIBC.setfstab(fstab_file_path.encode()):
>>> ---snip---
>>> 
>>> In the working case LIBC.setfstab returns true (so with the not it 
>>> doesn't take this branch), and in the non-working case it returns 
>>> false (so with the not it takes this branch).
>>> 
>>> Is someone aware of a change in this area? Searching for it (https:// 
>>> cgit.freebsd.org/src/log/?qt=grep&q=setfstab) only brings the initial 
>>> commit.
>> 
>> Interestingly my own commit triggers this issue.
>> 
>> I bisected and commit 1c2ae9233b0ed4f6b92c59c0e4026f6ddc073e4a is 
>> causing this. This is the first ref which triggers the issue that 
>> iocage can not mount filesystems anymore. And the failing call in 
>> iocage seems to be the python LIBC.setfstab() call. And this only 
>> triggers, when the basesystem is compiled with the stack clash 
>> protection. I do not see any obvious issue in our setfstab code. 
>> Anyone with an idea?
>> 
> setfstab() implementation seems more or less fine, but it's hard to 
> tell what's going on with iocage there.  setfstab(3) doesn't actually 
> have a return value in any version of FreeBSD, so I guess it's picking 
> up some sort of garbage as the return value.
> 
> Looking at the context, you can only tell if the open failed with the 
> subsequent getfsent()/setfsent(); that branch should probably just be 
> removed entirely, and the initial getfsent() might be worth 
> error-checking for potential error or premature EOF.

I tried this, and it works:
---snip---
# diff -u 
/usr/local/lib/python3.11/site-packages/iocage_lib/ioc_fstab_ok.py 
/usr/local/lib/python3.11/site-packages/io
cage_lib/ioc_fstab.py
--- /usr/local/lib/python3.11/site-packages/iocage_lib/ioc_fstab_ok.py  
2025-02-26 14:54:37.381812000 +0100
+++ /usr/local/lib/python3.11/site-packages/iocage_lib/ioc_fstab.py     
2025-03-16 12:55:30.496569000 +0100
@@ -159,15 +159,16 @@
          )
          fstab_list = []
          with FSTAB_LOCK:
-            if not LIBC.setfstab(fstab_file_path.encode()):
-                iocage_lib.ioc_common.logit(
-                    {
-                        'level': 'EXCEPTION',
-                        'message': f'Unable to open {fstab_file_path}'
-                    },
-                    _callback=self.callback,
-                    silent=self.silent
-                )
+            LIBC.setfstab(fstab_file_path.encode())
+            #if not LIBC.setfstab(fstab_file_path.encode()):
+            #    iocage_lib.ioc_common.logit(
+            #        {
+            #            'level': 'EXCEPTION',
+            #            'message': f'Unable to open {fstab_file_path}'
+            #        },
+            #        _callback=self.callback,
+            #        silent=self.silent
+            #    )
              try:
                  set_fstab_path = ensure_unicode_str(LIBC.getfstab())
                  if set_fstab_path != fstab_file_path:
---snip---

Bye,
Alexander.

-- 
http://www.Leidinger.net Alexander@Leidinger.net: PGP 0x8F31830F9F2772BF
http://www.FreeBSD.org    netchild@FreeBSD.org  : PGP 0x8F31830F9F2772BF

--=_9f9dd6b77dc32804b898bc206665df1e
Content-Type: application/pgp-signature;
 name=signature.asc
Content-Disposition: attachment;
 filename=signature.asc;
 size=833
Content-Description: OpenPGP digital signature

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEER9UlYXp1PSd08nWXEg2wmwP42IYFAmfWv7EACgkQEg2wmwP4
2IYMOhAAmZBLbDFPFW07EBVdPVAJXwwnTfg3977clqV4TNnkjl+iW5yAS4ebz9Ob
Mg9B5uqTZ8EI0fBmOwNxbosLz+y7+5sxtsMq6/0c2sKplBFdBewrZToV7hNytwqb
iL+dazFr527pC+OGSgRJLH1wnByqOiEGdTnTqh9kMuRa1GgDJoiUf7UdcZT5OSC/
oSJdHXlMs4ZOGIsTALzsleaU1gEzhdFI8In1CaFLcHgrHSrBgq7QJS645gfMNkF3
hrT64hsMyKtklVNyYSCIwoTeMhN7ZbxSPk8HNSDh1vJeetIVTzDUDIB57jjIAwjx
Vuzv7QJaLnNS5+JedVrezSsDV9QquCjhoTQQdtuINBlwaKaix3Mi/EowS6cNhPFQ
qzMQ94hvBNsnBMxto4h/anC1kA1NbRzAWcRHxH31xZJHdOIf5u8wKx7SsPCkauYC
+1FiP3q1afg3K209P2whCp7uoMg4hlMuVXjK0d+6MvdjhmaJCghqL3Uc96iJsRti
Xzl+b+JvkqbmiZiP5QCrZTYDYmRUDqAb05QXn/E1vde+Toge6h81tu0KKCnv8RvU
3p5bLZg06WfGZFbeGorhuvJwSagv3iEN0bwO1KkH/UfD994TWZrutAG0Yvuft3kG
xbfnjJBdF5bChNT8fAteG3ivB9aTn2SNFRhDn0W/AuTipsRKiXI=
=78Gq
-----END PGP SIGNATURE-----

--=_9f9dd6b77dc32804b898bc206665df1e--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?62ea7e3809ca3146e0868cb06ef1fbdc>