NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/55712: posix_fallocate() is broken



The following reply was made to PR kern/55712; it has been noted by GNATS.

From: Frank Kardel <kardel%netbsd.org@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: kern/55712: posix_fallocate() is broken
Date: Sat, 10 Oct 2020 17:55:59 +0200

 Neat, I overlooked that part with the directly returned error code :-(.
 
 Well, offering that function lures configure scripts into using it even 
 though we do not actually support it.
 
 And I tripped over following code in the wild (frRouting):
 lib/zlog.c:
 #ifdef HAVE_POSIX_FALLOCATE
          if (posix_fallocate(mmfd, 0, TLS_LOG_BUF_SIZE) < 0) {
 #else
          if (ftruncate(mmfd, TLS_LOG_BUF_SIZE) < 0) {
 #endif
                  zlog_err("failed to allocate thread log buffer \"%s\": %s",
                           mmpath, strerror(errno));
                  goto out_anon_unlink;
          }
 
 This might work on Linux with the negative errnos, but is certainly not 
 portable and
 goes completely wrong on NetBSD as the error is not detected, mmap() is 
 done and then later
 when accessing the address we get a SIGBUS.
 
 Well - not a brilliant spot and another patch for pkgsrc.
 
 Thanks for the quick answer.
 
 Frank
 
 On 10/10/20 17:05, Christos Zoulas wrote:
 > The following reply was made to PR kern/55712; it has been noted by GNATS.
 >
 > From: Christos Zoulas <christos%zoulas.com@localhost>
 > To: gnats-bugs%netbsd.org@localhost
 > Cc: kern-bug-people%netbsd.org@localhost,
 >   gnats-admin%netbsd.org@localhost,
 >   netbsd-bugs%netbsd.org@localhost
 > Subject: Re: kern/55712: posix_fallocate() is broken
 > Date: Sat, 10 Oct 2020 11:03:34 -0400
 >
 >   --Apple-Mail=_DC4117A3-ADB9-4FD0-8770-834394929D3F
 >   Content-Transfer-Encoding: 7bit
 >   Content-Type: text/plain;
 >   	charset=us-ascii
 >   
 >   posix_fallocate returns errno, and in this case it returns 45 (EOPNOTSUPP).
 >   Well, it is not broken, it is just that no filesystem implements it :-)
 >   
 >   christos
 >   
 >   --Apple-Mail=_DC4117A3-ADB9-4FD0-8770-834394929D3F
 >   Content-Transfer-Encoding: 7bit
 >   Content-Disposition: attachment;
 >   	filename=signature.asc
 >   Content-Type: application/pgp-signature;
 >   	name=signature.asc
 >   Content-Description: Message signed with OpenPGP
 >   
 >   -----BEGIN PGP SIGNATURE-----
 >   Comment: GPGTools - http://gpgtools.org
 >   
 >   iF0EARECAB0WIQS+BJlbqPkO0MDBdsRxESqxbLM7OgUCX4HNRgAKCRBxESqxbLM7
 >   OjKdAJ0YcnpJpbKPqf1kGBJJ9z/FWvYzOgCglZiZTDQHxTN4xMQbQAx32RA4mYQ=
 >   =pssI
 >   -----END PGP SIGNATURE-----
 >   
 >   --Apple-Mail=_DC4117A3-ADB9-4FD0-8770-834394929D3F--
 >   
 
 


Home | Main Index | Thread Index | Old Index