Bug 85835 - libsanitizer includes <sys/ustat.h> unconditionally
Summary: libsanitizer includes <sys/ustat.h> unconditionally
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: sanitizer (show other bugs)
Version: 9.0
: P3 normal
Target Milestone: 9.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
: 85844 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-05-18 18:11 UTC by H.J. Lu
Modified: 2018-09-21 07:18 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2018-05-19 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2018-05-18 18:11:50 UTC
libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc has

#include <sys/ustat.h>
...
#if SANITIZER_LINUX && !SANITIZER_ANDROID
  unsigned struct_ustat_sz = sizeof(struct ustat);
  unsigned struct_rlimit64_sz = sizeof(struct rlimit64);
  unsigned struct_statvfs64_sz = sizeof(struct statvfs64);
#endif // SANITIZER_LINUX && !SANITIZER_ANDROID

But <sys/ustat.h> has been removed from glibc 2.28 by

commit cf2478d53ad7071e84c724a986b56fe17f4f4ca7
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Sun Mar 18 11:28:59 2018 +0800

    Deprecate ustat syscall interface
    
    As for sysctl, ustat has been deprecated in favor of {f}statfs.  Also
    some newer ports which uses generic interface builds a stub version that
    returns ENOSYS.
    
    This patch deprecates ustat interface by removing ustat.h related headers,
    adding a compatibility symbol, and avoiding new ports to build and provide
    the symbol.
    
    Checked on x86_64-linux-gnu and i686-linux-gnu.  Also checked with a
    check-abi on all affected ABIs.
Comment 1 Andrew Pinski 2018-05-19 22:50:12 UTC
*** Bug 85844 has been marked as a duplicate of this bug. ***
Comment 2 Andrew Pinski 2018-05-19 22:50:51 UTC
Did someone report this upstream?
Comment 3 H.J. Lu 2018-05-19 23:05:59 UTC
(In reply to Andrew Pinski from comment #2)
> Did someone report this upstream?

https://bugs.llvm.org/show_bug.cgi?id=37418
Comment 4 hjl@gcc.gnu.org 2018-05-24 19:53:03 UTC
Author: hjl
Date: Thu May 24 19:52:32 2018
New Revision: 260684

URL: https://gcc.gnu.org/viewcvs?rev=260684&root=gcc&view=rev
Log:
libsanitizer: Use pre-computed size of struct ustat for Linux

Cherry-pick compiler-rt revision 333213:

<sys/ustat.h> has been removed from glibc 2.28 by:

commit cf2478d53ad7071e84c724a986b56fe17f4f4ca7
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Sun Mar 18 11:28:59 2018 +0800

    Deprecate ustat syscall interface

This patch uses pre-computed size of struct ustat for Linux.

	PR sanitizer/85835
	* sanitizer_common/sanitizer_platform_limits_posix.cc: Don't
	include <sys/ustat.h> for Linux.
	(SIZEOF_STRUCT_USTAT): New.
	(struct_ustat_sz): Use SIZEOF_STRUCT_USTAT for Linux.

Modified:
    trunk/libsanitizer/ChangeLog
    trunk/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
Comment 5 H.J. Lu 2018-05-24 19:54:46 UTC
Fixed.
Comment 6 hjl@gcc.gnu.org 2018-05-24 20:07:56 UTC
Author: hjl
Date: Thu May 24 20:07:25 2018
New Revision: 260687

URL: https://gcc.gnu.org/viewcvs?rev=260687&root=gcc&view=rev
Log:
libsanitizer: Use pre-computed size of struct ustat for Linux

Cherry-pick compiler-rt revision 333213:

<sys/ustat.h> has been removed from glibc 2.28 by:

commit cf2478d53ad7071e84c724a986b56fe17f4f4ca7
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Sun Mar 18 11:28:59 2018 +0800

    Deprecate ustat syscall interface

This patch uses pre-computed size of struct ustat for Linux.

	PR sanitizer/85835
	* sanitizer_common/sanitizer_platform_limits_posix.cc: Don't
	include <sys/ustat.h> for Linux.
	(SIZEOF_STRUCT_USTAT): New.
	(struct_ustat_sz): Use SIZEOF_STRUCT_USTAT for Linux.

Modified:
    branches/gcc-8-branch/libsanitizer/ChangeLog
    branches/gcc-8-branch/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
Comment 7 hjl@gcc.gnu.org 2018-05-24 20:22:26 UTC
Author: hjl
Date: Thu May 24 20:21:54 2018
New Revision: 260688

URL: https://gcc.gnu.org/viewcvs?rev=260688&root=gcc&view=rev
Log:
libsanitizer: Use pre-computed size of struct ustat for Linux

Cherry-pick compiler-rt revision 333213:

<sys/ustat.h> has been removed from glibc 2.28 by:

commit cf2478d53ad7071e84c724a986b56fe17f4f4ca7
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Sun Mar 18 11:28:59 2018 +0800

    Deprecate ustat syscall interface

This patch uses pre-computed size of struct ustat for Linux.

	PR sanitizer/85835
	* sanitizer_common/sanitizer_platform_limits_posix.cc: Don't
	include <sys/ustat.h> for Linux.
	(SIZEOF_STRUCT_USTAT): New.
	(struct_ustat_sz): Use SIZEOF_STRUCT_USTAT for Linux.


Modified:
    branches/gcc-7-branch/libsanitizer/ChangeLog
    branches/gcc-7-branch/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
Comment 8 Matthias Klose 2018-05-31 09:00:47 UTC
see PR86012 for a build failure on sparc64.
Comment 9 Matthias Klose 2018-09-21 07:18:58 UTC
Author: doko
Date: Fri Sep 21 07:18:26 2018
New Revision: 264457

URL: https://gcc.gnu.org/viewcvs?rev=264457&root=gcc&view=rev
Log:
2017-09-21  Matthias Klose  <doko@ubuntu.com>

        Backported from the gcc-7-branch:
        2018-05-24  H.J. Lu  <hongjiu.lu@intel.com>

        PR sanitizer/85835
        * sanitizer_common/sanitizer_platform_limits_posix.cc: Don't
        include <sys/ustat.h> for Linux.
        (SIZEOF_STRUCT_USTAT): New.
        (struct_ustat_sz): Use SIZEOF_STRUCT_USTAT for Linux.

Modified:
    branches/gcc-6-branch/libsanitizer/ChangeLog
    branches/gcc-6-branch/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc