Page MenuHomeFreeBSD

Get rid of netbsd_lchown and netbsd_msync syscall entries.
ClosedPublic

Authored by brooks on Jun 14 2018, 10:48 PM.
Tags
None
Referenced Files
F103564395: D15814.id44181.diff
Tue, Nov 26, 2:06 PM
Unknown Object (File)
Sun, Nov 24, 2:14 PM
Unknown Object (File)
Sat, Nov 23, 9:45 AM
Unknown Object (File)
Fri, Nov 22, 10:01 AM
Unknown Object (File)
Thu, Nov 21, 8:00 AM
Unknown Object (File)
Wed, Nov 20, 1:06 AM
Unknown Object (File)
Mon, Nov 18, 3:38 AM
Unknown Object (File)
Sat, Nov 16, 4:27 AM
Subscribers
None

Details

Summary

No valid FreeBSD binary ever called them (they would call lchown and
msync directly) and we haven't supported NetBSD binaries in ages.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kib added inline comments.
sys/compat/freebsd32/syscalls.master
503 ↗(On Diff #43790)

Does audit entry value useful for OBSOL syscalls ? Should it be changed to AUE_NULL ?

This revision is now accepted and ready to land.Jun 14 2018, 11:17 PM
  • Don't export *netbsd_* symbols.
  • Use AUE_NULL for removed netbsd syscalls.
This revision now requires review to proceed.Jun 15 2018, 12:18 AM

I just discover that libc exported these syscalls. Technically this change is an impermissible ABI break, but there isn't any valid way to the the published API to link to those symbols so I think that's ok. If it's not, I can add trivial stubs for netbsd_lchown() and netbsd_msync() that just call the respective __sys_*.

I believe that stubs which return ENOSYS are fine, without redirecting to the syscalls. More, the stubs do not need to provide the default version, so that linking with the symbols will be impossible any more.

But my opinion is that we must not break the ABI this way, on principle. At least because it makes it needed to argue why other breakage is not allowed. When the rule is 'no breakage at all' it does not require arguments.

  • Add compat symbols returning ENOSYS.
  • Add the version of the compat stubs I ment to add.

You can create symbols which are exported but not linkable, since they do not provide a default version. Such symbol can be only created by asm '@' syntax, it should be removed from the version map. Also I do not see a sense in leaving the private symbols around.

In D15814#337257, @kib wrote:

You can create symbols which are exported but not linkable, since they do not provide a default version. Such symbol can be only created by asm '@' syntax, it should be removed from the version map. Also I do not see a sense in leaving the private symbols around.

Is there an example of this?

In D15814#337257, @kib wrote:

You can create symbols which are exported but not linkable, since they do not provide a default version. Such symbol can be only created by asm '@' syntax, it should be removed from the version map. Also I do not see a sense in leaving the private symbols around.

Is there an example of this?

https://reviews.freebsd.org/D12298

In D15814#338187, @kib wrote:
In D15814#337257, @kib wrote:

You can create symbols which are exported but not linkable, since they do not provide a default version. Such symbol can be only created by asm '@' syntax, it should be removed from the version map. Also I do not see a sense in leaving the private symbols around.

Is there an example of this?

https://reviews.freebsd.org/D12298

As far as I can tell I'm doing exactly what this diff does. The only difference is that I should probably spell compat_enosys as __compat_enosys

In D15814#338187, @kib wrote:

As far as I can tell I'm doing exactly what this diff does. The only difference is that I should probably spell compat_enosys as __compat_enosys

Can you show me the output of readelf -a libc.so.7 | grep netbsd_lchown for your libc ?

$readelf -a ~/obj/home/bed22/git/freebsd/amd64.amd64/lib/libc/libc.so.7 | grep netbsd_lchown
   168: 000000000008c0e0    17 FUNC    LOCAL  DEFAULT   12 __sys_netbsd_lchown
   169: 000000000008c0e0    17 FUNC    LOCAL  DEFAULT   12 _netbsd_lchown
   170: 000000000008c0e0    17 FUNC    LOCAL  DEFAULT   12 netbsd_lchown
$readelf -a ~/obj/home/bed22/git/freebsd/amd64.amd64/lib/libc/libc.so.7 | grep netbsd_lchown
   168: 000000000008c0e0    17 FUNC    LOCAL  DEFAULT   12 __sys_netbsd_lchown
   169: 000000000008c0e0    17 FUNC    LOCAL  DEFAULT   12 _netbsd_lchown
   170: 000000000008c0e0    17 FUNC    LOCAL  DEFAULT   12 netbsd_lchown

So there is no exported symbol netbsd_lchown at all ?

I don't understand why there isn't an exported symbol. I've got a:

__sym_compat(netbsd_lchown, compat_enosys, FBSD_1.1);

Just like the gets review.

lib/libc/sys/compat-stub.c
43 ↗(On Diff #44182)

compat_enosyS

This is why the symbol is not present in the export table.

  • Export under the correct versions.
  • Spell enosys consistantly.
readelf -a libc.so.7.full | grep netbsd
   905: 000000000008cf10    11 FUNC    GLOBAL DEFAULT   12 netbsd_msync@FBSD_1.0 (2)
  3141: 000000000008cf10    11 FUNC    GLOBAL DEFAULT   12 netbsd_lchown@FBSD_1.0 (2)
   165: 000000000008c0a0    17 FUNC    LOCAL  DEFAULT   12 __sys_netbsd_msync
   166: 000000000008c0a0    17 FUNC    LOCAL  DEFAULT   12 _netbsd_msync
   167: 000000000008c0a0    17 FUNC    LOCAL  DEFAULT   12 netbsd_msync
   168: 000000000008c0e0    17 FUNC    LOCAL  DEFAULT   12 __sys_netbsd_lchown
   169: 000000000008c0e0    17 FUNC    LOCAL  DEFAULT   12 _netbsd_lchown
   170: 000000000008c0e0    17 FUNC    LOCAL  DEFAULT   12 netbsd_lchown
  2040: 000000000008cf10    11 FUNC    GLOBAL DEFAULT   12 netbsd_lchown
  2041: 000000000008cf10    11 FUNC    GLOBAL DEFAULT   12 netbsd_msync
This revision is now accepted and ready to land.Jul 5 2018, 8:52 AM
This revision was automatically updated to reflect the committed changes.