Date: Fri, 5 Jun 2009 17:40:52 +0300 From: Kostik Belousov <kostikbel@gmail.com> To: John Baldwin <jhb@freebsd.org> Cc: Tim Kientzle <kientzle@freebsd.org>, freebsd-current@freebsd.org, Dmitry Marakasov <amdmi3@amdmi3.ru> Subject: Re: Missing extattr syscalls on compat32 (was Re: libarchive extattr i386/amd64 syscall issue) Message-ID: <20090605144052.GE1927@deviant.kiev.zoral.com.ua> In-Reply-To: <200906050945.52511.jhb@freebsd.org> References: <20090604010719.GC15659@hades.panopticon> <4A2750F0.3070106@freebsd.org> <20090604135402.GT1927@deviant.kiev.zoral.com.ua> <200906050945.52511.jhb@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--ho6OhzAHcBHHvqkB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Fri, Jun 05, 2009 at 09:45:51AM -0400, John Baldwin wrote:
> 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 wh=
en
> > > >running under 64bit kernel, dying with exit code 140 and `Bad system=
=20
> 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 =3D extattr_list_link(path,=20
> > > > namespace, NULL, 0); // <-- HERE
> > > > 486 else
> > > > 487 list_size =3D extattr_list_file(path,=20
> > > > namespace, NULL, 0);
> > > >--- lib/libarchive/archive_read_disk_entry_from_file.c ---
> > >=20
> > > 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@ 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.
> > >=20
> > > 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.
> > >=20
> > > 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.)
> > >=20
> > > Let me know if you find anything,
> > >=20
> > > Tim
> > >=20
> > >=20
> > > $ grep extattr /usr/src/sys/compat/freebsd32/syscalls.master
> > > 355 AUE_EXTATTRCTL NOPROTO { int extattrctl(const char *path, in=
t=20
> > > 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 f=
d, \
> > > 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
> >=20
> > The size_t arguments need translation. Please try the patch below.
>=20
> Err, size_t is 32-bit for freebsd32. Only 64-bit types like off_t need t=
his=20
> sort of fixup. See 'read' and 'write' which just use the native versions=
for=20
> example. I don't think these calls need any sort of wrapper but the nati=
ve=20
> versions should just work.
Yes, I obvioulsy confused it with off_t.
diff --git a/sys/compat/freebsd32/freebsd32_proto.h b/sys/compat/freebsd32/=
freebsd32_proto.h
index 5a12c5d..587fdc4 100644
--- a/sys/compat/freebsd32/freebsd32_proto.h
+++ b/sys/compat/freebsd32/freebsd32_proto.h
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 191673 =
2009-04-29 21:14:15Z jamie=20
+ * created from FreeBSD
*/
=20
#ifndef _FREEBSD32_SYSPROTO_H_
diff --git a/sys/compat/freebsd32/freebsd32_syscall.h b/sys/compat/freebsd3=
2/freebsd32_syscall.h
index 73fc7b3..43a68b3 100644
--- a/sys/compat/freebsd32/freebsd32_syscall.h
+++ b/sys/compat/freebsd32/freebsd32_syscall.h
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 191673 =
2009-04-29 21:14:15Z jamie=20
+ * created from FreeBSD
*/
=20
#define FREEBSD32_SYS_syscall 0
@@ -303,6 +303,9 @@
#define FREEBSD32_SYS_statfs 396
#define FREEBSD32_SYS_fstatfs 397
#define FREEBSD32_SYS_fhstatfs 398
+#define FREEBSD32_SYS_extattr_set_link 412
+#define FREEBSD32_SYS_extattr_get_link 413
+#define FREEBSD32_SYS_extattr_delete_link 414
#define FREEBSD32_SYS_freebsd32_sigaction 416
#define FREEBSD32_SYS_freebsd32_sigreturn 417
#define FREEBSD32_SYS_freebsd32_getcontext 421
@@ -315,6 +318,9 @@
#define FREEBSD32_SYS_freebsd32_umtx_lock 434
#define FREEBSD32_SYS_freebsd32_umtx_unlock 435
#define FREEBSD32_SYS_jail_attach 436
+#define FREEBSD32_SYS_extattr_list_fd 437
+#define FREEBSD32_SYS_extattr_list_file 438
+#define FREEBSD32_SYS_extattr_list_link 439
#define FREEBSD32_SYS_freebsd32_thr_suspend 442
#define FREEBSD32_SYS_thr_wake 443
#define FREEBSD32_SYS_kldunloadf 444
diff --git a/sys/compat/freebsd32/freebsd32_syscalls.c b/sys/compat/freebsd=
32/freebsd32_syscalls.c
index c31d080..a69d907 100644
--- a/sys/compat/freebsd32/freebsd32_syscalls.c
+++ b/sys/compat/freebsd32/freebsd32_syscalls.c
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 191673 =
2009-04-29 21:14:15Z jamie=20
+ * created from FreeBSD
*/
=20
const char *freebsd32_syscallnames[] =3D {
@@ -419,9 +419,9 @@ const char *freebsd32_syscallnames[] =3D {
"#409", /* 409 =3D __mac_get_pid */
"#410", /* 410 =3D __mac_get_link */
"#411", /* 411 =3D __mac_set_link */
- "#412", /* 412 =3D extattr_set_link */
- "#413", /* 413 =3D extattr_get_link */
- "#414", /* 414 =3D extattr_delete_link */
+ "extattr_set_link", /* 412 =3D extattr_set_link */
+ "extattr_get_link", /* 413 =3D extattr_get_link */
+ "extattr_delete_link", /* 414 =3D extattr_delete_link */
"#415", /* 415 =3D __mac_execve */
"freebsd32_sigaction", /* 416 =3D freebsd32_sigaction */
"freebsd32_sigreturn", /* 417 =3D freebsd32_sigreturn */
@@ -444,9 +444,9 @@ const char *freebsd32_syscallnames[] =3D {
"freebsd32_umtx_lock", /* 434 =3D freebsd32_umtx_lock */
"freebsd32_umtx_unlock", /* 435 =3D freebsd32_umtx_unlock */
"jail_attach", /* 436 =3D jail_attach */
- "#437", /* 437 =3D extattr_list_fd */
- "#438", /* 438 =3D extattr_list_file */
- "#439", /* 439 =3D extattr_list_link */
+ "extattr_list_fd", /* 437 =3D extattr_list_fd */
+ "extattr_list_file", /* 438 =3D extattr_list_file */
+ "extattr_list_link", /* 439 =3D extattr_list_link */
"#440", /* 440 =3D kse_switchin */
"#441", /* 441 =3D ksem_timedwait */
"freebsd32_thr_suspend", /* 442 =3D freebsd32_thr_suspend */
diff --git a/sys/compat/freebsd32/freebsd32_sysent.c b/sys/compat/freebsd32=
/freebsd32_sysent.c
index a44eb58..5d64fca 100644
--- a/sys/compat/freebsd32/freebsd32_sysent.c
+++ b/sys/compat/freebsd32/freebsd32_sysent.c
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 191673 =
2009-04-29 21:14:15Z jamie=20
+ * created from FreeBSD
*/
=20
#include "opt_compat.h"
@@ -450,9 +450,9 @@ struct sysent freebsd32_sysent[] =3D {
{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 409 =3D __mac_ge=
t_pid */
{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 410 =3D __mac_ge=
t_link */
{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 411 =3D __mac_se=
t_link */
- { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 412 =3D extattr_=
set_link */
- { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 413 =3D extattr_=
get_link */
- { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 414 =3D extattr_=
delete_link */
+ { AS(extattr_set_link_args), (sy_call_t *)extattr_set_link, AUE_EXTATTR_S=
ET_LINK, NULL, 0, 0, 0 }, /* 412 =3D extattr_set_link */
+ { AS(extattr_get_link_args), (sy_call_t *)extattr_get_link, AUE_EXTATTR_G=
ET_LINK, NULL, 0, 0, 0 }, /* 413 =3D extattr_get_link */
+ { AS(extattr_delete_link_args), (sy_call_t *)extattr_delete_link, AUE_EXT=
ATTR_DELETE_LINK, NULL, 0, 0, 0 }, /* 414 =3D extattr_delete_link */
{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 415 =3D __mac_ex=
ecve */
{ AS(freebsd32_sigaction_args), (sy_call_t *)freebsd32_sigaction, AUE_SIG=
ACTION, NULL, 0, 0, 0 }, /* 416 =3D freebsd32_sigaction */
{ AS(freebsd32_sigreturn_args), (sy_call_t *)freebsd32_sigreturn, AUE_SIG=
RETURN, NULL, 0, 0, 0 }, /* 417 =3D freebsd32_sigreturn */
@@ -475,9 +475,9 @@ struct sysent freebsd32_sysent[] =3D {
{ AS(freebsd32_umtx_lock_args), (sy_call_t *)freebsd32_umtx_lock, AUE_NUL=
L, NULL, 0, 0, 0 }, /* 434 =3D freebsd32_umtx_lock */
{ AS(freebsd32_umtx_unlock_args), (sy_call_t *)freebsd32_umtx_unlock, AUE=
_NULL, NULL, 0, 0, 0 }, /* 435 =3D freebsd32_umtx_unlock */
{ AS(jail_attach_args), (sy_call_t *)jail_attach, AUE_NULL, NULL, 0, 0, 0=
}, /* 436 =3D jail_attach */
- { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 437 =3D extattr_=
list_fd */
- { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 438 =3D extattr_=
list_file */
- { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 439 =3D extattr_=
list_link */
+ { AS(extattr_list_fd_args), (sy_call_t *)extattr_list_fd, AUE_EXTATTR_LIS=
T_FD, NULL, 0, 0, 0 }, /* 437 =3D extattr_list_fd */
+ { AS(extattr_list_file_args), (sy_call_t *)extattr_list_file, AUE_EXTATTR=
_LIST_FILE, NULL, 0, 0, 0 }, /* 438 =3D extattr_list_file */
+ { AS(extattr_list_link_args), (sy_call_t *)extattr_list_link, AUE_EXTATTR=
_LIST_LINK, NULL, 0, 0, 0 }, /* 439 =3D extattr_list_link */
{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 440 =3D kse_swit=
chin */
{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 441 =3D ksem_tim=
edwait */
{ AS(freebsd32_thr_suspend_args), (sy_call_t *)freebsd32_thr_suspend, AUE=
_NULL, NULL, 0, 0, 0 }, /* 442 =3D freebsd32_thr_suspend */
diff --git a/sys/compat/freebsd32/syscalls.master b/sys/compat/freebsd32/sy=
scalls.master
index 50e30ad..7da270b 100644
--- a/sys/compat/freebsd32/syscalls.master
+++ b/sys/compat/freebsd32/syscalls.master
@@ -708,9 +708,17 @@
409 AUE_NULL UNIMPL __mac_get_pid
410 AUE_NULL UNIMPL __mac_get_link
411 AUE_NULL UNIMPL __mac_set_link
-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
+412 AUE_EXTATTR_SET_LINK NOPROTO { int extattr_set_link( \
+ const char *path, int attrnamespace, \
+ const char *attrname, void *data, \
+ size_t nbytes); }
+413 AUE_EXTATTR_GET_LINK NOPROTO { ssize_t extattr_get_link( \
+ const char *path, int attrnamespace, \
+ const char *attrname, void *data, \
+ size_t nbytes); }
+414 AUE_EXTATTR_DELETE_LINK NOPROTO { int extattr_delete_link( \
+ const char *path, int attrnamespace, \
+ const char *attrname); }
415 AUE_NULL UNIMPL __mac_execve
416 AUE_SIGACTION STD { int freebsd32_sigaction(int sig, \
struct sigaction32 *act, \
@@ -741,9 +749,15 @@
434 AUE_NULL STD { int freebsd32_umtx_lock(struct umtx *umtx); }
435 AUE_NULL STD { int freebsd32_umtx_unlock(struct umtx *umtx); }
436 AUE_NULL NOPROTO { int jail_attach(int jid); }
-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
+437 AUE_EXTATTR_LIST_FD NOPROTO { ssize_t extattr_list_fd(int fd, \
+ int attrnamespace, void *data, \
+ size_t nbytes); }
+438 AUE_EXTATTR_LIST_FILE NOPROTO { ssize_t extattr_list_file( \
+ const char *path, int attrnamespace, \
+ void *data, size_t nbytes); }
+439 AUE_EXTATTR_LIST_LINK NOPROTO { ssize_t extattr_list_link( \
+ const char *path, int attrnamespace, \
+ void *data, size_t nbytes); }
440 AUE_NULL UNIMPL kse_switchin
441 AUE_NULL UNIMPL ksem_timedwait
442 AUE_NULL STD { int freebsd32_thr_suspend( \
--ho6OhzAHcBHHvqkB
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)
iEYEARECAAYFAkopLnMACgkQC3+MBN1Mb4gC4gCfWmW/mWIMgfojzWfKWFwiegu/
ykIAoLgoTY2XWEyVlcB9Fgt0B1bFu/3o
=yw/z
-----END PGP SIGNATURE-----
--ho6OhzAHcBHHvqkB--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090605144052.GE1927>
