Message ID | e31f40f7-3b05-0540-a898-a61b94916405@linaro.org |
---|---|
State | New |
Headers | show |
Adhemerval Zanella <adhemerval.zanella@linaro.org> writes: > Below is all the fixes you proposed, if you think it is ok I will > prepare a patch and commit. Thanks. It looks like an improvement. I'd like to do some testing during the weekend. However, I suspect that this __access_noerrno may be unsafe to run during initialization of tunables on the Hurd. access_common calls __hurd_file_name_lookup, which calls __hurd_file_name_lookup_retry, which can use errno, __strtoul_internal, _itoa, strcpy, and memcmp. I'm not yet sure whether this is a problem, and I'm not asking you to spend time on it.
On 17/11/2016 22:21, Kalle Olavi Niemitalo wrote: > Adhemerval Zanella <adhemerval.zanella@linaro.org> writes: > >> Below is all the fixes you proposed, if you think it is ok I will >> prepare a patch and commit. > > Thanks. It looks like an improvement. > I'd like to do some testing during the weekend. I pushed a patch based on the RFC I sent earlier. > > However, I suspect that this __access_noerrno may be unsafe to run > during initialization of tunables on the Hurd. access_common calls > __hurd_file_name_lookup, which calls __hurd_file_name_lookup_retry, > which can use errno, __strtoul_internal, _itoa, strcpy, and memcmp. > I'm not yet sure whether this is a problem, and I'm not asking you > to spend time on it. > I think it might be an issue depending of whether errno is accessible on tunables initialization (it might be the case where is not yet relocated/allocated). Anyway I do not have a working system to actually even test a build on Hurd (the instruction at [1] points to a non bootable VM). If you could provide us with a working toolchain or a working VM to actually check hurd builds it would be valuable. Also it could be case to add a hurd configuration to build-many-glibcs.py. [1] https://www.gnu.org/software/hurd/hurd/running/qemu.html
On Saturday 19 November 2016 12:23 AM, Adhemerval Zanella wrote: > I think it might be an issue depending of whether errno is accessible > on tunables initialization (it might be the case where is not yet That is correct. Tunables initialization happens very early, earlier than TLS setup and errno is a TLS variable. Siddhesh
diff --git a/hurd/hurd.h b/hurd/hurd.h index c089d4c..ec07827 100644 --- a/hurd/hurd.h +++ b/hurd/hurd.h @@ -75,35 +75,6 @@ __hurd_fail (error_t err) errno = err; return -1; } - -_HURD_H_EXTERN_INLINE int -__hurd_fail_noerrno (error_t err) -{ - switch (err) - { - case EMACH_SEND_INVALID_DEST: - case EMIG_SERVER_DIED: - /* The server has disappeared! */ - err = EIEIO; - break; - - case KERN_NO_SPACE: - err = ENOMEM; - break; - - case KERN_INVALID_ARGUMENT: - err = EINVAL; - break; - - case 0: - return 0; - - default: - break; - } - - return -1; -} /* Basic ports and info, initialized by startup. */ diff --git a/include/unistd.h b/include/unistd.h index 6144f41..16d68a1 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -183,7 +183,8 @@ extern int __getlogin_r_loginuid (char *name, size_t namesize) # if IS_IN (rtld) || !defined SHARED /* __access variant that does not set errno. Used in very early initialization - code in libc.a and ld.so. */ + code in libc.a and ld.so. It follows access return semantics (zero for + sucess otherwise a value different than 0). */ extern __typeof (__access) __access_noerrno attribute_hidden; # endif diff --git a/sysdeps/mach/hurd/access.c b/sysdeps/mach/hurd/access.c index 93e2166..66bf7d5 100644 --- a/sysdeps/mach/hurd/access.c +++ b/sysdeps/mach/hurd/access.c @@ -31,7 +31,7 @@ hurd_fail_seterrno (error_t err) static int hurd_fail_noerrno (error_t err) { - return __hurd_fail_noerrno (err); + return -1; } static int @@ -149,7 +149,7 @@ access_common (const char *file, int type, int (*errfunc) (error_t)) if (flags & ~allowed) /* We are not allowed all the requested types of access. */ - return errfunc (EACESS); + return errfunc (EACCES); return 0; }