Re: Missing extattr syscalls on compat32 (was Re: libarchive extattr i386/amd64 syscall issue)

From: John Baldwin <jhb_at_freebsd.org>
Date: Fri, 5 Jun 2009 09:45:51 -0400
On Thursday 04 June 2009 9:54:02 am Kostik Belousov wrote:
> On Wed, Jun 03, 2009 at 09:43:28PM -0700, Tim Kientzle wrote:
> > Dmitry Marakasov wrote:
> > >
> > >The problem: on recent current, 32bit bsdtar won't write archives when
> > >running under 64bit kernel, dying with exit code 140 and `Bad system 
call'
> > >message. I've ran into that using i386 tinderbox jail on amd64 host.
> > >The problem actually happens in libarchive:
> > >
> > >--- lib/libarchive/archive_read_disk_entry_from_file.c ---
> > >   484		if (!a->follow_symlinks)
> > >   485			list_size = extattr_list_link(path, 
> > >   namespace, NULL, 0);   // <-- HERE
> > >   486		else
> > >   487			list_size = extattr_list_file(path, 
> > >   namespace, NULL, 0);
> > >--- lib/libarchive/archive_read_disk_entry_from_file.c ---
> > 
> > Yes, it looks like only about half of the extattr calls are
> > actually connected in the freebsd32 compatibility layer. (see below)
> > According to SVN history, peter_at_ reserved these slots back
> > in December 2003 but no one ever went back and connected
> > them up.  I don't know if there was a reason for not
> > connecting them or if simply no one remembered to do so.
> > I would guess the latter; the ones that are connected
> > were all implemented before mid-2002.
> > 
> > I don't see any obvious reason these should not just
> > work.  If you're feeling adventurous, you could try
> > copying the data from /usr/src/kern/syscalls.master
> > and see what happens.  I don't have a 64-bit system
> > handy here or I would try this myself.
> > 
> > You can test by going to /usr/src/lib/libarchive/test and
> > running "make check".  That will build and run the libarchive
> > test suite, which does exercise the extended attribute support.
> > (Of course, you should revert your change first so that the
> > extended attribute support is actually compiled.)
> > 
> > Let me know if you find anything,
> > 
> > Tim
> > 
> > 
> > $ grep extattr /usr/src/sys/compat/freebsd32/syscalls.master
> > 355     AUE_EXTATTRCTL  NOPROTO { int extattrctl(const char *path, int 
> > cmd, \
> > 356     AUE_EXTATTR_SET_FILE    NOPROTO { int extattr_set_file( \
> > 357     AUE_EXTATTR_GET_FILE    NOPROTO { ssize_t extattr_get_file( \
> > 358     AUE_EXTATTR_DELETE_FILE NOPROTO { int extattr_delete_file( \
> > 371     AUE_EXTATTR_SET_FD      NOPROTO { int extattr_set_fd(int fd, \
> > 372     AUE_EXTATTR_GET_FD      NOPROTO { ssize_t extattr_get_fd(int fd, \
> > 373     AUE_EXTATTR_DELETE_FD   NOPROTO { int extattr_delete_fd(int fd, \
> > 412     AUE_EXTATTR_SET_LINK    UNIMPL  extattr_set_link
> > 413     AUE_EXTATTR_GET_LINK    UNIMPL  extattr_get_link
> > 414     AUE_EXTATTR_DELETE_LINK UNIMPL  extattr_delete_link
> > 437     AUE_EXTATTR_LIST_FD     UNIMPL  extattr_list_fd
> > 438     AUE_EXTATTR_LIST_FILE   UNIMPL  extattr_list_file
> > 439     AUE_EXTATTR_LIST_LINK   UNIMPL  extattr_list_link
> 
> The size_t arguments need translation. Please try the patch below.

Err, size_t is 32-bit for freebsd32.  Only 64-bit types like off_t need this 
sort of fixup.  See 'read' and 'write' which just use the native versions for 
example.  I don't think these calls need any sort of wrapper but the native 
versions should just work.

-- 
John Baldwin
Received on Fri Jun 05 2009 - 11:55:09 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:49 UTC