Re: svn commit: r357530 - head/sys/kern
ср, 5 февр. 2020 г. в 00:02, Konstantin Belousov : > Author: kib > Date: Tue Feb 4 21:02:08 2020 > New Revision: 357530 > URL: https://svnweb.freebsd.org/changeset/base/357530 > > Log: > Remove unneeded assert for curproc. Simplify. > > Reported by: syzkaller by markj > Sponsored by: The FreeBSD Foundation > > Modified: > head/sys/kern/kern_time.c > > Modified: head/sys/kern/kern_time.c > > == > --- head/sys/kern/kern_time.c Tue Feb 4 20:40:45 2020(r357529) > +++ head/sys/kern/kern_time.c Tue Feb 4 21:02:08 2020(r357530) > @@ -254,11 +254,8 @@ void > kern_thread_cputime(struct thread *targettd, struct timespec *ats) > { > uint64_t runtime, curtime, switchtime; > - struct proc *p; > > if (targettd == NULL) { /* current thread */ > - p = curthread->td_proc; > - PROC_LOCK_ASSERT(p, MA_OWNED); > critical_enter(); > switchtime = PCPU_GET(switchtime); > curtime = cpu_ticks(); > @@ -266,8 +263,7 @@ kern_thread_cputime(struct thread *targettd, struct ti > critical_exit(); > runtime += curtime - switchtime; > } else { > - p = targettd->td_proc; > - PROC_LOCK_ASSERT(p, MA_OWNED); > + PROC_LOCK_ASSERT(targettd->td_proc, MA_OWNED); > thread_lock(targettd); > runtime = targettd->td_runtime; > thread_unlock(targettd); > 10x ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r357493 - head/sys/compat/linux
Author: dchagin Date: Tue Feb 4 05:27:05 2020 New Revision: 357493 URL: https://svnweb.freebsd.org/changeset/base/357493 Log: Fix clock_gettime() and clock_getres() for cpu clocks: - handle the CLOCK_{PROCESS,THREAD}_CPUTIME_ID specified directly; - fix thread id calculation as in the Linuxulator we should convert the user supplied thread id to struct thread * by linux_tdfind(); - fix CPUCLOCK_SCHED case by using kern_{process,thread}_cputime() directly as native get_cputime() used by kern_clock_gettime() uses native tdfind()/pfind() to find proccess/thread. PR: 240990 Reviewed by: kib Differential Revision:https://reviews.freebsd.org/D23341 MFC after:2 weeks Modified: head/sys/compat/linux/linux_time.c Modified: head/sys/compat/linux/linux_time.c == --- head/sys/compat/linux/linux_time.c Tue Feb 4 05:25:51 2020 (r357492) +++ head/sys/compat/linux/linux_time.c Tue Feb 4 05:27:05 2020 (r357493) @@ -65,6 +65,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_time.c,v 1.14 2006/0 #endif #include +#include #include /* DTrace init */ @@ -203,6 +204,12 @@ linux_to_native_clockid(clockid_t *n, clockid_t l) case LINUX_CLOCK_MONOTONIC: *n = CLOCK_MONOTONIC; break; + case LINUX_CLOCK_PROCESS_CPUTIME_ID: + *n = CLOCK_PROCESS_CPUTIME_ID; + break; + case LINUX_CLOCK_THREAD_CPUTIME_ID: + *n = CLOCK_THREAD_CPUTIME_ID; + break; case LINUX_CLOCK_REALTIME_COARSE: *n = CLOCK_REALTIME_FAST; break; @@ -269,8 +276,13 @@ linux_clock_gettime(struct thread *td, struct linux_cl switch (nwhich) { case CLOCK_PROCESS_CPUTIME_ID: - clockwhich = LINUX_CPUCLOCK_WHICH(args->which); - pid = LINUX_CPUCLOCK_ID(args->which); + if (args->which < 0) { + clockwhich = LINUX_CPUCLOCK_WHICH(args->which); + pid = LINUX_CPUCLOCK_ID(args->which); + } else { + clockwhich = LINUX_CPUCLOCK_SCHED; + pid = 0; + } if (pid == 0) { p = td->td_proc; PROC_LOCK(p); @@ -296,12 +308,8 @@ linux_clock_gettime(struct thread *td, struct linux_cl TIMEVAL_TO_TIMESPEC(_utime, ); break; case LINUX_CPUCLOCK_SCHED: + kern_process_cputime(p, ); PROC_UNLOCK(p); - error = kern_clock_getcpuclockid2(td, pid, - CPUCLOCK_WHICH_PID, ); - if (error != 0) - return (EINVAL); - error = kern_clock_gettime(td, nwhich, ); break; default: PROC_UNLOCK(p); @@ -311,14 +319,19 @@ linux_clock_gettime(struct thread *td, struct linux_cl break; case CLOCK_THREAD_CPUTIME_ID: - clockwhich = LINUX_CPUCLOCK_WHICH(args->which); + if (args->which < 0) { + clockwhich = LINUX_CPUCLOCK_WHICH(args->which); + tid = LINUX_CPUCLOCK_ID(args->which); + } else { + clockwhich = LINUX_CPUCLOCK_SCHED; + tid = 0; + } p = td->td_proc; - tid = LINUX_CPUCLOCK_ID(args->which); if (tid == 0) { targettd = td; PROC_LOCK(p); } else { - targettd = tdfind(tid, p->p_pid); + targettd = linux_tdfind(td, tid, p->p_pid); if (targettd == NULL) return (EINVAL); } @@ -343,12 +356,10 @@ linux_clock_gettime(struct thread *td, struct linux_cl TIMEVAL_TO_TIMESPEC(_utime, ); break; case LINUX_CPUCLOCK_SCHED: - error = kern_clock_getcpuclockid2(td, tid, - CPUCLOCK_WHICH_TID, ); + if (td == targettd) + targettd = NULL; + kern_thread_cputime(targettd, ); PROC_UNLOCK(p); - if (error != 0) - return (EINVAL); - error = kern_clock_gettime(td, nwhich, ); break; default: PROC_UNLOCK(p); @@ -440,25 +451,27 @@ linux_clock_getres(struct thread *td, struct linux_clo * Check user supplied clock id in case of per-process * or thread-specific cpu-time clock.
svn commit: r357492 - in head/sys: kern sys
Author: dchagin Date: Tue Feb 4 05:25:51 2020 New Revision: 357492 URL: https://svnweb.freebsd.org/changeset/base/357492 Log: For code reuse in Linuxulator rename get_proccess_cputime() and get_thread_cputime() and add prototypes for it to . As both functions become a public interface add process lock assert to ensure that the process is not exiting under it. Fix whitespace nit while here. Reviewed by: kib Differential Revision:https://reviews.freebsd.org/D23340 MFC after 2 weeks Modified: head/sys/kern/kern_time.c head/sys/sys/syscallsubr.h Modified: head/sys/kern/kern_time.c == --- head/sys/kern/kern_time.c Tue Feb 4 05:23:34 2020(r357491) +++ head/sys/kern/kern_time.c Tue Feb 4 05:25:51 2020(r357492) @@ -242,7 +242,7 @@ sys_clock_gettime(struct thread *td, struct clock_gett return (error); } -static inline void +static inline void cputick2timespec(uint64_t runtime, struct timespec *ats) { runtime = cputick2usec(runtime); @@ -250,12 +250,15 @@ cputick2timespec(uint64_t runtime, struct timespec *at ats->tv_nsec = runtime % 100 * 1000; } -static void -get_thread_cputime(struct thread *targettd, struct timespec *ats) +void +kern_thread_cputime(struct thread *targettd, struct timespec *ats) { uint64_t runtime, curtime, switchtime; + struct proc *p; if (targettd == NULL) { /* current thread */ + p = curthread->td_proc; + PROC_LOCK_ASSERT(p, MA_OWNED); critical_enter(); switchtime = PCPU_GET(switchtime); curtime = cpu_ticks(); @@ -263,6 +266,8 @@ get_thread_cputime(struct thread *targettd, struct tim critical_exit(); runtime += curtime - switchtime; } else { + p = targettd->td_proc; + PROC_LOCK_ASSERT(p, MA_OWNED); thread_lock(targettd); runtime = targettd->td_runtime; thread_unlock(targettd); @@ -270,12 +275,13 @@ get_thread_cputime(struct thread *targettd, struct tim cputick2timespec(runtime, ats); } -static void -get_process_cputime(struct proc *targetp, struct timespec *ats) +void +kern_process_cputime(struct proc *targetp, struct timespec *ats) { uint64_t runtime; struct rusage ru; + PROC_LOCK_ASSERT(targetp, MA_OWNED); PROC_STATLOCK(targetp); rufetch(targetp, ); runtime = targetp->p_rux.rux_runtime; @@ -300,14 +306,14 @@ get_cputime(struct thread *td, clockid_t clock_id, str td2 = tdfind(tid, p->p_pid); if (td2 == NULL) return (EINVAL); - get_thread_cputime(td2, ats); + kern_thread_cputime(td2, ats); PROC_UNLOCK(td2->td_proc); } else { pid = clock_id & CPUCLOCK_ID_MASK; error = pget(pid, PGET_CANSEE, ); if (error != 0) return (EINVAL); - get_process_cputime(p2, ats); + kern_process_cputime(p2, ats); PROC_UNLOCK(p2); } return (0); @@ -360,11 +366,11 @@ kern_clock_gettime(struct thread *td, clockid_t clock_ ats->tv_nsec = 0; break; case CLOCK_THREAD_CPUTIME_ID: - get_thread_cputime(NULL, ats); + kern_thread_cputime(NULL, ats); break; case CLOCK_PROCESS_CPUTIME_ID: PROC_LOCK(p); - get_process_cputime(p, ats); + kern_process_cputime(p, ats); PROC_UNLOCK(p); break; default: Modified: head/sys/sys/syscallsubr.h == --- head/sys/sys/syscallsubr.h Tue Feb 4 05:23:34 2020(r357491) +++ head/sys/sys/syscallsubr.h Tue Feb 4 05:25:51 2020(r357492) @@ -91,6 +91,8 @@ int kern_clock_nanosleep(struct thread *td, clockid_t const struct timespec *rqtp, struct timespec *rmtp); intkern_clock_settime(struct thread *td, clockid_t clock_id, struct timespec *ats); +void kern_thread_cputime(struct thread *targettd, struct timespec *ats); +void kern_process_cputime(struct proc *targetp, struct timespec *ats); intkern_close(struct thread *td, int fd); intkern_connectat(struct thread *td, int dirfd, int fd, struct sockaddr *sa); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r357491 - head/sys/compat/linux
Author: dchagin Date: Tue Feb 4 05:23:34 2020 New Revision: 357491 URL: https://svnweb.freebsd.org/changeset/base/357491 Log: linux_to_native_clockid() properly initializes nwhich variable (or return error), so don't initialize nwhich in declaration and remove stale comment from r161304. Reviewed by: emaste Differential Revision:https://reviews.freebsd.org/D23339 MFC after:2 weeks Modified: head/sys/compat/linux/linux_time.c Modified: head/sys/compat/linux/linux_time.c == --- head/sys/compat/linux/linux_time.c Tue Feb 4 04:29:54 2020 (r357490) +++ head/sys/compat/linux/linux_time.c Tue Feb 4 05:23:34 2020 (r357491) @@ -253,7 +253,7 @@ linux_clock_gettime(struct thread *td, struct linux_cl struct thread *targettd; struct proc *p; int error, clockwhich; - clockid_t nwhich = 0; /* XXX: GCC */ + clockid_t nwhich; pid_t pid; lwpid_t tid; @@ -382,7 +382,7 @@ linux_clock_settime(struct thread *td, struct linux_cl struct timespec ts; struct l_timespec lts; int error; - clockid_t nwhich = 0; /* XXX: GCC */ + clockid_t nwhich; LIN_SDT_PROBE2(time, linux_clock_settime, entry, args->which, args->tp); @@ -422,7 +422,7 @@ linux_clock_getres(struct thread *td, struct linux_clo struct timespec ts; struct l_timespec lts; int error, clockwhich; - clockid_t nwhich = 0; /* XXX: GCC */ + clockid_t nwhich; pid_t pid; lwpid_t tid; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r356241 - in head/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux
Hi, HNY! What about vdso? ср, 1 янв. 2020 г. в 01:01, Edward Tomasz Napierala : > Author: trasz > Date: Tue Dec 31 22:01:08 2019 > New Revision: 356241 > URL: https://svnweb.freebsd.org/changeset/base/356241 > > Log: > Add basic getcpu(2) support to linuxulator. The purpose of this > syscall is to query the CPU number and the NUMA domain the calling > thread is currently running on. The third argument is ignored. > It doesn't do anything regarding scheduling - it's literally > just a way to query the current state, without any guarantees > you won't get rescheduled an opcode later. > > This unbreaks Java from CentOS 8 > (java-11-openjdk-11.0.5.10-0.el8_0.x86_64). > > Reviewed by: kib > MFC after:2 weeks > Sponsored by: The FreeBSD Foundation > Differential Revision:https://reviews.freebsd.org/D22972 > > Modified: > head/sys/amd64/linux/linux_dummy.c > head/sys/amd64/linux32/linux32_dummy.c > head/sys/arm64/linux/linux_dummy.c > head/sys/compat/linux/linux_misc.c > head/sys/i386/linux/linux_dummy.c > > Modified: head/sys/amd64/linux/linux_dummy.c > > == > --- head/sys/amd64/linux/linux_dummy.c Tue Dec 31 18:58:29 2019 > (r356240) > +++ head/sys/amd64/linux/linux_dummy.c Tue Dec 31 22:01:08 2019 > (r356241) > @@ -102,8 +102,6 @@ DUMMY(tee); > DUMMY(vmsplice); > /* Linux 2.6.18: */ > DUMMY(move_pages); > -/* Linux 2.6.19: */ > -DUMMY(getcpu); > /* Linux 2.6.22: */ > DUMMY(signalfd); > /* Linux 2.6.27: */ > > Modified: head/sys/amd64/linux32/linux32_dummy.c > > == > --- head/sys/amd64/linux32/linux32_dummy.c Tue Dec 31 18:58:29 2019 > (r356240) > +++ head/sys/amd64/linux32/linux32_dummy.c Tue Dec 31 22:01:08 2019 > (r356241) > @@ -108,8 +108,6 @@ DUMMY(tee); > DUMMY(vmsplice); > /* Linux 2.6.18: */ > DUMMY(move_pages); > -/* Linux 2.6.19: */ > -DUMMY(getcpu); > /* Linux 2.6.22: */ > DUMMY(signalfd); > /* Linux 2.6.27: */ > > Modified: head/sys/arm64/linux/linux_dummy.c > > == > --- head/sys/arm64/linux/linux_dummy.c Tue Dec 31 18:58:29 2019 > (r356240) > +++ head/sys/arm64/linux/linux_dummy.c Tue Dec 31 22:01:08 2019 > (r356241) > @@ -104,8 +104,6 @@ DUMMY(tee); > DUMMY(vmsplice); > /* Linux 2.6.18: */ > DUMMY(move_pages); > -/* Linux 2.6.19: */ > -DUMMY(getcpu); > /* Linux 2.6.27: */ > DUMMY(signalfd4); > DUMMY(inotify_init1); > > Modified: head/sys/compat/linux/linux_misc.c > > == > --- head/sys/compat/linux/linux_misc.c Tue Dec 31 18:58:29 2019 > (r356240) > +++ head/sys/compat/linux/linux_misc.c Tue Dec 31 22:01:08 2019 > (r356241) > @@ -2353,3 +2353,19 @@ out: > td->td_retval[0] = dst - args->buf; > return (error); > } > + > +int > +linux_getcpu(struct thread *td, struct linux_getcpu_args *args) > +{ > + int cpu, error, node; > + > + cpu = td->td_oncpu; /* Make sure it doesn't change during > copyout(9) */ > + error = 0; > + node = 0; /* XXX: Fake NUMA node 0 for now */ > + > + if (args->cpu != NULL) > + error = copyout(, args->cpu, sizeof(l_int)); > + if (args->node != NULL) > + error = copyout(, args->node, sizeof(l_int)); > + return (error); > +} > > Modified: head/sys/i386/linux/linux_dummy.c > > == > --- head/sys/i386/linux/linux_dummy.c Tue Dec 31 18:58:29 2019 > (r356240) > +++ head/sys/i386/linux/linux_dummy.c Tue Dec 31 22:01:08 2019 > (r356241) > @@ -104,8 +104,6 @@ DUMMY(tee); > DUMMY(vmsplice); > /* Linux 2.6.18: */ > DUMMY(move_pages); > -/* Linux 2.6.19: */ > -DUMMY(getcpu); > /* Linux 2.6.22: */ > DUMMY(signalfd); > /* Linux 2.6.27: */ > ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r346603 - in head/sys: amd64/linux32 i386/linux
Author: dchagin Date: Tue Apr 23 18:10:46 2019 New Revision: 346603 URL: https://svnweb.freebsd.org/changeset/base/346603 Log: Since r339624 HEAD does not need for backslashes in syscalls.master, however to make a merge r345471 to the stable add backslashes to the syscalls.master. MFC after:3 days Modified: head/sys/amd64/linux32/syscalls.master head/sys/i386/linux/syscalls.master Modified: head/sys/amd64/linux32/syscalls.master == --- head/sys/amd64/linux32/syscalls.master Tue Apr 23 17:28:28 2019 (r346602) +++ head/sys/amd64/linux32/syscalls.master Tue Apr 23 18:10:46 2019 (r346603) @@ -690,7 +690,7 @@ 383AUE_NULLSTD { int linux_statx(l_int dirfd, \ const char *pathname, l_uint flags, \ l_uint mask, void *statxbuf); } -384AUE_NULLSTD { int linux_arch_prctl(l_int option, +384AUE_NULLSTD { int linux_arch_prctl(l_int option, \ l_ulong arg2); } ; Linux 4.18: 385AUE_NULLSTD { int linux_io_pgetevents(void); } Modified: head/sys/i386/linux/syscalls.master == --- head/sys/i386/linux/syscalls.master Tue Apr 23 17:28:28 2019 (r346602) +++ head/sys/i386/linux/syscalls.master Tue Apr 23 18:10:46 2019 (r346603) @@ -698,7 +698,7 @@ 383AUE_NULLSTD { int linux_statx(l_int dirfd, \ const char *pathname, l_uint flags, \ l_uint mask, void *statxbuf); } -384AUE_PRCTL STD { int linux_arch_prctl(l_int option, +384AUE_PRCTL STD { int linux_arch_prctl(l_int option, \ l_ulong arg2); } ; Linux 4.18: 385AUE_NULLSTD { int linux_io_pgetevents(void); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r346273 - in head/sys: compat/freebsd32 kern
вт, 16 апр. 2019 г. в 16:26, Ed Maste : > Author: emaste > Date: Tue Apr 16 13:26:31 2019 > New Revision: 346273 > URL: https://svnweb.freebsd.org/changeset/base/346273 > > Log: > correct readlinkat(2) return type > > Hi, Ed make sysent? > r176215 corrected readlink(2)'s return type and the type of the last > argument. readlink(2) was introduced in r177788 after being developed > as part of Google Summer of Code 2007; it appears to have inherited the > wrong return type. > > Man pages and header files were already ssize_t; update syscalls.master > to match. > > PR: 197915 > Submitted by: Henning Petersen > MFC after:2 weeks > > Modified: > head/sys/compat/freebsd32/syscalls.master > head/sys/kern/syscalls.master > > Modified: head/sys/compat/freebsd32/syscalls.master > > == > --- head/sys/compat/freebsd32/syscalls.master Tue Apr 16 12:40:49 2019 > (r346272) > +++ head/sys/compat/freebsd32/syscalls.master Tue Apr 16 13:26:31 2019 > (r346273) > @@ -963,7 +963,7 @@ > uint32_t dev); } > 499AUE_OPENAT_RWTC NOPROTO { int openat(int fd, const char *path, \ > int flag, mode_t mode); } > -500AUE_READLINKAT NOPROTO { int readlinkat(int fd, const char *path, > \ > +500AUE_READLINKAT NOPROTO { ssize_t readlinkat(int fd, const char > *path, \ > char *buf, size_t bufsize); } > 501AUE_RENAMEATNOPROTO { int renameat(int oldfd, const char *old, > \ > int newfd, const char *new); } > > Modified: head/sys/kern/syscalls.master > > == > --- head/sys/kern/syscalls.master Tue Apr 16 12:40:49 2019 > (r346272) > +++ head/sys/kern/syscalls.master Tue Apr 16 13:26:31 2019 > (r346273) > @@ -2716,7 +2716,7 @@ > ); > } > 500AUE_READLINKAT STD { > - int readlinkat( > + ssize_t readlinkat( > int fd, > _In_z_ const char *path, > _Out_writes_bytes_(bufsize) char *buf, > > ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r348847 - head/sys/sys
Hi, All! thanks for reply, I will be back in a week and fix it, I am rafting in Eastern Siberia)) чт, 13 июня 2019 г. в 11:43, Tijl Coosemans : > On Wed, 12 Jun 2019 16:51:03 -0600 Warner Losh wrote: > > On Wed, Jun 12, 2019 at 4:49 PM Gleb Smirnoff > wrote: > >> On Mon, Jun 10, 2019 at 11:09:09AM +0200, Tijl Coosemans wrote: > Date: Mon Jun 10 05:28:03 2019 > New Revision: 348847 > URL: https://svnweb.freebsd.org/changeset/base/348847 > > Log: > Use C11 anonymous unions. > > PR: 215202 > Reported by: glebius > MFC after: 2 weeks > > Modified: > head/sys/sys/ucred.h > > Modified: head/sys/sys/ucred.h > > > == > > --- head/sys/sys/ucred.h Mon Jun 10 05:09:34 2019(r348846) > +++ head/sys/sys/ucred.h Mon Jun 10 05:28:03 2019(r348847) > @@ -89,12 +89,11 @@ struct xucred { > gid_t cr_groups[XU_NGROUPS]; /* groups */ > union { > void*_cr_unused1; /* compatibility with old ucred */ > - pid_t _pid; > - } _cr; > + pid_t cr_pid; > + }; > }; > #define XUCRED_VERSION 0 > > -#define cr_pid _cr._pid > /* This can be used for both ucred and xucred structures. */ > #define cr_gid cr_groups[0] > >>> > >>> Isn't this a userland header that should work with non-C11 compilers? > >> > >> It could make sense to keep such low bar for standard headers, but > ucred.h > >> is BSD-specific header and struct xucred is FreeBSD specific. > > > > This is solvable with proper visibility, I'd think.. > > I think "union {" should be replaced with "__extension__ union {". That > seems to kill this warning: > > /usr/include/sys/ucred.h:90:2: warning: anonymous unions are a C11 > extension > [-Wc11-extensions] > union { > ^ > 1 warning generated. > ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r348847 - head/sys/sys
Author: dchagin Date: Mon Jun 10 05:28:03 2019 New Revision: 348847 URL: https://svnweb.freebsd.org/changeset/base/348847 Log: Use C11 anonymous unions. PR: 215202 Reported by: glebius MFC after:2 weeks Modified: head/sys/sys/ucred.h Modified: head/sys/sys/ucred.h == --- head/sys/sys/ucred.hMon Jun 10 05:09:34 2019(r348846) +++ head/sys/sys/ucred.hMon Jun 10 05:28:03 2019(r348847) @@ -89,12 +89,11 @@ struct xucred { gid_t cr_groups[XU_NGROUPS]; /* groups */ union { void*_cr_unused1; /* compatibility with old ucred */ - pid_t _pid; - } _cr; + pid_t cr_pid; + }; }; #defineXUCRED_VERSION 0 -#definecr_pid _cr._pid /* This can be used for both ucred and xucred structures. */ #definecr_gid cr_groups[0] ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r348434 - head/sys/kern
Author: dchagin Date: Thu May 30 16:11:20 2019 New Revision: 348434 URL: https://svnweb.freebsd.org/changeset/base/348434 Log: Remove wrong inline keyword. Reported by: markj MFC after:1 week Modified: head/sys/kern/kern_prot.c Modified: head/sys/kern/kern_prot.c == --- head/sys/kern/kern_prot.c Thu May 30 16:04:00 2019(r348433) +++ head/sys/kern/kern_prot.c Thu May 30 16:11:20 2019(r348434) @@ -1957,7 +1957,7 @@ cru2x(struct ucred *cr, struct xucred *xcr) ngroups * sizeof(*cr->cr_groups)); } -void inline +void cru2xt(struct thread *td, struct xucred *xcr) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r348419 - in head: crypto/heimdal/lib/ipc share/man/man4 sys/compat/linux sys/kern sys/sys usr.sbin/mountd
Author: dchagin Date: Thu May 30 14:24:26 2019 New Revision: 348419 URL: https://svnweb.freebsd.org/changeset/base/348419 Log: Complete LOCAL_PEERCRED support. Cache pid of the remote process in the struct xucred. Do not bump XUCRED_VERSION as struct layout is not changed. PR: 215202 Reviewed by: tijl MFC after:1 week Differential Revision:https://reviews.freebsd.org/D20415 Modified: head/crypto/heimdal/lib/ipc/server.c head/share/man/man4/unix.4 head/sys/compat/linux/linux_socket.c head/sys/kern/kern_prot.c head/sys/kern/uipc_usrreq.c head/sys/sys/ucred.h head/usr.sbin/mountd/mountd.c Modified: head/crypto/heimdal/lib/ipc/server.c == --- head/crypto/heimdal/lib/ipc/server.cThu May 30 14:21:51 2019 (r348418) +++ head/crypto/heimdal/lib/ipc/server.cThu May 30 14:24:26 2019 (r348419) @@ -550,7 +550,7 @@ update_client_creds(struct client *c) { c->unixrights.uid = peercred.cr_uid; c->unixrights.gid = peercred.cr_gid; - c->unixrights.pid = 0; + c->unixrights.pid = peercred.cr_pid; return 1; } } Modified: head/share/man/man4/unix.4 == --- head/share/man/man4/unix.4 Thu May 30 14:21:51 2019(r348418) +++ head/share/man/man4/unix.4 Thu May 30 14:24:26 2019(r348419) @@ -310,6 +310,7 @@ struct xucred { uid_tcr_uid; /* effective user id */ shortcr_ngroups; /* number of groups */ gid_tcr_groups[XU_NGROUPS]; /* groups */ + pid_tcr_pid; /* process id of the sending process */ }; .Ed The Modified: head/sys/compat/linux/linux_socket.c == --- head/sys/compat/linux/linux_socket.cThu May 30 14:21:51 2019 (r348418) +++ head/sys/compat/linux/linux_socket.cThu May 30 14:24:26 2019 (r348419) @@ -1519,10 +1519,7 @@ linux_getsockopt(struct thread *td, struct linux_getso name, , UIO_SYSSPACE, ); if (error != 0) return (error); - /* -* XXX Use 0 for pid as the FreeBSD does not cache peer pid. -*/ - lxu.pid = 0; + lxu.pid = xu.cr_pid; lxu.uid = xu.cr_uid; lxu.gid = xu.cr_gid; return (copyout(, PTRIN(args->optval), sizeof(lxu))); Modified: head/sys/kern/kern_prot.c == --- head/sys/kern/kern_prot.c Thu May 30 14:21:51 2019(r348418) +++ head/sys/kern/kern_prot.c Thu May 30 14:24:26 2019(r348419) @@ -1957,6 +1957,14 @@ cru2x(struct ucred *cr, struct xucred *xcr) ngroups * sizeof(*cr->cr_groups)); } +void inline +cru2xt(struct thread *td, struct xucred *xcr) +{ + + cru2x(td->td_ucred, xcr); + xcr->cr_pid = td->td_proc->p_pid; +} + /* * Set initial process credentials. * Callers are responsible for providing the reference for provided credentials. Modified: head/sys/kern/uipc_usrreq.c == --- head/sys/kern/uipc_usrreq.c Thu May 30 14:21:51 2019(r348418) +++ head/sys/kern/uipc_usrreq.c Thu May 30 14:24:26 2019(r348419) @@ -912,7 +912,7 @@ uipc_listen(struct socket *so, int backlog, struct thr SOCK_LOCK(so); error = solisten_proto_check(so); if (error == 0) { - cru2x(td->td_ucred, >unp_peercred); + cru2xt(td, >unp_peercred); solisten_proto(so, backlog); } SOCK_UNLOCK(so); @@ -1656,7 +1656,7 @@ void unp_copy_peercred(struct thread *td, struct unpcb *client_unp, struct unpcb *server_unp, struct unpcb *listen_unp) { - cru2x(td->td_ucred, _unp->unp_peercred); + cru2xt(td, _unp->unp_peercred); client_unp->unp_flags |= UNP_HAVEPC; memcpy(_unp->unp_peercred, _unp->unp_peercred, @@ -2755,8 +2755,8 @@ db_print_xucred(int indent, struct xucred *xu) int comma, i; db_print_indent(indent); - db_printf("cr_version: %u cr_uid: %u cr_ngroups: %d\n", - xu->cr_version, xu->cr_uid, xu->cr_ngroups); + db_printf("cr_version: %u cr_uid: %u cr_pid: %d cr_ngroups: %d\n", + xu->cr_version, xu->cr_uid, xu->cr_pid, xu->cr_ngroups); db_print_indent(indent); db_printf("cr_groups: "); comma = 0; Modified: head/sys/sys/ucred.h == --- head/sys/sys/ucred.hThu May 30 14:21:51 2019
svn commit: r348418 - head/sys/compat/linux
Author: dchagin Date: Thu May 30 14:21:51 2019 New Revision: 348418 URL: https://svnweb.freebsd.org/changeset/base/348418 Log: Linux does not support MSG_OOB for unix(4) or non-stream oriented socket, return EOPNOTSUPP as a Linux does. Reviewed by: tijl MFC after:1 week Differential Revision:https://reviews.freebsd.org/D20409 Modified: head/sys/compat/linux/linux_socket.c Modified: head/sys/compat/linux/linux_socket.c == --- head/sys/compat/linux/linux_socket.cThu May 30 14:13:09 2019 (r348417) +++ head/sys/compat/linux/linux_socket.cThu May 30 14:21:51 2019 (r348418) @@ -939,11 +939,13 @@ linux_sendmsg_common(struct thread *td, l_int s, struc struct iovec *iov; socklen_t datalen; struct sockaddr *sa; + struct socket *so; sa_family_t sa_family; + struct file *fp; void *data; l_size_t len; l_size_t clen; - int error; + int error, fflag; error = copyin(msghdr, _msg, sizeof(linux_msg)); if (error != 0) @@ -974,12 +976,30 @@ linux_sendmsg_common(struct thread *td, l_int s, struc control = NULL; - if (linux_msg.msg_controllen >= sizeof(struct l_cmsghdr)) { - error = kern_getsockname(td, s, , ); + error = kern_getsockname(td, s, , ); + if (error != 0) + goto bad; + sa_family = sa->sa_family; + free(sa, M_SONAME); + + if (flags & LINUX_MSG_OOB) { + error = EOPNOTSUPP; + if (sa_family == AF_UNIX) + goto bad; + + error = getsock_cap(td, s, _send_rights, , + , NULL); if (error != 0) goto bad; - sa_family = sa->sa_family; - free(sa, M_SONAME); + so = fp->f_data; + if (so->so_type != SOCK_STREAM) + error = EOPNOTSUPP; + fdrop(fp, td); + if (error != 0) + goto bad; + } + + if (linux_msg.msg_controllen >= sizeof(struct l_cmsghdr)) { error = ENOBUFS; control = m_get(M_WAITOK, MT_CONTROL); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r333425 - in head/sys: cddl/compat/opensolaris/sys cddl/contrib/opensolaris/uts/common/fs/zfs compat/cloudabi compat/linux compat/linuxkpi/common/include/linux dev/filemon dev/hwpmc fs
сб, 19 мая 2018 г. в 10:31, Matthew Macy : > r333874 > > > Hi, is it possible to merge r333425, r333874, r333813, r334118 and related revs to the stable/11? ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r348096 - stable/12/sys/compat/linsysfs
Author: dchagin Date: Wed May 22 05:37:29 2019 New Revision: 348096 URL: https://svnweb.freebsd.org/changeset/base/348096 Log: MFC r347204: Adds sys/class/net devices to linsysfs. Only two interfaces are created eth0 and lo and they expose the following properties: address, addr_len, flags, ifindex, mty, tx_queue_len and type. Initial patch developed by Carlos Neira in 2017 and finished by me. MFC r347218: Remove wrong copyright line. Discussed with Carlos Neira. Modified: stable/12/sys/compat/linsysfs/linsysfs.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linsysfs/linsysfs.c == --- stable/12/sys/compat/linsysfs/linsysfs.cWed May 22 05:35:35 2019 (r348095) +++ stable/12/sys/compat/linsysfs/linsysfs.cWed May 22 05:37:29 2019 (r348096) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -44,7 +45,11 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include +#include #include #include @@ -64,6 +69,146 @@ atoi(const char *str) return (int)strtol(str, (char **)NULL, 10); } +static int +linsysfs_ifnet_addr(PFS_FILL_ARGS) +{ + struct l_sockaddr lsa; + struct ifnet *ifp; + + ifp = ifname_linux_to_bsd(td, pn->pn_parent->pn_name, NULL); + if (ifp == NULL) + return (ENOENT); + if (linux_ifhwaddr(ifp, ) != 0) + return (ENOENT); + sbuf_printf(sb, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx\n", + lsa.sa_data[0], lsa.sa_data[1], lsa.sa_data[2], + lsa.sa_data[3], lsa.sa_data[4], lsa.sa_data[5]); + return (0); +} + +static int +linsysfs_ifnet_addrlen(PFS_FILL_ARGS) +{ + + sbuf_printf(sb, "%d\n", LINUX_IFHWADDRLEN); + return (0); +} + +static int +linsysfs_ifnet_flags(PFS_FILL_ARGS) +{ + struct ifnet *ifp; + unsigned short flags; + + ifp = ifname_linux_to_bsd(td, pn->pn_parent->pn_name, NULL); + if (ifp == NULL) + return (ENOENT); + linux_ifflags(ifp, ); + sbuf_printf(sb, "0x%x\n", flags); + return (0); +} + +static int +linsysfs_ifnet_ifindex(PFS_FILL_ARGS) +{ + struct ifnet *ifp; + + ifp = ifname_linux_to_bsd(td, pn->pn_parent->pn_name, NULL); + if (ifp == NULL) + return (ENOENT); + sbuf_printf(sb, "%u\n", ifp->if_index); + return (0); +} + +static int +linsysfs_ifnet_mtu(PFS_FILL_ARGS) +{ + struct ifnet *ifp; + + ifp = ifname_linux_to_bsd(td, pn->pn_parent->pn_name, NULL); + if (ifp == NULL) + return (ENOENT); + sbuf_printf(sb, "%u\n", ifp->if_mtu); + return (0); +} + +static int +linsysfs_ifnet_tx_queue_len(PFS_FILL_ARGS) +{ + + /* XXX */ + sbuf_printf(sb, "1000\n"); + return (0); +} + +static int +linsysfs_ifnet_type(PFS_FILL_ARGS) +{ + struct l_sockaddr lsa; + struct ifnet *ifp; + + ifp = ifname_linux_to_bsd(td, pn->pn_parent->pn_name, NULL); + if (ifp == NULL) + return (ENOENT); + if (linux_ifhwaddr(ifp, ) != 0) + return (ENOENT); + sbuf_printf(sb, "%d\n", lsa.sa_family); + return (0); +} + +static void +linsysfs_listnics(struct pfs_node *dir) +{ + struct pfs_node *nic; + struct pfs_node *lo; + + nic = pfs_create_dir(dir, "eth0", NULL, NULL, NULL, 0); + + pfs_create_file(nic, "address", _ifnet_addr, + NULL, NULL, NULL, PFS_RD); + + pfs_create_file(nic, "addr_len", _ifnet_addrlen, + NULL, NULL, NULL, PFS_RD); + + pfs_create_file(nic, "flags", _ifnet_flags, + NULL, NULL, NULL, PFS_RD); + + pfs_create_file(nic, "ifindex", _ifnet_ifindex, + NULL, NULL, NULL, PFS_RD); + + pfs_create_file(nic, "mtu", _ifnet_mtu, + NULL, NULL, NULL, PFS_RD); + + pfs_create_file(nic, "tx_queue_len", _ifnet_tx_queue_len, + NULL, NULL, NULL, PFS_RD); + + pfs_create_file(nic, "type", _ifnet_type, + NULL, NULL, NULL, PFS_RD); + + lo = pfs_create_dir(dir, "lo", NULL, NULL, NULL, 0); + + pfs_create_file(lo, "address", _ifnet_addr, + NULL, NULL, NULL, PFS_RD); + + pfs_create_file(lo, "addr_len", _ifnet_addrlen, + NULL, NULL, NULL, PFS_RD); + + pfs_create_file(lo, "flags", _ifnet_flags, + NULL, NULL, NULL, PFS_RD); + + pfs_create_file(lo, "ifindex", _ifnet_ifindex, + NULL, NULL, NULL, PFS_RD); + + pfs_create_file(lo, "mtu", _ifnet_mtu, + NULL, NULL, NULL, PFS_RD); + + pfs_create_file(lo, "tx_queue_len", _ifnet_tx_queue_len, + NULL, NULL, NULL, PFS_RD); + + pfs_create_file(lo, "type", _ifnet_type, + NULL, NULL, NULL, PFS_RD); +} + /* * Filler function for proc_name */ @@ -475,6 +620,7 @@
svn commit: r348095 - stable/12/sys/compat/linux
Author: dchagin Date: Wed May 22 05:35:35 2019 New Revision: 348095 URL: https://svnweb.freebsd.org/changeset/base/348095 Log: MFC r347203: Rewrite linux_ifflags() in more readable Linuxulator style. Modified: stable/12/sys/compat/linux/linux.c stable/12/sys/compat/linux/linux.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux.c == --- stable/12/sys/compat/linux/linux.c Wed May 22 05:34:44 2019 (r348094) +++ stable/12/sys/compat/linux/linux.c Wed May 22 05:35:35 2019 (r348095) @@ -269,16 +269,30 @@ ifname_linux_to_bsd(struct thread *td, const char *lxn void linux_ifflags(struct ifnet *ifp, short *flags) { + unsigned short fl; - *flags = (ifp->if_flags | ifp->if_drv_flags) & 0x; - /* these flags have no Linux equivalent */ - *flags &= ~(IFF_DRV_OACTIVE|IFF_SIMPLEX| - IFF_LINK0|IFF_LINK1|IFF_LINK2); - /* Linux' multicast flag is in a different bit */ - if (*flags & IFF_MULTICAST) { - *flags &= ~IFF_MULTICAST; - *flags |= 0x1000; - } + fl = (ifp->if_flags | ifp->if_drv_flags) & 0x; + *flags = 0; + if (fl & IFF_UP) + *flags |= LINUX_IFF_UP; + if (fl & IFF_BROADCAST) + *flags |= LINUX_IFF_BROADCAST; + if (fl & IFF_DEBUG) + *flags |= LINUX_IFF_DEBUG; + if (fl & IFF_LOOPBACK) + *flags |= LINUX_IFF_LOOPBACK; + if (fl & IFF_POINTOPOINT) + *flags |= LINUX_IFF_POINTOPOINT; + if (fl & IFF_DRV_RUNNING) + *flags |= LINUX_IFF_RUNNING; + if (fl & IFF_NOARP) + *flags |= LINUX_IFF_NOARP; + if (fl & IFF_PROMISC) + *flags |= LINUX_IFF_PROMISC; + if (fl & IFF_ALLMULTI) + *flags |= LINUX_IFF_ALLMULTI; + if (fl & IFF_MULTICAST) + *flags |= LINUX_IFF_MULTICAST; } int Modified: stable/12/sys/compat/linux/linux.h == --- stable/12/sys/compat/linux/linux.h Wed May 22 05:34:44 2019 (r348094) +++ stable/12/sys/compat/linux/linux.h Wed May 22 05:35:35 2019 (r348095) @@ -46,6 +46,26 @@ struct l_sockaddr { #defineLINUX_ARPHRD_ETHER 1 #defineLINUX_ARPHRD_LOOPBACK 772 +/* + * net device flags + */ +#defineLINUX_IFF_UP0x0001 +#defineLINUX_IFF_BROADCAST 0x0002 +#defineLINUX_IFF_DEBUG 0x0004 +#defineLINUX_IFF_LOOPBACK 0x0008 +#defineLINUX_IFF_POINTOPOINT 0x0010 +#defineLINUX_IFF_NOTRAILERS0x0020 +#defineLINUX_IFF_RUNNING 0x0040 +#defineLINUX_IFF_NOARP 0x0080 +#defineLINUX_IFF_PROMISC 0x0100 +#defineLINUX_IFF_ALLMULTI 0x0200 +#defineLINUX_IFF_MASTER0x0400 +#defineLINUX_IFF_SLAVE 0x0800 +#defineLINUX_IFF_MULTICAST 0x1000 +#defineLINUX_IFF_PORTSEL 0x2000 +#defineLINUX_IFF_AUTOMEDIA 0x4000 +#defineLINUX_IFF_DYNAMIC 0x8000 + /* sigaltstack */ #defineLINUX_SS_ONSTACK1 #defineLINUX_SS_DISABLE2 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r348094 - stable/12/sys/compat/linux
Author: dchagin Date: Wed May 22 05:34:44 2019 New Revision: 348094 URL: https://svnweb.freebsd.org/changeset/base/348094 Log: MFC r347202: Complete r347052 (https://reviews.freebsd.org/D20137) as it it was not a final revision. Fix style issues and change bool-like variables from int to bool. Modified: stable/12/sys/compat/linux/linux.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux.c == --- stable/12/sys/compat/linux/linux.c Wed May 22 05:33:47 2019 (r348093) +++ stable/12/sys/compat/linux/linux.c Wed May 22 05:34:44 2019 (r348094) @@ -227,21 +227,22 @@ ifname_linux_to_bsd(struct thread *td, const char *lxn struct ifnet *ifp; int len, unit; char *ep; - int is_eth, is_lo, index; + int index; + bool is_eth, is_lo; for (len = 0; len < LINUX_IFNAMSIZ; ++len) - if (!isalpha(lxname[len]) || lxname[len] == 0) + if (!isalpha(lxname[len]) || lxname[len] == '\0') break; if (len == 0 || len == LINUX_IFNAMSIZ) return (NULL); /* Linux loopback interface name is lo (not lo0) */ - is_lo = (len == 2 && !strncmp(lxname, "lo", len)) ? 1 : 0; + is_lo = (len == 2 && strncmp(lxname, "lo", len) == 0); unit = (int)strtoul(lxname + len, , 10); if ((ep == NULL || ep == lxname + len || ep >= lxname + LINUX_IFNAMSIZ) && is_lo == 0) return (NULL); index = 0; - is_eth = (len == 3 && !strncmp(lxname, "eth", len)) ? 1 : 0; + is_eth = (len == 3 && strncmp(lxname, "eth", len) == 0); CURVNET_SET(TD_TO_VNET(td)); IFNET_RLOCK(); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r348093 - in stable/12/sys/modules: linux linux64
Author: dchagin Date: Wed May 22 05:33:47 2019 New Revision: 348093 URL: https://svnweb.freebsd.org/changeset/base/348093 Log: MFC r347196: The build process generates assym.inc from genassym.o, so don't forget to clean genassym.o Modified: stable/12/sys/modules/linux/Makefile stable/12/sys/modules/linux64/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/modules/linux/Makefile == --- stable/12/sys/modules/linux/MakefileWed May 22 05:32:39 2019 (r348092) +++ stable/12/sys/modules/linux/MakefileWed May 22 05:33:47 2019 (r348093) @@ -47,7 +47,8 @@ EXPORT_SYMS+= linux_ioctl_register_handler EXPORT_SYMS+= linux_ioctl_unregister_handler .endif -CLEANFILES=linux${SFX}_assym.h linux${SFX}_genassym.o linux${SFX}_locore.o +CLEANFILES=linux${SFX}_assym.h linux${SFX}_genassym.o linux${SFX}_locore.o \ + genassym.o linux${SFX}_assym.h: linux${SFX}_genassym.o sh ${SYSDIR}/kern/genassym.sh linux${SFX}_genassym.o > ${.TARGET} Modified: stable/12/sys/modules/linux64/Makefile == --- stable/12/sys/modules/linux64/Makefile Wed May 22 05:32:39 2019 (r348092) +++ stable/12/sys/modules/linux64/Makefile Wed May 22 05:33:47 2019 (r348093) @@ -21,7 +21,8 @@ SRCS+= opt_kstack_pages.h opt_nfs.h opt_hwpmc_hooks.h SRCS+= opt_apic.h .endif -CLEANFILES=linux_assym.h linux_genassym.o linux_locore.o +CLEANFILES=linux_assym.h linux_genassym.o linux_locore.o \ + genassym.o OBJS= ${VDSO}.so ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r348092 - in stable/12/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux
== 2 && !strncmp(lxname, "lo", len)) ? 1 : 0; + unit = (int)strtoul(lxname + len, , 10); + if ((ep == NULL || ep == lxname + len || ep >= lxname + LINUX_IFNAMSIZ) && + is_lo == 0) + return (NULL); + index = 0; + is_eth = (len == 3 && !strncmp(lxname, "eth", len)) ? 1 : 0; + + CURVNET_SET(TD_TO_VNET(td)); + IFNET_RLOCK(); + CK_STAILQ_FOREACH(ifp, _ifnet, if_link) { + /* +* Allow Linux programs to use FreeBSD names. Don't presume +* we never have an interface named "eth", so don't make +* the test optional based on is_eth. +*/ + if (strncmp(ifp->if_xname, lxname, LINUX_IFNAMSIZ) == 0) + break; + if (is_eth && IFP_IS_ETH(ifp) && unit == index++) + break; + if (is_lo && IFP_IS_LOOP(ifp)) + break; + } + IFNET_RUNLOCK(); + CURVNET_RESTORE(); + if (ifp != NULL && bsdname != NULL) + strlcpy(bsdname, ifp->if_xname, IFNAMSIZ); + return (ifp); +} + +void +linux_ifflags(struct ifnet *ifp, short *flags) +{ + + *flags = (ifp->if_flags | ifp->if_drv_flags) & 0x; + /* these flags have no Linux equivalent */ + *flags &= ~(IFF_DRV_OACTIVE|IFF_SIMPLEX| + IFF_LINK0|IFF_LINK1|IFF_LINK2); + /* Linux' multicast flag is in a different bit */ + if (*flags & IFF_MULTICAST) { + *flags &= ~IFF_MULTICAST; + *flags |= 0x1000; + } +} + +int +linux_ifhwaddr(struct ifnet *ifp, struct l_sockaddr *lsa) +{ + struct ifaddr *ifa; + struct sockaddr_dl *sdl; + + if (IFP_IS_LOOP(ifp)) { + bzero(lsa, sizeof(*lsa)); + lsa->sa_family = LINUX_ARPHRD_LOOPBACK; + return (0); + } + + if (!IFP_IS_ETH(ifp)) + return (ENOENT); + + CK_STAILQ_FOREACH(ifa, >if_addrhead, ifa_link) { + sdl = (struct sockaddr_dl*)ifa->ifa_addr; + if (sdl != NULL && (sdl->sdl_family == AF_LINK) && + (sdl->sdl_type == IFT_ETHER)) { + bzero(lsa, sizeof(*lsa)); + lsa->sa_family = LINUX_ARPHRD_ETHER; + bcopy(LLADDR(sdl), lsa->sa_data, LINUX_IFHWADDRLEN); + return (0); + } + } + + return (ENOENT); } Modified: stable/12/sys/compat/linux/linux.h == --- stable/12/sys/compat/linux/linux.h Wed May 22 04:51:08 2019 (r348091) +++ stable/12/sys/compat/linux/linux.h Wed May 22 05:32:39 2019 (r348092) @@ -29,6 +29,23 @@ #ifndef _LINUX_MI_H_ #define _LINUX_MI_H_ +#defineLINUX_IFHWADDRLEN 6 +#defineLINUX_IFNAMSIZ 16 + +/* + * Criteria for interface name translation + */ +#defineIFP_IS_ETH(ifp) (ifp->if_type == IFT_ETHER) +#defineIFP_IS_LOOP(ifp)(ifp->if_type == IFT_LOOP) + +struct l_sockaddr { + unsigned short sa_family; + charsa_data[14]; +}; + +#defineLINUX_ARPHRD_ETHER 1 +#defineLINUX_ARPHRD_LOOPBACK 772 + /* sigaltstack */ #defineLINUX_SS_ONSTACK1 #defineLINUX_SS_DISABLE2 Copied: stable/12/sys/compat/linux/linux_common.h (from r347052, head/sys/compat/linux/linux_common.h) == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sys/compat/linux/linux_common.h Wed May 22 05:32:39 2019 (r348092, copy of r347052, head/sys/compat/linux/linux_common.h) @@ -0,0 +1,38 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2019 Dmitry Chagin + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING
svn commit: r348058 - head/sys/compat/linux
Author: dchagin Date: Tue May 21 18:08:19 2019 New Revision: 348058 URL: https://svnweb.freebsd.org/changeset/base/348058 Log: Do not leak sa in linux_recvmsg() call if kern_recvit() fails. MFC after:1 week Modified: head/sys/compat/linux/linux_socket.c Modified: head/sys/compat/linux/linux_socket.c == --- head/sys/compat/linux/linux_socket.cTue May 21 18:05:57 2019 (r348057) +++ head/sys/compat/linux/linux_socket.cTue May 21 18:08:19 2019 (r348058) @@ -1155,7 +1155,8 @@ linux_recvmsg_common(struct thread *td, l_int s, struc if (msg->msg_name) { sa = malloc(msg->msg_namelen, M_SONAME, M_WAITOK); msg->msg_name = sa; - } + } else + sa = NULL; uiov = msg->msg_iov; msg->msg_iov = iov; @@ -1172,7 +1173,6 @@ linux_recvmsg_common(struct thread *td, l_int s, struc error = copyout(lsa, PTRIN(msg->msg_name), msg->msg_namelen); free(lsa, M_SONAME); - free(sa, M_SONAME); if (error != 0) goto bad; } @@ -1292,6 +1292,7 @@ bad: } free(iov, M_IOV); free(linux_cmsg, M_LINUX); + free(sa, M_SONAME); return (error); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r348057 - head/sys/compat/linux
Author: dchagin Date: Tue May 21 18:05:57 2019 New Revision: 348057 URL: https://svnweb.freebsd.org/changeset/base/348057 Log: Do not use uninitialised sa. Reported by: tijl@ MFC after:1 week Modified: head/sys/compat/linux/linux_socket.c Modified: head/sys/compat/linux/linux_socket.c == --- head/sys/compat/linux/linux_socket.cTue May 21 18:03:58 2019 (r348056) +++ head/sys/compat/linux/linux_socket.cTue May 21 18:05:57 2019 (r348057) @@ -1165,7 +1165,7 @@ linux_recvmsg_common(struct thread *td, l_int s, struc if (error != 0) goto bad; - if (sa) { + if (msg->msg_name) { msg->msg_name = PTRIN(linux_msg.msg_name); error = bsd_to_linux_sockaddr(sa, , msg->msg_namelen); if (error == 0) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r348056 - head/sys/compat/linux
Author: dchagin Date: Tue May 21 18:03:58 2019 New Revision: 348056 URL: https://svnweb.freebsd.org/changeset/base/348056 Log: Do not leak sa in linux_recvfrom() call if kern_recvit() fails. MFC after:1 week Modified: head/sys/compat/linux/linux_socket.c Modified: head/sys/compat/linux/linux_socket.c == --- head/sys/compat/linux/linux_socket.cTue May 21 16:36:28 2019 (r348055) +++ head/sys/compat/linux/linux_socket.cTue May 21 18:03:58 2019 (r348056) @@ -908,7 +908,7 @@ linux_recvfrom(struct thread *td, struct linux_recvfro error = kern_recvit(td, args->s, , UIO_SYSSPACE, NULL); if (error != 0) - return (error); + goto out; if (PTRIN(args->from) != NULL) { error = bsd_to_linux_sockaddr(sa, , msg.msg_namelen); @@ -921,7 +921,7 @@ linux_recvfrom(struct thread *td, struct linux_recvfro if (error == 0 && PTRIN(args->fromlen) != NULL) error = copyout(_namelen, PTRIN(args->fromlen), sizeof(msg.msg_namelen)); - +out: free(sa, M_SONAME); return (error); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r347533 - in head/sys: compat/linux modules/linux_common
вс, 19 мая 2019 г. в 20:05, Tijl Coosemans : > On Mon, 13 May 2019 17:48:16 + (UTC) Dmitry Chagin > wrote: > > Author: dchagin > > Date: Mon May 13 17:48:16 2019 > > New Revision: 347533 > > URL: https://svnweb.freebsd.org/changeset/base/347533 > > > > Log: > > Our bsd_to_linux_sockaddr() and linux_to_bsd_sockaddr() functions > > alter the userspace sockaddr to convert the format between linux and > BSD versions. > > That's the minimum 3 of copyin/copyout operations for one syscall. > > > > Also some syscall uses linux_sa_put() and linux_getsockaddr() when load > > sockaddr to userspace or from userspace accordingly. > > > > To avoid this chaos, especially converting sockaddr in the userspace, > > rewrite these 4 functions to convert sockaddr only in kernel and leave > > only 2 of this functions. > > > > Also in order to reduce duplication between MD parts of the > Linuxulator put > > struct sockaddr conversion functions that are MI out into linux_common > module. > > > > PR: 232920 > > MFC after: 2 weeks > > Differential Revision: https://reviews.freebsd.org/D20157 > > > > Modified: > > head/sys/compat/linux/linux.c > > head/sys/compat/linux/linux.h > > head/sys/compat/linux/linux_common.h > > head/sys/compat/linux/linux_socket.c > > head/sys/compat/linux/linux_socket.h > > head/sys/modules/linux_common/Makefile > > > > Modified: head/sys/compat/linux/linux_socket.c > > > == > > --- head/sys/compat/linux/linux_socket.c Mon May 13 16:38:48 2019 > (r347532) > > +++ head/sys/compat/linux/linux_socket.c Mon May 13 17:48:16 2019 > (r347533) > > @@ -1282,6 +1110,8 @@ linux_recvmsg_common(struct thread *td, l_int s, > struc > > struct mbuf *control = NULL; > > struct mbuf **controlp; > > struct timeval *ftmvl; > > + struct l_sockaddr *lsa; > > + struct sockaddr *sa; > > l_timeval ltmvl; > > caddr_t outbuf; > > void *data; > > @@ -1305,36 +1135,34 @@ linux_recvmsg_common(struct thread *td, l_int s, > struc > > return (error); > > > > if (msg->msg_name) { > > - error = linux_to_bsd_sockaddr((struct sockaddr > *)msg->msg_name, > > - msg->msg_namelen); > > - if (error != 0) > > - goto bad; > > + sa = malloc(msg->msg_namelen, M_SONAME, M_WAITOK); > > + msg->msg_name = sa; > > } > > > > uiov = msg->msg_iov; > > msg->msg_iov = iov; > > controlp = (msg->msg_control != NULL) ? : NULL; > > - error = kern_recvit(td, s, msg, UIO_USERSPACE, controlp); > > + error = kern_recvit(td, s, msg, UIO_SYSSPACE, controlp); > > msg->msg_iov = uiov; > > if (error != 0) > > goto bad; > > > > - error = bsd_to_linux_msghdr(msg, _msg); > > - if (error != 0) > > - goto bad; > > - > > - if (linux_msg.msg_name) { > > - error = bsd_to_linux_sockaddr((struct sockaddr *) > > - PTRIN(linux_msg.msg_name)); > > + if (sa) { > > sa may be uninitialised here. > yes, I see. thank you. also sa leaks if kern_recvit() returns error. will fix ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r347969 - head/sys/compat/linux
Author: dchagin Date: Sun May 19 09:23:20 2019 New Revision: 347969 URL: https://svnweb.freebsd.org/changeset/base/347969 Log: Linux send() call returns EAGAIN instead of ENOTCONN in case when the socket is non-blocking and connect() is not finished yet. Initial patch developed by Steven Hartland in 2008 and adopted by me. PR: 129169 Reported by: smh@ MFC after:2 weeks Modified: head/sys/compat/linux/linux_socket.c Modified: head/sys/compat/linux/linux_socket.c == --- head/sys/compat/linux/linux_socket.cSun May 19 09:18:09 2019 (r347968) +++ head/sys/compat/linux/linux_socket.cSun May 19 09:23:20 2019 (r347969) @@ -798,6 +798,8 @@ linux_send(struct thread *td, struct linux_send_args * caddr_t to; int tolen; } */ bsd_args; + struct file *fp; + int error, fflag; bsd_args.s = args->s; bsd_args.buf = (caddr_t)PTRIN(args->msg); @@ -805,7 +807,21 @@ linux_send(struct thread *td, struct linux_send_args * bsd_args.flags = args->flags; bsd_args.to = NULL; bsd_args.tolen = 0; - return (sys_sendto(td, _args)); + error = sys_sendto(td, _args); + if (error == ENOTCONN) { + /* +* Linux doesn't return ENOTCONN for non-blocking sockets. +* Instead it returns the EAGAIN. +*/ + error = getsock_cap(td, args->s, _send_rights, , + , NULL); + if (error == 0) { + if (fflag & FNONBLOCK) + error = EAGAIN; + fdrop(fp, td); + } + } + return (error); } struct linux_recv_args { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r347695 - in head/sys: amd64/amd64 amd64/include kern
сб, 18 мая 2019 г. в 11:44, Konstantin Belousov : > On Sat, May 18, 2019 at 11:35:29AM +0300, Dmitry Chagin wrote: > > чт, 16 мая 2019 г. в 16:29, Konstantin Belousov : > > > > > Author: kib > > > Date: Thu May 16 13:28:48 2019 > > > New Revision: 347695 > > > URL: https://svnweb.freebsd.org/changeset/base/347695 > > > > > > Log: > > > amd64 pmap: rework delayed invalidation, removing global mutex. > > > > > > For machines having cmpxcgh16b instruction, i.e. everything but very > > > early Athlons, provide lockless implementation of delayed > > > invalidation. > > > > > > The implementation maintains lock-less single-linked list with the > > > trick from the T.L. Harris article about volatile mark of the > elements > > > being removed. Double-CAS is used to atomically update both link and > > > generation. New thread starting DI appends itself to the end of the > > > queue, setting the generation to the generation of the last element > > > +1. On DI finish, thread donates its generation to the previous > > > element. The generation of the fake head of the list is the last > > > passed DI generation. Basically, the implementation is a queued > > > spinlock but without spinlock. > > > > > > > > > > Hi, Kostik! First of all thanks for the previous help. > > Second, this commit broke i915kms module. Unfortunatelly, > > I can't give you a lot of information becouse I see only black screen, > > but I can help with testing > Did you recompiled the module ? > I use pkg, but after your mail, yes, compiled drm-current-kmod root@mordor:~ # kldstat Id Refs AddressSize Name 14 0x8020 1d536e0 kernel 21 0x81f54000 11e8 acpi_call.ko root@mordor:~ # kldload i915kms sysctl_warn_reuse: can't re-use a leaf (compat.linuxkpi.debug)! drmn1: on vgapci1 device_attach: drmn1 attach returned 19 root@mordor:~ so, I'll ping freebsd-x11 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r347695 - in head/sys: amd64/amd64 amd64/include kern
чт, 16 мая 2019 г. в 16:29, Konstantin Belousov : > Author: kib > Date: Thu May 16 13:28:48 2019 > New Revision: 347695 > URL: https://svnweb.freebsd.org/changeset/base/347695 > > Log: > amd64 pmap: rework delayed invalidation, removing global mutex. > > For machines having cmpxcgh16b instruction, i.e. everything but very > early Athlons, provide lockless implementation of delayed > invalidation. > > The implementation maintains lock-less single-linked list with the > trick from the T.L. Harris article about volatile mark of the elements > being removed. Double-CAS is used to atomically update both link and > generation. New thread starting DI appends itself to the end of the > queue, setting the generation to the generation of the last element > +1. On DI finish, thread donates its generation to the previous > element. The generation of the fake head of the list is the last > passed DI generation. Basically, the implementation is a queued > spinlock but without spinlock. > > Hi, Kostik! First of all thanks for the previous help. Second, this commit broke i915kms module. Unfortunatelly, I can't give you a lot of information becouse I see only black screen, but I can help with testing > Many thanks both to Peter Holm and Mark Johnson for keeping with me > while I produced intermediate versions of the patch. > > Reviewed by: markj > Tested by:pho > Sponsored by: The FreeBSD Foundation > MFC after:1 month > MFC note: td_md.md_invl_gen should go to the end of struct thread > Differential revision:https://reviews.freebsd.org/D19630 > > Modified: > head/sys/amd64/amd64/pmap.c > head/sys/amd64/amd64/trap.c > head/sys/amd64/amd64/vm_machdep.c > head/sys/amd64/include/pmap.h > head/sys/amd64/include/proc.h > head/sys/kern/kern_thread.c > > Modified: head/sys/amd64/amd64/pmap.c > > == > --- head/sys/amd64/amd64/pmap.c Thu May 16 13:17:57 2019(r347694) > +++ head/sys/amd64/amd64/pmap.c Thu May 16 13:28:48 2019(r347695) > @@ -107,6 +107,7 @@ __FBSDID("$FreeBSD$"); > * and to when physical maps must be made correct. > */ > > +#include "opt_ddb.h" > #include "opt_pmap.h" > #include "opt_vm.h" > > @@ -130,6 +131,10 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#ifdef DDB > +#include > +#include > +#endif > > #include > #include > @@ -468,22 +473,46 @@ SYSCTL_PROC(_vm_pmap, OID_AUTO, pcid_save_cnt, > CTLTYPE > static LIST_HEAD(, pmap_invl_gen) pmap_invl_gen_tracker = > LIST_HEAD_INITIALIZER(_invl_gen_tracker); > static struct mtx invl_gen_mtx; > -static u_long pmap_invl_gen = 0; > /* Fake lock object to satisfy turnstiles interface. */ > static struct lock_object invl_gen_ts = { > .lo_name = "invlts", > }; > +static struct pmap_invl_gen pmap_invl_gen_head = { > + .gen = 1, > + .next = NULL, > +}; > +static u_long pmap_invl_gen = 1; > > +#definePMAP_ASSERT_NOT_IN_DI() \ > +KASSERT(pmap_not_in_di(), ("DI already started")) > + > +static bool pmap_not_in_di_l(void); > +static bool pmap_not_in_di_u(void); > +DEFINE_IFUNC(, bool, pmap_not_in_di, (void), static) > +{ > + > + return ((cpu_feature2 & CPUID2_CX16) == 0 ? pmap_not_in_di_l : > + pmap_not_in_di_u); > +} > + > static bool > -pmap_not_in_di(void) > +pmap_not_in_di_l(void) > { > + struct pmap_invl_gen *invl_gen; > > - return (curthread->td_md.md_invl_gen.gen == 0); > + invl_gen = >td_md.md_invl_gen; > + return (invl_gen->gen == 0); > } > > -#definePMAP_ASSERT_NOT_IN_DI() \ > -KASSERT(pmap_not_in_di(), ("DI already started")) > +static void > +pmap_thread_init_invl_gen_l(struct thread *td) > +{ > + struct pmap_invl_gen *invl_gen; > > + invl_gen = >td_md.md_invl_gen; > + invl_gen->gen = 0; > +} > + > /* > * Start a new Delayed Invalidation (DI) block of code, executed by > * the current thread. Within a DI block, the current thread may > @@ -493,7 +522,7 @@ pmap_not_in_di(void) > * pmap active. > */ > static void > -pmap_delayed_invl_started(void) > +pmap_delayed_invl_started_l(void) > { > struct pmap_invl_gen *invl_gen; > u_long currgen; > @@ -525,7 +554,7 @@ pmap_delayed_invl_started(void) > * current thread's DI. > */ > static void > -pmap_delayed_invl_finished(void) > +pmap_delayed_invl_finished_l(void) > { > struct pmap_invl_gen *invl_gen, *next; > struct turnstile *ts; > @@ -551,7 +580,285 @@ pmap_delayed_invl_finished(void) > invl_gen->gen = 0; > } > > +static bool > +pmap_not_in_di_u(void) > +{ > + struct pmap_invl_gen *invl_gen; > + > + invl_gen = >td_md.md_invl_gen; > + return (((uintptr_t)invl_gen->next & PMAP_INVL_GEN_NEXT_INVALID) > != 0); > +} > + > +static void > +pmap_thread_init_invl_gen_u(struct thread *td) > +{ > + struct pmap_invl_gen *invl_gen;
svn commit: r347684 - stable/11/sys/compat/linsysfs
Author: dchagin Date: Thu May 16 10:43:52 2019 New Revision: 347684 URL: https://svnweb.freebsd.org/changeset/base/347684 Log: MFC r347016: Remove unneeded includes. Modified: stable/11/sys/compat/linsysfs/linsysfs.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linsysfs/linsysfs.c == --- stable/11/sys/compat/linsysfs/linsysfs.cThu May 16 10:41:29 2019 (r347683) +++ stable/11/sys/compat/linsysfs/linsysfs.cThu May 16 10:43:52 2019 (r347684) @@ -29,22 +29,13 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include -#include -#include -#include #include -#include #include #include -#include #include -#include #include #include #include -#include #include #include @@ -53,17 +44,6 @@ __FBSDID("$FreeBSD$"); #include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include #include #include ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r347683 - stable/12/sys/compat/linsysfs
Author: dchagin Date: Thu May 16 10:41:29 2019 New Revision: 347683 URL: https://svnweb.freebsd.org/changeset/base/347683 Log: MFC r347016: Remove unneeded includes. Modified: stable/12/sys/compat/linsysfs/linsysfs.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linsysfs/linsysfs.c == --- stable/12/sys/compat/linsysfs/linsysfs.cThu May 16 09:49:19 2019 (r347682) +++ stable/12/sys/compat/linsysfs/linsysfs.cThu May 16 10:41:29 2019 (r347683) @@ -31,22 +31,12 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include -#include -#include -#include #include -#include #include #include -#include -#include -#include #include #include #include -#include #include #include @@ -55,17 +45,6 @@ __FBSDID("$FreeBSD$"); #include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include #include #include ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r347566 - in head/sys: amd64/amd64 amd64/include dev/cpuctl i386/i386 i386/include x86/include x86/x86
ср, 15 мая 2019 г. в 11:10, Konstantin Belousov : > On Wed, May 15, 2019 at 08:54:04AM +0300, Dmitry Chagin wrote: > > вт, 14 мая 2019 г. в 20:02, Konstantin Belousov : > > > > > Author: kib > > > Date: Tue May 14 17:02:20 2019 > > > New Revision: 347566 > > > URL: https://svnweb.freebsd.org/changeset/base/347566 > > > > > > Log: > > > Mitigations for Microarchitectural Data Sampling. > > > > > > Microarchitectural buffers on some Intel processors utilizing > > > speculative execution may allow a local process to obtain a memory > > > disclosure. An attacker may be able to read secret data from the > > > kernel or from a process when executing untrusted code (for example, > > > in a web browser). > > > > > > Reference: > > > > https://www.intel.com/content/www/us/en/security-center/advisory/intel-sa-00233.html > > > Security: CVE-2018-12126, CVE-2018-12127, CVE-2018-12130, > > > CVE-2019-11091 > > > Security: FreeBSD-SA-19:07.mds > > > Reviewed by: jhb > > > Tested by:emaste, lwhsu > > > Approved by: so (gtetlow) > > > > > > Modified: > > > head/sys/amd64/amd64/exception.S > > > head/sys/amd64/amd64/genassym.c > > > head/sys/amd64/amd64/initcpu.c > > > head/sys/amd64/amd64/machdep.c > > > head/sys/amd64/amd64/support.S > > > > > > > > > > > Hi, Kostik! > > > > cc -target x86_64-unknown-freebsd13.0 > > --sysroot=/home/dchagin/obj/home/dchagin/head/amd64.amd64/tmp > > -B/home/dchagin/obj/home/dchagin/head/amd64.amd64/tmp/usr/bin -c -x > > assembler-with-cpp -DLOCORE -O2 -pipe -fno-strict-aliasing -g -nostdinc > > -I. -I/home/dchagin/head/sys -I/home/dchagin/head/sys/contrib/ck/include > > -I/home/dchagin/head/sys/contrib/libfdt -D_KERNEL > > -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h > > -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -MD > > -MF.depend.support.o -MTsupport.o > > -fdebug-prefix-map=./machine=/home/dchagin/head/sys/amd64/include > > -fdebug-prefix-map=./x86=/home/dchagin/head/sys/x86/include > -mcmodel=kernel > > -mno-red-zone -mno-mmx -mno-sse -msoft-float > > -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector > > -gdwarf-2 -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes > > -Wmissing-prototypes -Wpointer-arith -Wcast-qual -Wundef > -Wno-pointer-sign > > -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs > > -fdiagnostics-show-option -Wno-unknown-pragmas > > -Wno-error-tautological-compare -Wno-error-empty-body > > -Wno-error-parentheses-equality -Wno-error-unused-function > > -Wno-error-pointer-sign -Wno-error-shift-negative-value > > -Wno-address-of-packed-member -mno-aes -mno-avx -std=iso9899:1999 > > -Werror /home/dchagin/head/sys/amd64/amd64/support.S > > /home/dchagin/head/sys/amd64/amd64/support.S:1809:2: error: instruction > > requires: AVX-512 ISA > > vmovdqa64 %zmm0, %gs:0x340 > > ^ > > /home/dchagin/head/sys/amd64/amd64/support.S:1810:2: error: instruction > > requires: AVX-512 ISA > > vpxor %zmm0, %zmm0, %zmm0 > > ^ > > /home/dchagin/head/sys/amd64/amd64/support.S:1813:2: error: instruction > > requires: AVX-512 DQ ISA > > vorpd (%rdx), %zmm0, %zmm0 > > ^ > > /home/dchagin/head/sys/amd64/amd64/support.S:1814:2: error: instruction > > requires: AVX-512 DQ ISA > > vorpd (%rdx), %zmm0, %zmm0 > > ^ > > /home/dchagin/head/sys/amd64/amd64/support.S:1826:2: error: instruction > > requires: AVX-512 ISA > > vmovdqa64 %gs:0x340, %zmm0 > > ^ > > *** Error code 1 > > > > > > I/m missied something? > Yes, you are using older compiler than current. Perhaps you are using > clang 6.0 still. Update your world. > > FWIW, this is is reason why the sw sequences use .byte in 11.2/12.0 > patches. I do not want to put such abomination into live code base, > remembering aesni.ko. > yes, you are right. thank you! but in the best tradition of the project, the system does not built, I got ar error when building static llvm library: ar: fatal: Symbol table offset overflow *** Error code 70 Stop. make[6]: stopped in /home/dchagin/head/lib/clang/libllvm *** Error code 1 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r347566 - in head/sys: amd64/amd64 amd64/include dev/cpuctl i386/i386 i386/include x86/include x86/x86
вт, 14 мая 2019 г. в 20:02, Konstantin Belousov : > Author: kib > Date: Tue May 14 17:02:20 2019 > New Revision: 347566 > URL: https://svnweb.freebsd.org/changeset/base/347566 > > Log: > Mitigations for Microarchitectural Data Sampling. > > Microarchitectural buffers on some Intel processors utilizing > speculative execution may allow a local process to obtain a memory > disclosure. An attacker may be able to read secret data from the > kernel or from a process when executing untrusted code (for example, > in a web browser). > > Reference: > https://www.intel.com/content/www/us/en/security-center/advisory/intel-sa-00233.html > Security: CVE-2018-12126, CVE-2018-12127, CVE-2018-12130, > CVE-2019-11091 > Security: FreeBSD-SA-19:07.mds > Reviewed by: jhb > Tested by:emaste, lwhsu > Approved by: so (gtetlow) > > Modified: > head/sys/amd64/amd64/exception.S > head/sys/amd64/amd64/genassym.c > head/sys/amd64/amd64/initcpu.c > head/sys/amd64/amd64/machdep.c > head/sys/amd64/amd64/support.S > Hi, Kostik! cc -target x86_64-unknown-freebsd13.0 --sysroot=/home/dchagin/obj/home/dchagin/head/amd64.amd64/tmp -B/home/dchagin/obj/home/dchagin/head/amd64.amd64/tmp/usr/bin -c -x assembler-with-cpp -DLOCORE -O2 -pipe -fno-strict-aliasing -g -nostdinc -I. -I/home/dchagin/head/sys -I/home/dchagin/head/sys/contrib/ck/include -I/home/dchagin/head/sys/contrib/libfdt -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -MD -MF.depend.support.o -MTsupport.o -fdebug-prefix-map=./machine=/home/dchagin/head/sys/amd64/include -fdebug-prefix-map=./x86=/home/dchagin/head/sys/x86/include -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector -gdwarf-2 -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wno-error-tautological-compare -Wno-error-empty-body -Wno-error-parentheses-equality -Wno-error-unused-function -Wno-error-pointer-sign -Wno-error-shift-negative-value -Wno-address-of-packed-member -mno-aes -mno-avx -std=iso9899:1999 -Werror /home/dchagin/head/sys/amd64/amd64/support.S /home/dchagin/head/sys/amd64/amd64/support.S:1809:2: error: instruction requires: AVX-512 ISA vmovdqa64 %zmm0, %gs:0x340 ^ /home/dchagin/head/sys/amd64/amd64/support.S:1810:2: error: instruction requires: AVX-512 ISA vpxor %zmm0, %zmm0, %zmm0 ^ /home/dchagin/head/sys/amd64/amd64/support.S:1813:2: error: instruction requires: AVX-512 DQ ISA vorpd (%rdx), %zmm0, %zmm0 ^ /home/dchagin/head/sys/amd64/amd64/support.S:1814:2: error: instruction requires: AVX-512 DQ ISA vorpd (%rdx), %zmm0, %zmm0 ^ /home/dchagin/head/sys/amd64/amd64/support.S:1826:2: error: instruction requires: AVX-512 ISA vmovdqa64 %gs:0x340, %zmm0 ^ *** Error code 1 I/m missied something? ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r347540 - in head/sys/modules: linprocfs linsysfs linux linux64 linux_common
Author: dchagin Date: Mon May 13 18:28:40 2019 New Revision: 347540 URL: https://svnweb.freebsd.org/changeset/base/347540 Log: Add warning to the Linuxulator makefiles that building it outside of a kernel does not make sence. PR: 222861 MFC after:2 weeks Differential Revision:https://reviews.freebsd.org/D20179 Modified: head/sys/modules/linprocfs/Makefile head/sys/modules/linsysfs/Makefile head/sys/modules/linux/Makefile head/sys/modules/linux64/Makefile head/sys/modules/linux_common/Makefile Modified: head/sys/modules/linprocfs/Makefile == --- head/sys/modules/linprocfs/Makefile Mon May 13 18:25:55 2019 (r347539) +++ head/sys/modules/linprocfs/Makefile Mon May 13 18:28:40 2019 (r347540) @@ -7,4 +7,8 @@ SRCS= vnode_if.h \ device_if.h bus_if.h \ linprocfs.c +.if !defined(KERNBUILDDIR) +.warning Building Linuxulator outside of a kernel does not make sense +.endif + .include Modified: head/sys/modules/linsysfs/Makefile == --- head/sys/modules/linsysfs/Makefile Mon May 13 18:25:55 2019 (r347539) +++ head/sys/modules/linsysfs/Makefile Mon May 13 18:28:40 2019 (r347540) @@ -7,4 +7,8 @@ SRCS= vnode_if.h \ device_if.h bus_if.h pci_if.h \ linsysfs.c +.if !defined(KERNBUILDDIR) +.warning Building Linuxulator outside of a kernel does not make sense +.endif + .include Modified: head/sys/modules/linux/Makefile == --- head/sys/modules/linux/Makefile Mon May 13 18:25:55 2019 (r347539) +++ head/sys/modules/linux/Makefile Mon May 13 18:28:40 2019 (r347540) @@ -80,4 +80,8 @@ ${VDSO}.so: linux${SFX}_locore.o linux${SFX}_genassym.o: offset.inc ${CC} -c ${CFLAGS:N-flto:N-fno-common} ${.IMPSRC} +.if !defined(KERNBUILDDIR) +.warning Building Linuxulator outside of a kernel does not make sense +.endif + .include Modified: head/sys/modules/linux64/Makefile == --- head/sys/modules/linux64/Makefile Mon May 13 18:25:55 2019 (r347539) +++ head/sys/modules/linux64/Makefile Mon May 13 18:28:40 2019 (r347540) @@ -55,4 +55,8 @@ linux_support.o: assym.inc linux_assym.h linux_genassym.o: offset.inc ${CC} -c ${CFLAGS:N-flto:N-fno-common} ${.IMPSRC} +.if !defined(KERNBUILDDIR) +.warning Building Linuxulator outside of a kernel does not make sense +.endif + .include Modified: head/sys/modules/linux_common/Makefile == --- head/sys/modules/linux_common/Makefile Mon May 13 18:25:55 2019 (r347539) +++ head/sys/modules/linux_common/Makefile Mon May 13 18:28:40 2019 (r347540) @@ -15,4 +15,8 @@ EXPORT_SYMS+= linux_ioctl_unregister_handler EXPORT_SYMS+= linux_get_osname EXPORT_SYMS+= linux_get_osrelease +.if !defined(KERNBUILDDIR) +.warning Building Linuxulator outside of a kernel does not make sense +.endif + .include ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r347538 - in head/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux modules/linux modules/linux64 modules/linux_common
Author: dchagin Date: Mon May 13 18:24:29 2019 New Revision: 347538 URL: https://svnweb.freebsd.org/changeset/base/347538 Log: Linuxulator depends on a fundamental kernel settings such as SMP. Many of them listed in opt_global.h which is not generated while building modules outside of a kernel and such modules never match real cofigured kernel. So, we should prevent our users from building obviously defective modules. Therefore, remove the root cause of the building of modules outside of a kernel - the possibility of building modules with DEBUG or KTR flags. And remove all of DEBUG printfs as it is incomplete and in threaded programms not informative, also a half of system call does not have DEBUG printf. For debuging Linux programms we have dtrace, ktr and ktrace ability. PR: 222861 Reviewed by: trasz MFC after:2 weeks Differential Revision:https://reviews.freebsd.org/D20178 Modified: head/sys/amd64/linux/linux.h head/sys/amd64/linux/linux_sysvec.c head/sys/amd64/linux32/linux.h head/sys/amd64/linux32/linux32_machdep.c head/sys/amd64/linux32/linux32_sysvec.c head/sys/arm64/linux/linux.h head/sys/arm64/linux/linux_sysvec.c head/sys/compat/linux/linux_file.c head/sys/compat/linux/linux_fork.c head/sys/compat/linux/linux_getcwd.c head/sys/compat/linux/linux_ioctl.c head/sys/compat/linux/linux_misc.c head/sys/compat/linux/linux_misc.h head/sys/compat/linux/linux_signal.c head/sys/compat/linux/linux_stats.c head/sys/i386/linux/linux.h head/sys/i386/linux/linux_machdep.c head/sys/i386/linux/linux_sysvec.c head/sys/modules/linux/Makefile head/sys/modules/linux64/Makefile head/sys/modules/linux_common/Makefile Modified: head/sys/amd64/linux/linux.h == --- head/sys/amd64/linux/linux.hMon May 13 18:14:20 2019 (r347537) +++ head/sys/amd64/linux/linux.hMon May 13 18:24:29 2019 (r347538) @@ -37,15 +37,6 @@ #defineLINUX_LEGACY_SYSCALLS -/* - * debugging support - */ -extern u_char linux_debug_map[]; -#defineldebug(name)isclr(linux_debug_map, LINUX_SYS_linux_ ## name) -#defineARGS(nm, fmt) "linux(%ld/%ld): "#nm"("fmt")\n", \ - (long)td->td_proc->p_pid, (long)td->td_tid -#defineLMSG(fmt) "linux(%ld/%ld): "fmt"\n", \ - (long)td->td_proc->p_pid, (long)td->td_tid #defineLINUX_DTRACElinuxulator #definePTRIN(v)(void *)(v) Modified: head/sys/amd64/linux/linux_sysvec.c == --- head/sys/amd64/linux/linux_sysvec.c Mon May 13 18:14:20 2019 (r347537) +++ head/sys/amd64/linux/linux_sysvec.c Mon May 13 18:24:29 2019 (r347538) @@ -86,20 +86,6 @@ __FBSDID("$FreeBSD$"); MODULE_VERSION(linux64, 1); -#if defined(DEBUG) -SYSCTL_PROC(_compat_linux, OID_AUTO, debug, - CTLTYPE_STRING | CTLFLAG_RW, - 0, 0, linux_sysctl_debug, "A", - "Linux 64 debugging control"); -#endif - -/* - * Allow the sendsig functions to use the ldebug() facility even though they - * are not syscalls themselves. Map them to syscall 0. This is slightly less - * bogus than using ldebug(sigreturn). - */ -#defineLINUX_SYS_linux_rt_sendsig 0 - const char *linux_kplatform; static int linux_szsigcode; static vm_object_t linux_shared_page_obj; @@ -645,9 +631,6 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigse /* Copy the sigframe out to the user's stack. */ if (copyout(, sfp, sizeof(*sfp)) != 0) { -#ifdef DEBUG - printf("process %ld has trashed its stack\n", (long)p->p_pid); -#endif PROC_LOCK(p); sigexit(td, SIGILL); } Modified: head/sys/amd64/linux32/linux.h == --- head/sys/amd64/linux32/linux.h Mon May 13 18:14:20 2019 (r347537) +++ head/sys/amd64/linux32/linux.h Mon May 13 18:24:29 2019 (r347538) @@ -40,15 +40,6 @@ #defineLINUX_LEGACY_SYSCALLS -/* - * debugging support - */ -extern u_char linux_debug_map[]; -#defineldebug(name)isclr(linux_debug_map, LINUX32_SYS_linux_ ## name) -#defineARGS(nm, fmt) "linux(%ld/%ld): "#nm"("fmt")\n", \ - (long)td->td_proc->p_pid, (long)td->td_tid -#defineLMSG(fmt) "linux(%ld/%ld): "fmt"\n", \ - (long)td->td_proc->p_pid, (long)td->td_tid #defineLINUX_DTRACElinuxulator32 #defineLINUX32_MAXUSER ((1ul << 32) - PAGE_SIZE) Modified: head/sys/amd64/linux32/linux32_machdep.c == ---
svn commit: r347537 - head/sys/compat/linux
Author: dchagin Date: Mon May 13 18:14:20 2019 New Revision: 347537 URL: https://svnweb.freebsd.org/changeset/base/347537 Log: Linuxulator getpeername() returns EINVAL in case then namelen less then 0. MFC after:2 weeks Modified: head/sys/compat/linux/linux_socket.c Modified: head/sys/compat/linux/linux_socket.c == --- head/sys/compat/linux/linux_socket.cMon May 13 17:53:03 2019 (r347536) +++ head/sys/compat/linux/linux_socket.cMon May 13 18:14:20 2019 (r347537) @@ -722,6 +722,8 @@ linux_getpeername(struct thread *td, struct linux_getp error = copyin(PTRIN(args->namelen), , sizeof(len)); if (error != 0) return (error); + if (len < 0) + return (EINVAL); error = kern_getpeername(td, args->s, , ); if (error != 0) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r347533 - in head/sys: compat/linux modules/linux_common
Author: dchagin Date: Mon May 13 17:48:16 2019 New Revision: 347533 URL: https://svnweb.freebsd.org/changeset/base/347533 Log: Our bsd_to_linux_sockaddr() and linux_to_bsd_sockaddr() functions alter the userspace sockaddr to convert the format between linux and BSD versions. That's the minimum 3 of copyin/copyout operations for one syscall. Also some syscall uses linux_sa_put() and linux_getsockaddr() when load sockaddr to userspace or from userspace accordingly. To avoid this chaos, especially converting sockaddr in the userspace, rewrite these 4 functions to convert sockaddr only in kernel and leave only 2 of this functions. Also in order to reduce duplication between MD parts of the Linuxulator put struct sockaddr conversion functions that are MI out into linux_common module. PR: 232920 MFC after:2 weeks Differential Revision:https://reviews.freebsd.org/D20157 Modified: head/sys/compat/linux/linux.c head/sys/compat/linux/linux.h head/sys/compat/linux/linux_common.h head/sys/compat/linux/linux_socket.c head/sys/compat/linux/linux_socket.h head/sys/modules/linux_common/Makefile Modified: head/sys/compat/linux/linux.c == --- head/sys/compat/linux/linux.c Mon May 13 16:38:48 2019 (r347532) +++ head/sys/compat/linux/linux.c Mon May 13 17:48:16 2019 (r347533) @@ -27,21 +27,29 @@ #include __FBSDID("$FreeBSD$"); +#include + #include #include #include #include #include +#include #include #include +#include #include #include #include #include +#include +#include + #include #include +#include CTASSERT(LINUX_IFNAMSIZ == IFNAMSIZ); @@ -322,4 +330,194 @@ linux_ifhwaddr(struct ifnet *ifp, struct l_sockaddr *l } return (ENOENT); +} + +int +linux_to_bsd_domain(int domain) +{ + + switch (domain) { + case LINUX_AF_UNSPEC: + return (AF_UNSPEC); + case LINUX_AF_UNIX: + return (AF_LOCAL); + case LINUX_AF_INET: + return (AF_INET); + case LINUX_AF_INET6: + return (AF_INET6); + case LINUX_AF_AX25: + return (AF_CCITT); + case LINUX_AF_IPX: + return (AF_IPX); + case LINUX_AF_APPLETALK: + return (AF_APPLETALK); + } + return (-1); +} + +int +bsd_to_linux_domain(int domain) +{ + + switch (domain) { + case AF_UNSPEC: + return (LINUX_AF_UNSPEC); + case AF_LOCAL: + return (LINUX_AF_UNIX); + case AF_INET: + return (LINUX_AF_INET); + case AF_INET6: + return (LINUX_AF_INET6); + case AF_CCITT: + return (LINUX_AF_AX25); + case AF_IPX: + return (LINUX_AF_IPX); + case AF_APPLETALK: + return (LINUX_AF_APPLETALK); + } + return (-1); +} + +/* + * Based on the fact that: + * 1. Native and Linux storage of struct sockaddr + * and struct sockaddr_in6 are equal. + * 2. On Linux sa_family is the first member of all struct sockaddr. + */ +int +bsd_to_linux_sockaddr(const struct sockaddr *sa, struct l_sockaddr **lsa, +socklen_t len) +{ + struct l_sockaddr *kosa; + int error, bdom; + + *lsa = NULL; + if (len < 2 || len > UCHAR_MAX) + return (EINVAL); + + kosa = malloc(len, M_SONAME, M_WAITOK); + bcopy(sa, kosa, len); + + bdom = bsd_to_linux_domain(sa->sa_family); + if (bdom == -1) { + error = EAFNOSUPPORT; + goto out; + } + + kosa->sa_family = bdom; + *lsa = kosa; + return (0); + +out: + free(kosa, M_SONAME); + return (error); +} + +int +linux_to_bsd_sockaddr(const struct l_sockaddr *osa, struct sockaddr **sap, +socklen_t *len) +{ + struct sockaddr *sa; + struct l_sockaddr *kosa; +#ifdef INET6 + struct sockaddr_in6 *sin6; + bool oldv6size; +#endif + char *name; + int salen, bdom, error, hdrlen, namelen; + + if (*len < 2 || *len > UCHAR_MAX) + return (EINVAL); + + salen = *len; + +#ifdef INET6 + oldv6size = false; + /* +* Check for old (pre-RFC2553) sockaddr_in6. We may accept it +* if it's a v4-mapped address, so reserve the proper space +* for it. +*/ + if (salen == sizeof(struct sockaddr_in6) - sizeof(uint32_t)) { + salen += sizeof(uint32_t); + oldv6size = true; + } +#endif + + kosa = malloc(salen, M_SONAME, M_WAITOK); + + if ((error = copyin(osa, kosa, *len))) + goto out; + + bdom = linux_to_bsd_domain(kosa->sa_family); + if (bdom == -1) { + error = EAFNOSUPPORT; + goto out; + } + +#ifdef INET6 + /* +* Older Linux IPv6 code uses obsolete
svn commit: r347521 - stable/11/sys/compat/linux
Author: dchagin Date: Mon May 13 11:17:31 2019 New Revision: 347521 URL: https://svnweb.freebsd.org/changeset/base/347521 Log: MFC r346965: Follow the FreeBSD and implement PDEATH_SIG prctl ops in the Linuxulator. It was first introduced in r163734 and missied by me in r283383. Modified: stable/11/sys/compat/linux/linux_emul.c stable/11/sys/compat/linux/linux_emul.h stable/11/sys/compat/linux/linux_misc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linux/linux_emul.c == --- stable/11/sys/compat/linux/linux_emul.c Mon May 13 10:43:18 2019 (r347520) +++ stable/11/sys/compat/linux/linux_emul.c Mon May 13 11:17:31 2019 (r347521) @@ -127,7 +127,6 @@ linux_proc_init(struct thread *td, struct thread *newt em->em_tid = p->p_pid; em->flags = 0; - em->pdeath_signal = 0; em->robust_futexes = NULL; em->child_clear_tid = NULL; em->child_set_tid = NULL; Modified: stable/11/sys/compat/linux/linux_emul.h == --- stable/11/sys/compat/linux/linux_emul.h Mon May 13 10:43:18 2019 (r347520) +++ stable/11/sys/compat/linux/linux_emul.h Mon May 13 11:17:31 2019 (r347521) @@ -40,7 +40,6 @@ struct linux_emuldata { int*child_set_tid; /* in clone(): Child's TID to set on clone */ int*child_clear_tid;/* in clone(): Child's TID to clear on exit */ - int pdeath_signal; /* parent death signal */ int flags; /* thread emuldata flags */ int em_tid; /* thread id */ Modified: stable/11/sys/compat/linux/linux_misc.c == --- stable/11/sys/compat/linux/linux_misc.c Mon May 13 10:43:18 2019 (r347520) +++ stable/11/sys/compat/linux/linux_misc.c Mon May 13 11:17:31 2019 (r347521) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1995,7 +1996,6 @@ linux_prctl(struct thread *td, struct linux_prctl_args int error = 0, max_size; struct proc *p = td->td_proc; char comm[LINUX_MAX_COMM_LEN]; - struct linux_emuldata *em; int pdeath_signal; #ifdef DEBUG @@ -2009,17 +2009,18 @@ linux_prctl(struct thread *td, struct linux_prctl_args case LINUX_PR_SET_PDEATHSIG: if (!LINUX_SIG_VALID(args->arg2)) return (EINVAL); - em = em_find(td); - KASSERT(em != NULL, ("prctl: emuldata not found.\n")); - em->pdeath_signal = args->arg2; - break; + pdeath_signal = linux_to_bsd_signal(args->arg2); + return (kern_procctl(td, P_PID, 0, PROC_PDEATHSIG_CTL, + _signal)); case LINUX_PR_GET_PDEATHSIG: - em = em_find(td); - KASSERT(em != NULL, ("prctl: emuldata not found.\n")); - pdeath_signal = em->pdeath_signal; - error = copyout(_signal, + error = kern_procctl(td, P_PID, 0, PROC_PDEATHSIG_STATUS, + _signal); + if (error != 0) + return (error); + pdeath_signal = bsd_to_linux_signal(pdeath_signal); + return (copyout(_signal, (void *)(register_t)args->arg2, - sizeof(pdeath_signal)); + sizeof(pdeath_signal))); break; case LINUX_PR_GET_KEEPCAPS: /* ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r347520 - stable/12/sys/compat/linux
Author: dchagin Date: Mon May 13 10:43:18 2019 New Revision: 347520 URL: https://svnweb.freebsd.org/changeset/base/347520 Log: MFC r346965: Follow the FreeBSD and implement PDEATH_SIG prctl ops in the Linuxulator. It was first introduced in r163734 and missied by me in r283383. Modified: stable/12/sys/compat/linux/linux_emul.c stable/12/sys/compat/linux/linux_emul.h stable/12/sys/compat/linux/linux_misc.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_emul.c == --- stable/12/sys/compat/linux/linux_emul.c Mon May 13 08:34:13 2019 (r347519) +++ stable/12/sys/compat/linux/linux_emul.c Mon May 13 10:43:18 2019 (r347520) @@ -127,7 +127,6 @@ linux_proc_init(struct thread *td, struct thread *newt em->em_tid = p->p_pid; em->flags = 0; - em->pdeath_signal = 0; em->robust_futexes = NULL; em->child_clear_tid = NULL; em->child_set_tid = NULL; Modified: stable/12/sys/compat/linux/linux_emul.h == --- stable/12/sys/compat/linux/linux_emul.h Mon May 13 08:34:13 2019 (r347519) +++ stable/12/sys/compat/linux/linux_emul.h Mon May 13 10:43:18 2019 (r347520) @@ -40,7 +40,6 @@ struct linux_emuldata { int*child_set_tid; /* in clone(): Child's TID to set on clone */ int*child_clear_tid;/* in clone(): Child's TID to clear on exit */ - int pdeath_signal; /* parent death signal */ int flags; /* thread emuldata flags */ int em_tid; /* thread id */ Modified: stable/12/sys/compat/linux/linux_misc.c == --- stable/12/sys/compat/linux/linux_misc.c Mon May 13 08:34:13 2019 (r347519) +++ stable/12/sys/compat/linux/linux_misc.c Mon May 13 10:43:18 2019 (r347520) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1993,7 +1994,6 @@ linux_prctl(struct thread *td, struct linux_prctl_args int error = 0, max_size; struct proc *p = td->td_proc; char comm[LINUX_MAX_COMM_LEN]; - struct linux_emuldata *em; int pdeath_signal; #ifdef DEBUG @@ -2007,17 +2007,18 @@ linux_prctl(struct thread *td, struct linux_prctl_args case LINUX_PR_SET_PDEATHSIG: if (!LINUX_SIG_VALID(args->arg2)) return (EINVAL); - em = em_find(td); - KASSERT(em != NULL, ("prctl: emuldata not found.\n")); - em->pdeath_signal = args->arg2; - break; + pdeath_signal = linux_to_bsd_signal(args->arg2); + return (kern_procctl(td, P_PID, 0, PROC_PDEATHSIG_CTL, + _signal)); case LINUX_PR_GET_PDEATHSIG: - em = em_find(td); - KASSERT(em != NULL, ("prctl: emuldata not found.\n")); - pdeath_signal = em->pdeath_signal; - error = copyout(_signal, + error = kern_procctl(td, P_PID, 0, PROC_PDEATHSIG_STATUS, + _signal); + if (error != 0) + return (error); + pdeath_signal = bsd_to_linux_signal(pdeath_signal); + return (copyout(_signal, (void *)(register_t)args->arg2, - sizeof(pdeath_signal)); + sizeof(pdeath_signal))); break; case LINUX_PR_GET_KEEPCAPS: /* ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r347218 - head/sys/compat/linsysfs
вт, 7 мая 2019 г. в 08:32, Rodney W. Grimes : > > Author: dchagin > > Date: Tue May 7 05:08:13 2019 > > New Revision: 347218 > > URL: https://svnweb.freebsd.org/changeset/base/347218 > > > > Log: > > Remove wrong copyright line. Discussed with Carlos Neira. > > > > Reported by:Rodney W. Grimes > normally just use a committers username, aka rgrimes or rgrimes@ > for these types of things. > > ah, I see only: Rodney W. Grimes > > MFC after: 2 weeks > > Differential Revision: https://reviews.freebsd.org/D13656 > > Hang on, now you removed his copyright? > I see he said that was ok, but that was not the desired intent here. > It would of been fine to have the copyright read: > > * Copyright (c) 2006 IronPort Systems > * All rights reserved. > * Copyright (c) 2017 Carlos Neira cneirabus...@gmail.com > > As a heads up to other committers you should never insert your > copyright between another copyright and the "All rights reserved." text, > if you wish to assert the all rights reserved you should duplicate > it like: > > * Copyright (c) 2006 IronPort Systems > * All rights reserved. > * Copyright (c) 2017 Carlos Neira cneirabus...@gmail.com > * All rights reserved. > > preferably on the line with your copyright as in: > * Copyright (c) 2017 Carlos Neira cneirabus...@gmail.com All rights > reserved. > > But if at all possible it would be best if we could not add any > more of these, and remove them when possible. > > and that actually I did. thanks > For those wishing to save space the (c) is unneeded when you > spell out the word "Copyright". > > > > > Modified: > > head/sys/compat/linsysfs/linsysfs.c > > > > Modified: head/sys/compat/linsysfs/linsysfs.c > > > == > > --- head/sys/compat/linsysfs/linsysfs.c Tue May 7 01:27:23 2019 > (r347217) > > +++ head/sys/compat/linsysfs/linsysfs.c Tue May 7 05:08:13 2019 > (r347218) > > @@ -2,7 +2,6 @@ > > * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > > * > > * Copyright (c) 2006 IronPort Systems > > - * Copyright (c) 2017 Carlos Neira cneirabus...@gmail.com > > * All rights reserved. > > * > > * Redistribution and use in source and binary forms, with or without > > > > > > -- > Rod Grimes > rgri...@freebsd.org > ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r347218 - head/sys/compat/linsysfs
Author: dchagin Date: Tue May 7 05:08:13 2019 New Revision: 347218 URL: https://svnweb.freebsd.org/changeset/base/347218 Log: Remove wrong copyright line. Discussed with Carlos Neira. Reported by: Rodney W. Grimes MFC after:2 weeks Differential Revision:https://reviews.freebsd.org/D13656 Modified: head/sys/compat/linsysfs/linsysfs.c Modified: head/sys/compat/linsysfs/linsysfs.c == --- head/sys/compat/linsysfs/linsysfs.c Tue May 7 01:27:23 2019 (r347217) +++ head/sys/compat/linsysfs/linsysfs.c Tue May 7 05:08:13 2019 (r347218) @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2006 IronPort Systems - * Copyright (c) 2017 Carlos Neira cneirabus...@gmail.com * All rights reserved. * * Redistribution and use in source and binary forms, with or without ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r347202 - head/sys/compat/linux
Author: dchagin Date: Mon May 6 19:56:13 2019 New Revision: 347202 URL: https://svnweb.freebsd.org/changeset/base/347202 Log: Complete r347052 (https://reviews.freebsd.org/D20137) as it it was not a final revision. Fix style issues and change bool-like variables from int to bool. Reviewed by: emaste MFC after:2 weeks Differential Revision:https://reviews.freebsd.org/D20141 Modified: head/sys/compat/linux/linux.c Modified: head/sys/compat/linux/linux.c == --- head/sys/compat/linux/linux.c Mon May 6 19:35:30 2019 (r347201) +++ head/sys/compat/linux/linux.c Mon May 6 19:56:13 2019 (r347202) @@ -227,21 +227,22 @@ ifname_linux_to_bsd(struct thread *td, const char *lxn struct ifnet *ifp; int len, unit; char *ep; - int is_eth, is_lo, index; + int index; + bool is_eth, is_lo; for (len = 0; len < LINUX_IFNAMSIZ; ++len) - if (!isalpha(lxname[len]) || lxname[len] == 0) + if (!isalpha(lxname[len]) || lxname[len] == '\0') break; if (len == 0 || len == LINUX_IFNAMSIZ) return (NULL); /* Linux loopback interface name is lo (not lo0) */ - is_lo = (len == 2 && !strncmp(lxname, "lo", len)) ? 1 : 0; + is_lo = (len == 2 && strncmp(lxname, "lo", len) == 0); unit = (int)strtoul(lxname + len, , 10); if ((ep == NULL || ep == lxname + len || ep >= lxname + LINUX_IFNAMSIZ) && is_lo == 0) return (NULL); index = 0; - is_eth = (len == 3 && !strncmp(lxname, "eth", len)) ? 1 : 0; + is_eth = (len == 3 && strncmp(lxname, "eth", len) == 0); CURVNET_SET(TD_TO_VNET(td)); IFNET_RLOCK(); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r347204 - head/sys/compat/linsysfs
Author: dchagin Date: Mon May 6 20:01:13 2019 New Revision: 347204 URL: https://svnweb.freebsd.org/changeset/base/347204 Log: Adds sys/class/net devices to linsysfs. Only two interfaces are created eth0 and lo and they expose the following properties: address, addr_len, flags, ifindex, mty, tx_queue_len and type. Initial patch developed by Carlos Neira in 2017 and finished by me. PR: 223722 MFC after:2 weeks Differential Revision:https://reviews.freebsd.org/D13656 Modified: head/sys/compat/linsysfs/linsysfs.c Modified: head/sys/compat/linsysfs/linsysfs.c == --- head/sys/compat/linsysfs/linsysfs.c Mon May 6 19:57:51 2019 (r347203) +++ head/sys/compat/linsysfs/linsysfs.c Mon May 6 20:01:13 2019 (r347204) @@ -2,6 +2,7 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2006 IronPort Systems + * Copyright (c) 2017 Carlos Neira cneirabus...@gmail.com * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -44,7 +46,11 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include +#include #include #include @@ -64,6 +70,146 @@ atoi(const char *str) return (int)strtol(str, (char **)NULL, 10); } +static int +linsysfs_ifnet_addr(PFS_FILL_ARGS) +{ + struct l_sockaddr lsa; + struct ifnet *ifp; + + ifp = ifname_linux_to_bsd(td, pn->pn_parent->pn_name, NULL); + if (ifp == NULL) + return (ENOENT); + if (linux_ifhwaddr(ifp, ) != 0) + return (ENOENT); + sbuf_printf(sb, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx\n", + lsa.sa_data[0], lsa.sa_data[1], lsa.sa_data[2], + lsa.sa_data[3], lsa.sa_data[4], lsa.sa_data[5]); + return (0); +} + +static int +linsysfs_ifnet_addrlen(PFS_FILL_ARGS) +{ + + sbuf_printf(sb, "%d\n", LINUX_IFHWADDRLEN); + return (0); +} + +static int +linsysfs_ifnet_flags(PFS_FILL_ARGS) +{ + struct ifnet *ifp; + unsigned short flags; + + ifp = ifname_linux_to_bsd(td, pn->pn_parent->pn_name, NULL); + if (ifp == NULL) + return (ENOENT); + linux_ifflags(ifp, ); + sbuf_printf(sb, "0x%x\n", flags); + return (0); +} + +static int +linsysfs_ifnet_ifindex(PFS_FILL_ARGS) +{ + struct ifnet *ifp; + + ifp = ifname_linux_to_bsd(td, pn->pn_parent->pn_name, NULL); + if (ifp == NULL) + return (ENOENT); + sbuf_printf(sb, "%u\n", ifp->if_index); + return (0); +} + +static int +linsysfs_ifnet_mtu(PFS_FILL_ARGS) +{ + struct ifnet *ifp; + + ifp = ifname_linux_to_bsd(td, pn->pn_parent->pn_name, NULL); + if (ifp == NULL) + return (ENOENT); + sbuf_printf(sb, "%u\n", ifp->if_mtu); + return (0); +} + +static int +linsysfs_ifnet_tx_queue_len(PFS_FILL_ARGS) +{ + + /* XXX */ + sbuf_printf(sb, "1000\n"); + return (0); +} + +static int +linsysfs_ifnet_type(PFS_FILL_ARGS) +{ + struct l_sockaddr lsa; + struct ifnet *ifp; + + ifp = ifname_linux_to_bsd(td, pn->pn_parent->pn_name, NULL); + if (ifp == NULL) + return (ENOENT); + if (linux_ifhwaddr(ifp, ) != 0) + return (ENOENT); + sbuf_printf(sb, "%d\n", lsa.sa_family); + return (0); +} + +static void +linsysfs_listnics(struct pfs_node *dir) +{ + struct pfs_node *nic; + struct pfs_node *lo; + + nic = pfs_create_dir(dir, "eth0", NULL, NULL, NULL, 0); + + pfs_create_file(nic, "address", _ifnet_addr, + NULL, NULL, NULL, PFS_RD); + + pfs_create_file(nic, "addr_len", _ifnet_addrlen, + NULL, NULL, NULL, PFS_RD); + + pfs_create_file(nic, "flags", _ifnet_flags, + NULL, NULL, NULL, PFS_RD); + + pfs_create_file(nic, "ifindex", _ifnet_ifindex, + NULL, NULL, NULL, PFS_RD); + + pfs_create_file(nic, "mtu", _ifnet_mtu, + NULL, NULL, NULL, PFS_RD); + + pfs_create_file(nic, "tx_queue_len", _ifnet_tx_queue_len, + NULL, NULL, NULL, PFS_RD); + + pfs_create_file(nic, "type", _ifnet_type, + NULL, NULL, NULL, PFS_RD); + + lo = pfs_create_dir(dir, "lo", NULL, NULL, NULL, 0); + + pfs_create_file(lo, "address", _ifnet_addr, + NULL, NULL, NULL, PFS_RD); + + pfs_create_file(lo, "addr_len", _ifnet_addrlen, + NULL, NULL, NULL, PFS_RD); + + pfs_create_file(lo, "flags", _ifnet_flags, + NULL, NULL, NULL, PFS_RD); + + pfs_create_file(lo, "ifindex", _ifnet_ifindex, + NULL, NULL, NULL, PFS_RD); + + pfs_create_file(lo, "mtu", _ifnet_mtu, + NULL, NULL, NULL, PFS_RD); + + pfs_create_file(lo, "tx_queue_len", _ifnet_tx_queue_len,
svn commit: r347203 - head/sys/compat/linux
Author: dchagin Date: Mon May 6 19:57:51 2019 New Revision: 347203 URL: https://svnweb.freebsd.org/changeset/base/347203 Log: Rewrite linux_ifflags() in more readable Linuxulator style. Reviewed by: emaste MFC after:2 weeks Differential Revision:https://reviews.freebsd.org/D20146 Modified: head/sys/compat/linux/linux.c head/sys/compat/linux/linux.h Modified: head/sys/compat/linux/linux.c == --- head/sys/compat/linux/linux.c Mon May 6 19:56:13 2019 (r347202) +++ head/sys/compat/linux/linux.c Mon May 6 19:57:51 2019 (r347203) @@ -269,16 +269,30 @@ ifname_linux_to_bsd(struct thread *td, const char *lxn void linux_ifflags(struct ifnet *ifp, short *flags) { + unsigned short fl; - *flags = (ifp->if_flags | ifp->if_drv_flags) & 0x; - /* these flags have no Linux equivalent */ - *flags &= ~(IFF_DRV_OACTIVE|IFF_SIMPLEX| - IFF_LINK0|IFF_LINK1|IFF_LINK2); - /* Linux' multicast flag is in a different bit */ - if (*flags & IFF_MULTICAST) { - *flags &= ~IFF_MULTICAST; - *flags |= 0x1000; - } + fl = (ifp->if_flags | ifp->if_drv_flags) & 0x; + *flags = 0; + if (fl & IFF_UP) + *flags |= LINUX_IFF_UP; + if (fl & IFF_BROADCAST) + *flags |= LINUX_IFF_BROADCAST; + if (fl & IFF_DEBUG) + *flags |= LINUX_IFF_DEBUG; + if (fl & IFF_LOOPBACK) + *flags |= LINUX_IFF_LOOPBACK; + if (fl & IFF_POINTOPOINT) + *flags |= LINUX_IFF_POINTOPOINT; + if (fl & IFF_DRV_RUNNING) + *flags |= LINUX_IFF_RUNNING; + if (fl & IFF_NOARP) + *flags |= LINUX_IFF_NOARP; + if (fl & IFF_PROMISC) + *flags |= LINUX_IFF_PROMISC; + if (fl & IFF_ALLMULTI) + *flags |= LINUX_IFF_ALLMULTI; + if (fl & IFF_MULTICAST) + *flags |= LINUX_IFF_MULTICAST; } int Modified: head/sys/compat/linux/linux.h == --- head/sys/compat/linux/linux.h Mon May 6 19:56:13 2019 (r347202) +++ head/sys/compat/linux/linux.h Mon May 6 19:57:51 2019 (r347203) @@ -46,6 +46,26 @@ struct l_sockaddr { #defineLINUX_ARPHRD_ETHER 1 #defineLINUX_ARPHRD_LOOPBACK 772 +/* + * net device flags + */ +#defineLINUX_IFF_UP0x0001 +#defineLINUX_IFF_BROADCAST 0x0002 +#defineLINUX_IFF_DEBUG 0x0004 +#defineLINUX_IFF_LOOPBACK 0x0008 +#defineLINUX_IFF_POINTOPOINT 0x0010 +#defineLINUX_IFF_NOTRAILERS0x0020 +#defineLINUX_IFF_RUNNING 0x0040 +#defineLINUX_IFF_NOARP 0x0080 +#defineLINUX_IFF_PROMISC 0x0100 +#defineLINUX_IFF_ALLMULTI 0x0200 +#defineLINUX_IFF_MASTER0x0400 +#defineLINUX_IFF_SLAVE 0x0800 +#defineLINUX_IFF_MULTICAST 0x1000 +#defineLINUX_IFF_PORTSEL 0x2000 +#defineLINUX_IFF_AUTOMEDIA 0x4000 +#defineLINUX_IFF_DYNAMIC 0x8000 + /* sigaltstack */ #defineLINUX_SS_ONSTACK1 #defineLINUX_SS_DISABLE2 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r347196 - in head/sys/modules: linux linux64
Author: dchagin Date: Mon May 6 18:46:42 2019 New Revision: 347196 URL: https://svnweb.freebsd.org/changeset/base/347196 Log: The build process generates assym.inc from genassym.o, so don't forget to clean genassym.o MFC after:2 weeks Modified: head/sys/modules/linux/Makefile head/sys/modules/linux64/Makefile Modified: head/sys/modules/linux/Makefile == --- head/sys/modules/linux/Makefile Mon May 6 18:39:27 2019 (r347195) +++ head/sys/modules/linux/Makefile Mon May 6 18:46:42 2019 (r347196) @@ -47,7 +47,8 @@ EXPORT_SYMS+= linux_ioctl_register_handler EXPORT_SYMS+= linux_ioctl_unregister_handler .endif -CLEANFILES=linux${SFX}_assym.h linux${SFX}_genassym.o linux${SFX}_locore.o +CLEANFILES=linux${SFX}_assym.h linux${SFX}_genassym.o linux${SFX}_locore.o \ + genassym.o linux${SFX}_assym.h: linux${SFX}_genassym.o sh ${SYSDIR}/kern/genassym.sh linux${SFX}_genassym.o > ${.TARGET} Modified: head/sys/modules/linux64/Makefile == --- head/sys/modules/linux64/Makefile Mon May 6 18:39:27 2019 (r347195) +++ head/sys/modules/linux64/Makefile Mon May 6 18:46:42 2019 (r347196) @@ -21,7 +21,8 @@ SRCS+= opt_kstack_pages.h opt_nfs.h opt_hwpmc_hooks.h SRCS+= opt_apic.h .endif -CLEANFILES=linux_assym.h linux_genassym.o linux_locore.o +CLEANFILES=linux_assym.h linux_genassym.o linux_locore.o \ + genassym.o OBJS= ${VDSO}.so ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r347052 - in head/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux
+ unit = (int)strtoul(lxname + len, , 10); + if ((ep == NULL || ep == lxname + len || ep >= lxname + LINUX_IFNAMSIZ) && + is_lo == 0) + return (NULL); + index = 0; + is_eth = (len == 3 && !strncmp(lxname, "eth", len)) ? 1 : 0; + + CURVNET_SET(TD_TO_VNET(td)); + IFNET_RLOCK(); + CK_STAILQ_FOREACH(ifp, _ifnet, if_link) { + /* +* Allow Linux programs to use FreeBSD names. Don't presume +* we never have an interface named "eth", so don't make +* the test optional based on is_eth. +*/ + if (strncmp(ifp->if_xname, lxname, LINUX_IFNAMSIZ) == 0) + break; + if (is_eth && IFP_IS_ETH(ifp) && unit == index++) + break; + if (is_lo && IFP_IS_LOOP(ifp)) + break; + } + IFNET_RUNLOCK(); + CURVNET_RESTORE(); + if (ifp != NULL && bsdname != NULL) + strlcpy(bsdname, ifp->if_xname, IFNAMSIZ); + return (ifp); +} + +void +linux_ifflags(struct ifnet *ifp, short *flags) +{ + + *flags = (ifp->if_flags | ifp->if_drv_flags) & 0x; + /* these flags have no Linux equivalent */ + *flags &= ~(IFF_DRV_OACTIVE|IFF_SIMPLEX| + IFF_LINK0|IFF_LINK1|IFF_LINK2); + /* Linux' multicast flag is in a different bit */ + if (*flags & IFF_MULTICAST) { + *flags &= ~IFF_MULTICAST; + *flags |= 0x1000; + } +} + +int +linux_ifhwaddr(struct ifnet *ifp, struct l_sockaddr *lsa) +{ + struct ifaddr *ifa; + struct sockaddr_dl *sdl; + + if (IFP_IS_LOOP(ifp)) { + bzero(lsa, sizeof(*lsa)); + lsa->sa_family = LINUX_ARPHRD_LOOPBACK; + return (0); + } + + if (!IFP_IS_ETH(ifp)) + return (ENOENT); + + CK_STAILQ_FOREACH(ifa, >if_addrhead, ifa_link) { + sdl = (struct sockaddr_dl*)ifa->ifa_addr; + if (sdl != NULL && (sdl->sdl_family == AF_LINK) && + (sdl->sdl_type == IFT_ETHER)) { + bzero(lsa, sizeof(*lsa)); + lsa->sa_family = LINUX_ARPHRD_ETHER; + bcopy(LLADDR(sdl), lsa->sa_data, LINUX_IFHWADDRLEN); + return (0); + } + } + + return (ENOENT); } Modified: head/sys/compat/linux/linux.h == --- head/sys/compat/linux/linux.h Fri May 3 08:27:03 2019 (r347051) +++ head/sys/compat/linux/linux.h Fri May 3 08:42:49 2019 (r347052) @@ -29,6 +29,23 @@ #ifndef _LINUX_MI_H_ #define _LINUX_MI_H_ +#defineLINUX_IFHWADDRLEN 6 +#defineLINUX_IFNAMSIZ 16 + +/* + * Criteria for interface name translation + */ +#defineIFP_IS_ETH(ifp) (ifp->if_type == IFT_ETHER) +#defineIFP_IS_LOOP(ifp)(ifp->if_type == IFT_LOOP) + +struct l_sockaddr { + unsigned short sa_family; + charsa_data[14]; +}; + +#defineLINUX_ARPHRD_ETHER 1 +#defineLINUX_ARPHRD_LOOPBACK 772 + /* sigaltstack */ #defineLINUX_SS_ONSTACK1 #defineLINUX_SS_DISABLE2 Added: head/sys/compat/linux/linux_common.h == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/compat/linux/linux_common.hFri May 3 08:42:49 2019 (r347052) @@ -0,0 +1,38 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2019 Dmitry Chagin + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
svn commit: r347016 - head/sys/compat/linsysfs
Author: dchagin Date: Thu May 2 09:00:36 2019 New Revision: 347016 URL: https://svnweb.freebsd.org/changeset/base/347016 Log: Remove unneeded includes. MFC after:2 week Modified: head/sys/compat/linsysfs/linsysfs.c Modified: head/sys/compat/linsysfs/linsysfs.c == --- head/sys/compat/linsysfs/linsysfs.c Thu May 2 08:17:29 2019 (r347015) +++ head/sys/compat/linsysfs/linsysfs.c Thu May 2 09:00:36 2019 (r347016) @@ -31,22 +31,12 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include -#include -#include -#include #include -#include #include #include -#include -#include -#include #include #include #include -#include #include #include @@ -55,17 +45,6 @@ __FBSDID("$FreeBSD$"); #include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include #include #include ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r346965 - head/sys/compat/linux
Author: dchagin Date: Tue Apr 30 17:18:05 2019 New Revision: 346965 URL: https://svnweb.freebsd.org/changeset/base/346965 Log: Follow the FreeBSD and implement PDEATH_SIG prctl ops in the Linuxulator. It was first introduced in r163734 and missied by me in r283383. MFC after:1 week Modified: head/sys/compat/linux/linux_emul.c head/sys/compat/linux/linux_emul.h head/sys/compat/linux/linux_misc.c Modified: head/sys/compat/linux/linux_emul.c == --- head/sys/compat/linux/linux_emul.c Tue Apr 30 16:52:50 2019 (r346964) +++ head/sys/compat/linux/linux_emul.c Tue Apr 30 17:18:05 2019 (r346965) @@ -127,7 +127,6 @@ linux_proc_init(struct thread *td, struct thread *newt em->em_tid = p->p_pid; em->flags = 0; - em->pdeath_signal = 0; em->robust_futexes = NULL; em->child_clear_tid = NULL; em->child_set_tid = NULL; Modified: head/sys/compat/linux/linux_emul.h == --- head/sys/compat/linux/linux_emul.h Tue Apr 30 16:52:50 2019 (r346964) +++ head/sys/compat/linux/linux_emul.h Tue Apr 30 17:18:05 2019 (r346965) @@ -40,7 +40,6 @@ struct linux_emuldata { int*child_set_tid; /* in clone(): Child's TID to set on clone */ int*child_clear_tid;/* in clone(): Child's TID to clear on exit */ - int pdeath_signal; /* parent death signal */ int flags; /* thread emuldata flags */ int em_tid; /* thread id */ Modified: head/sys/compat/linux/linux_misc.c == --- head/sys/compat/linux/linux_misc.c Tue Apr 30 16:52:50 2019 (r346964) +++ head/sys/compat/linux/linux_misc.c Tue Apr 30 17:18:05 2019 (r346965) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1993,7 +1994,6 @@ linux_prctl(struct thread *td, struct linux_prctl_args int error = 0, max_size; struct proc *p = td->td_proc; char comm[LINUX_MAX_COMM_LEN]; - struct linux_emuldata *em; int pdeath_signal; #ifdef DEBUG @@ -2007,17 +2007,18 @@ linux_prctl(struct thread *td, struct linux_prctl_args case LINUX_PR_SET_PDEATHSIG: if (!LINUX_SIG_VALID(args->arg2)) return (EINVAL); - em = em_find(td); - KASSERT(em != NULL, ("prctl: emuldata not found.\n")); - em->pdeath_signal = args->arg2; - break; + pdeath_signal = linux_to_bsd_signal(args->arg2); + return (kern_procctl(td, P_PID, 0, PROC_PDEATHSIG_CTL, + _signal)); case LINUX_PR_GET_PDEATHSIG: - em = em_find(td); - KASSERT(em != NULL, ("prctl: emuldata not found.\n")); - pdeath_signal = em->pdeath_signal; - error = copyout(_signal, + error = kern_procctl(td, P_PID, 0, PROC_PDEATHSIG_STATUS, + _signal); + if (error != 0) + return (error); + pdeath_signal = bsd_to_linux_signal(pdeath_signal); + return (copyout(_signal, (void *)(register_t)args->arg2, - sizeof(pdeath_signal)); + sizeof(pdeath_signal))); break; case LINUX_PR_GET_KEEPCAPS: /* ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r346844 - stable/12/sys/compat/linux
Author: dchagin Date: Sun Apr 28 14:38:21 2019 New Revision: 346844 URL: https://svnweb.freebsd.org/changeset/base/346844 Log: MFC r345473: Whitespace cleanup (annoying). Modified: stable/12/sys/compat/linux/linux_fork.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_fork.c == --- stable/12/sys/compat/linux/linux_fork.c Sun Apr 28 14:37:20 2019 (r346843) +++ stable/12/sys/compat/linux/linux_fork.c Sun Apr 28 14:38:21 2019 (r346844) @@ -353,7 +353,7 @@ linux_clone_thread(struct thread *td, struct linux_clo thread_unlock(td); if (P_SHOULDSTOP(p)) newtd->td_flags |= TDF_ASTPENDING | TDF_NEEDSUSPCHK; - + if (p->p_ptevents & PTRACE_LWP) newtd->td_dbgflags |= TDB_BORN; PROC_UNLOCK(p); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r346843 - in stable/12/sys: amd64/linux amd64/linux32 compat/linux i386/linux
Author: dchagin Date: Sun Apr 28 14:37:20 2019 New Revision: 346843 URL: https://svnweb.freebsd.org/changeset/base/346843 Log: MFC r345471, r345472, r346603: Update syscall.master to 5.0. For 32-bit Linuxulator, ipc() syscall was historically the entry point for the IPC API. Starting in Linux 4.18, direct syscalls are provided for the IPC. Enable it. Modified: stable/12/sys/amd64/linux/linux_dummy.c stable/12/sys/amd64/linux/linux_proto.h stable/12/sys/amd64/linux/linux_syscall.h stable/12/sys/amd64/linux/linux_syscalls.c stable/12/sys/amd64/linux/linux_sysent.c stable/12/sys/amd64/linux/linux_systrace_args.c stable/12/sys/amd64/linux/syscalls.master stable/12/sys/amd64/linux32/linux32_dummy.c stable/12/sys/amd64/linux32/linux32_proto.h stable/12/sys/amd64/linux32/linux32_syscall.h stable/12/sys/amd64/linux32/linux32_syscalls.c stable/12/sys/amd64/linux32/linux32_sysent.c stable/12/sys/amd64/linux32/linux32_systrace_args.c stable/12/sys/amd64/linux32/syscalls.master stable/12/sys/compat/linux/linux_ipc.h stable/12/sys/i386/linux/linux.h stable/12/sys/i386/linux/linux_dummy.c stable/12/sys/i386/linux/linux_proto.h stable/12/sys/i386/linux/linux_syscall.h stable/12/sys/i386/linux/linux_syscalls.c stable/12/sys/i386/linux/linux_sysent.c stable/12/sys/i386/linux/linux_systrace_args.c stable/12/sys/i386/linux/syscalls.master Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/linux/linux_dummy.c == --- stable/12/sys/amd64/linux/linux_dummy.c Sun Apr 28 14:34:31 2019 (r346842) +++ stable/12/sys/amd64/linux/linux_dummy.c Sun Apr 28 14:37:20 2019 (r346843) @@ -155,6 +155,16 @@ DUMMY(pwritev2); DUMMY(pkey_mprotect); DUMMY(pkey_alloc); DUMMY(pkey_free); +/* Linux 4.11: */ +DUMMY(statx); +/* Linux 4.18: */ +DUMMY(io_pgetevents); +DUMMY(rseq); +/* Linux 5.0: */ +DUMMY(pidfd_send_signal); +DUMMY(io_uring_setup); +DUMMY(io_uring_enter); +DUMMY(io_uring_register); #define DUMMY_XATTR(s) \ int\ Modified: stable/12/sys/amd64/linux/linux_proto.h == --- stable/12/sys/amd64/linux/linux_proto.h Sun Apr 28 14:34:31 2019 (r346842) +++ stable/12/sys/amd64/linux/linux_proto.h Sun Apr 28 14:37:20 2019 (r346843) @@ -1213,6 +1213,34 @@ struct linux_pkey_alloc_args { struct linux_pkey_free_args { char pkey_l_[PADL_(l_int)]; l_int pkey; char pkey_r_[PADR_(l_int)]; }; +struct linux_statx_args { + char dirfd_l_[PADL_(l_int)]; l_int dirfd; char dirfd_r_[PADR_(l_int)]; + char pathname_l_[PADL_(const char *)]; const char * pathname; char pathname_r_[PADR_(const char *)]; + char flags_l_[PADL_(l_uint)]; l_uint flags; char flags_r_[PADR_(l_uint)]; + char mask_l_[PADL_(l_uint)]; l_uint mask; char mask_r_[PADR_(l_uint)]; + char statxbuf_l_[PADL_(void *)]; void * statxbuf; char statxbuf_r_[PADR_(void *)]; +}; +struct linux_io_pgetevents_args { + register_t dummy; +}; +struct linux_rseq_args { + register_t dummy; +}; +struct linux_pidfd_send_signal_args { + char pidfd_l_[PADL_(l_int)]; l_int pidfd; char pidfd_r_[PADR_(l_int)]; + char sig_l_[PADL_(l_int)]; l_int sig; char sig_r_[PADR_(l_int)]; + char info_l_[PADL_(l_siginfo_t *)]; l_siginfo_t * info; char info_r_[PADR_(l_siginfo_t *)]; + char flags_l_[PADL_(l_uint)]; l_uint flags; char flags_r_[PADR_(l_uint)]; +}; +struct linux_io_uring_setup_args { + register_t dummy; +}; +struct linux_io_uring_enter_args { + register_t dummy; +}; +struct linux_io_uring_register_args { + register_t dummy; +}; #definenosys linux_nosys intlinux_open(struct thread *, struct linux_open_args *); intlinux_newstat(struct thread *, struct linux_newstat_args *); @@ -1479,6 +1507,13 @@ int linux_pwritev2(struct thread *, struct linux_pwrit intlinux_pkey_mprotect(struct thread *, struct linux_pkey_mprotect_args *); intlinux_pkey_alloc(struct thread *, struct linux_pkey_alloc_args *); intlinux_pkey_free(struct thread *, struct linux_pkey_free_args *); +intlinux_statx(struct thread *, struct linux_statx_args *); +intlinux_io_pgetevents(struct thread *, struct linux_io_pgetevents_args *); +intlinux_rseq(struct thread *, struct linux_rseq_args *); +intlinux_pidfd_send_signal(struct thread *, struct linux_pidfd_send_signal_args *); +intlinux_io_uring_setup(struct thread *, struct linux_io_uring_setup_args *); +intlinux_io_uring_enter(struct thread *, struct linux_io_uring_enter_args *); +intlinux_io_uring_register(struct thread *, struct linux_io_uring_register_args *); #ifdef COMPAT_43 @@ -1786,6 +1821,13 @@ int linux_pkey_free(struct thread *, struct
svn commit: r346842 - in stable/12/sys: amd64/linux32 compat/linux i386/linux
Author: dchagin Date: Sun Apr 28 14:34:31 2019 New Revision: 346842 URL: https://svnweb.freebsd.org/changeset/base/346842 Log: MFC r345469, r345470: Linux between 4.18 and 5.0 split IPC system calls. In preparation for doing this in the Linuxulator modify our linux_shmat() to match actual Linux shmat() system call. Modified: stable/12/sys/amd64/linux32/linux32_machdep.c stable/12/sys/amd64/linux32/linux32_proto.h stable/12/sys/amd64/linux32/linux32_systrace_args.c stable/12/sys/amd64/linux32/syscalls.master stable/12/sys/compat/linux/linux_ipc.c stable/12/sys/compat/linux/linux_ipc.h stable/12/sys/i386/linux/linux_machdep.c stable/12/sys/i386/linux/linux_proto.h stable/12/sys/i386/linux/linux_systrace_args.c stable/12/sys/i386/linux/syscalls.master Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/linux32/linux32_machdep.c == --- stable/12/sys/amd64/linux32/linux32_machdep.c Sun Apr 28 14:30:25 2019(r346841) +++ stable/12/sys/amd64/linux32/linux32_machdep.c Sun Apr 28 14:34:31 2019(r346842) @@ -259,7 +259,7 @@ linux_ipc(struct thread *td, struct linux_ipc_args *ar struct linux_semop_args a; a.semid = args->arg1; - a.tsops = args->ptr; + a.tsops = PTRIN(args->ptr); a.nsops = args->arg2; return (linux_semop(td, )); } @@ -278,7 +278,7 @@ linux_ipc(struct thread *td, struct linux_ipc_args *ar a.semid = args->arg1; a.semnum = args->arg2; a.cmd = args->arg3; - error = copyin(args->ptr, , sizeof(a.arg)); + error = copyin(PTRIN(args->ptr), , sizeof(a.arg)); if (error) return (error); return (linux_semctl(td, )); @@ -287,7 +287,7 @@ linux_ipc(struct thread *td, struct linux_ipc_args *ar struct linux_msgsnd_args a; a.msqid = args->arg1; - a.msgp = args->ptr; + a.msgp = PTRIN(args->ptr); a.msgsz = args->arg2; a.msgflg = args->arg3; return (linux_msgsnd(td, )); @@ -304,13 +304,13 @@ linux_ipc(struct thread *td, struct linux_ipc_args *ar if (args->ptr == 0) return (EINVAL); - error = copyin(args->ptr, , sizeof(tmp)); + error = copyin(PTRIN(args->ptr), , sizeof(tmp)); if (error) return (error); a.msgp = PTRIN(tmp.msgp); a.msgtyp = tmp.msgtyp; } else { - a.msgp = args->ptr; + a.msgp = PTRIN(args->ptr); a.msgtyp = args->arg5; } return (linux_msgrcv(td, )); @@ -327,22 +327,29 @@ linux_ipc(struct thread *td, struct linux_ipc_args *ar a.msqid = args->arg1; a.cmd = args->arg2; - a.buf = args->ptr; + a.buf = PTRIN(args->ptr); return (linux_msgctl(td, )); } case LINUX_SHMAT: { struct linux_shmat_args a; + l_uintptr_t addr; + int error; a.shmid = args->arg1; - a.shmaddr = args->ptr; + a.shmaddr = PTRIN(args->ptr); a.shmflg = args->arg2; - a.raddr = PTRIN((l_uint)args->arg3); - return (linux_shmat(td, )); + error = linux_shmat(td, ); + if (error != 0) + return (error); + addr = td->td_retval[0]; + error = copyout(, PTRIN(args->arg3), sizeof(addr)); + td->td_retval[0] = 0; + return (error); } case LINUX_SHMDT: { struct linux_shmdt_args a; - a.shmaddr = args->ptr; + a.shmaddr = PTRIN(args->ptr); return (linux_shmdt(td, )); } case LINUX_SHMGET: { @@ -358,7 +365,7 @@ linux_ipc(struct thread *td, struct linux_ipc_args *ar a.shmid = args->arg1; a.cmd = args->arg2; - a.buf = args->ptr; + a.buf = PTRIN(args->ptr); return (linux_shmctl(td, )); } default: Modified: stable/12/sys/amd64/linux32/linux32_proto.h == --- stable/12/sys/amd64/linux32/linux32_proto.h Sun Apr 28 14:30:25 2019 (r346841) +++ stable/12/sys/amd64/linux32/linux32_proto.h Sun Apr 28 14:34:31 2019 (r346842) @@ -369,9 +369,9 @@ struct linux_ipc_args { char what_l_[PADL_(l_uint)]; l_uint what; char what_r_[PADR_(l_uint)]; char
svn commit: r346841 - stable/12/sys/amd64/linux
Author: dchagin Date: Sun Apr 28 14:30:25 2019 New Revision: 346841 URL: https://svnweb.freebsd.org/changeset/base/346841 Log: MFC r345468: Revert r313993. AMD64_SET_**BASE expects a pointer to a pointer, we just passing in the pointer value itself. Set PCB_FULL_IRET for doreti to restore %fs, %gs and its correspondig base. PR: 225105 Modified: stable/12/sys/amd64/linux/linux_machdep.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/linux/linux_machdep.c == --- stable/12/sys/amd64/linux/linux_machdep.c Sun Apr 28 14:20:29 2019 (r346840) +++ stable/12/sys/amd64/linux/linux_machdep.c Sun Apr 28 14:30:25 2019 (r346841) @@ -228,35 +228,38 @@ linux_sigaltstack(struct thread *td, struct linux_siga int linux_arch_prctl(struct thread *td, struct linux_arch_prctl_args *args) { + struct pcb *pcb; int error; - struct sysarch_args bsd_args; + pcb = td->td_pcb; LINUX_CTR2(arch_prctl, "0x%x, %p", args->code, args->addr); switch (args->code) { case LINUX_ARCH_SET_GS: - bsd_args.op = AMD64_SET_GSBASE; - bsd_args.parms = (void *)args->addr; - error = sysarch(td, _args); - if (error == EINVAL) + if (args->addr < VM_MAXUSER_ADDRESS) { + set_pcb_flags(pcb, PCB_FULL_IRET); + pcb->pcb_gsbase = args->addr; + td->td_frame->tf_gs = _ugssel; + error = 0; + } else error = EPERM; break; case LINUX_ARCH_SET_FS: - bsd_args.op = AMD64_SET_FSBASE; - bsd_args.parms = (void *)args->addr; - error = sysarch(td, _args); - if (error == EINVAL) + if (args->addr < VM_MAXUSER_ADDRESS) { + set_pcb_flags(pcb, PCB_FULL_IRET); + pcb->pcb_fsbase = args->addr; + td->td_frame->tf_fs = _ufssel; + error = 0; + } else error = EPERM; break; case LINUX_ARCH_GET_FS: - bsd_args.op = AMD64_GET_FSBASE; - bsd_args.parms = (void *)args->addr; - error = sysarch(td, _args); + error = copyout(>pcb_fsbase, PTRIN(args->addr), + sizeof(args->addr)); break; case LINUX_ARCH_GET_GS: - bsd_args.op = AMD64_GET_GSBASE; - bsd_args.parms = (void *)args->addr; - error = sysarch(td, _args); + error = copyout(>pcb_gsbase, PTRIN(args->addr), + sizeof(args->addr)); break; default: error = EINVAL; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r346839 - in stable/11/sys: amd64/linux amd64/linux32 compat/linux i386/linux
Author: dchagin Date: Sun Apr 28 14:19:31 2019 New Revision: 346839 URL: https://svnweb.freebsd.org/changeset/base/346839 Log: MFC r345471, r345472, r346603: Update syscall.master to 5.0. For 32-bit Linuxulator, ipc() syscall was historically the entry point for the IPC API. Starting in Linux 4.18, direct syscalls are provided for the IPC. Enable it. Modified: stable/11/sys/amd64/linux/linux_dummy.c stable/11/sys/amd64/linux/linux_proto.h stable/11/sys/amd64/linux/linux_syscall.h stable/11/sys/amd64/linux/linux_syscalls.c stable/11/sys/amd64/linux/linux_sysent.c stable/11/sys/amd64/linux/linux_systrace_args.c stable/11/sys/amd64/linux/syscalls.master stable/11/sys/amd64/linux32/linux32_dummy.c stable/11/sys/amd64/linux32/linux32_proto.h stable/11/sys/amd64/linux32/linux32_syscall.h stable/11/sys/amd64/linux32/linux32_syscalls.c stable/11/sys/amd64/linux32/linux32_sysent.c stable/11/sys/amd64/linux32/linux32_systrace_args.c stable/11/sys/amd64/linux32/syscalls.master stable/11/sys/compat/linux/linux_ipc.h stable/11/sys/i386/linux/linux.h stable/11/sys/i386/linux/linux_dummy.c stable/11/sys/i386/linux/linux_proto.h stable/11/sys/i386/linux/linux_syscall.h stable/11/sys/i386/linux/linux_syscalls.c stable/11/sys/i386/linux/linux_sysent.c stable/11/sys/i386/linux/linux_systrace_args.c stable/11/sys/i386/linux/syscalls.master Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/linux/linux_dummy.c == --- stable/11/sys/amd64/linux/linux_dummy.c Sun Apr 28 14:16:00 2019 (r346838) +++ stable/11/sys/amd64/linux/linux_dummy.c Sun Apr 28 14:19:31 2019 (r346839) @@ -157,6 +157,16 @@ DUMMY(pwritev2); DUMMY(pkey_mprotect); DUMMY(pkey_alloc); DUMMY(pkey_free); +/* Linux 4.11: */ +DUMMY(statx); +/* Linux 4.18: */ +DUMMY(io_pgetevents); +DUMMY(rseq); +/* Linux 5.0: */ +DUMMY(pidfd_send_signal); +DUMMY(io_uring_setup); +DUMMY(io_uring_enter); +DUMMY(io_uring_register); #define DUMMY_XATTR(s) \ int\ Modified: stable/11/sys/amd64/linux/linux_proto.h == --- stable/11/sys/amd64/linux/linux_proto.h Sun Apr 28 14:16:00 2019 (r346838) +++ stable/11/sys/amd64/linux/linux_proto.h Sun Apr 28 14:19:31 2019 (r346839) @@ -1212,6 +1212,34 @@ struct linux_pkey_alloc_args { struct linux_pkey_free_args { char pkey_l_[PADL_(l_int)]; l_int pkey; char pkey_r_[PADR_(l_int)]; }; +struct linux_statx_args { + char dirfd_l_[PADL_(l_int)]; l_int dirfd; char dirfd_r_[PADR_(l_int)]; + char pathname_l_[PADL_(const char *)]; const char * pathname; char pathname_r_[PADR_(const char *)]; + char flags_l_[PADL_(l_uint)]; l_uint flags; char flags_r_[PADR_(l_uint)]; + char mask_l_[PADL_(l_uint)]; l_uint mask; char mask_r_[PADR_(l_uint)]; + char statxbuf_l_[PADL_(void *)]; void * statxbuf; char statxbuf_r_[PADR_(void *)]; +}; +struct linux_io_pgetevents_args { + register_t dummy; +}; +struct linux_rseq_args { + register_t dummy; +}; +struct linux_pidfd_send_signal_args { + char pidfd_l_[PADL_(l_int)]; l_int pidfd; char pidfd_r_[PADR_(l_int)]; + char sig_l_[PADL_(l_int)]; l_int sig; char sig_r_[PADR_(l_int)]; + char info_l_[PADL_(l_siginfo_t *)]; l_siginfo_t * info; char info_r_[PADR_(l_siginfo_t *)]; + char flags_l_[PADL_(l_uint)]; l_uint flags; char flags_r_[PADR_(l_uint)]; +}; +struct linux_io_uring_setup_args { + register_t dummy; +}; +struct linux_io_uring_enter_args { + register_t dummy; +}; +struct linux_io_uring_register_args { + register_t dummy; +}; #definenosys linux_nosys intlinux_open(struct thread *, struct linux_open_args *); intlinux_newstat(struct thread *, struct linux_newstat_args *); @@ -1478,6 +1506,13 @@ int linux_pwritev2(struct thread *, struct linux_pwrit intlinux_pkey_mprotect(struct thread *, struct linux_pkey_mprotect_args *); intlinux_pkey_alloc(struct thread *, struct linux_pkey_alloc_args *); intlinux_pkey_free(struct thread *, struct linux_pkey_free_args *); +intlinux_statx(struct thread *, struct linux_statx_args *); +intlinux_io_pgetevents(struct thread *, struct linux_io_pgetevents_args *); +intlinux_rseq(struct thread *, struct linux_rseq_args *); +intlinux_pidfd_send_signal(struct thread *, struct linux_pidfd_send_signal_args *); +intlinux_io_uring_setup(struct thread *, struct linux_io_uring_setup_args *); +intlinux_io_uring_enter(struct thread *, struct linux_io_uring_enter_args *); +intlinux_io_uring_register(struct thread *, struct linux_io_uring_register_args *); #ifdef COMPAT_43 @@ -1778,6 +1813,13 @@ int linux_pkey_free(struct thread *, struct
svn commit: r346840 - stable/11/sys/compat/linux
Author: dchagin Date: Sun Apr 28 14:20:29 2019 New Revision: 346840 URL: https://svnweb.freebsd.org/changeset/base/346840 Log: MFC r345473: Whitespace cleanup (annoying). Modified: stable/11/sys/compat/linux/linux_fork.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linux/linux_fork.c == --- stable/11/sys/compat/linux/linux_fork.c Sun Apr 28 14:19:31 2019 (r346839) +++ stable/11/sys/compat/linux/linux_fork.c Sun Apr 28 14:20:29 2019 (r346840) @@ -352,7 +352,7 @@ linux_clone_thread(struct thread *td, struct linux_clo thread_unlock(td); if (P_SHOULDSTOP(p)) newtd->td_flags |= TDF_ASTPENDING | TDF_NEEDSUSPCHK; - + if (p->p_ptevents & PTRACE_LWP) newtd->td_dbgflags |= TDB_BORN; PROC_UNLOCK(p); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r346838 - in stable/11/sys: amd64/linux amd64/linux32 compat/linux i386/linux
Author: dchagin Date: Sun Apr 28 14:16:00 2019 New Revision: 346838 URL: https://svnweb.freebsd.org/changeset/base/346838 Log: MFC r345469, r345470: Linux between 4.18 and 5.0 split IPC system calls. In preparation for doing this in the Linuxulator modify our linux_shmat() to match actual Linux shmat() system call. Modified: stable/11/sys/amd64/linux/linux_proto.h stable/11/sys/amd64/linux/linux_systrace_args.c stable/11/sys/amd64/linux32/linux32_machdep.c stable/11/sys/amd64/linux32/linux32_proto.h stable/11/sys/amd64/linux32/linux32_systrace_args.c stable/11/sys/amd64/linux32/syscalls.master stable/11/sys/compat/linux/linux_ipc.c stable/11/sys/compat/linux/linux_ipc.h stable/11/sys/i386/linux/linux_machdep.c stable/11/sys/i386/linux/linux_proto.h stable/11/sys/i386/linux/linux_systrace_args.c stable/11/sys/i386/linux/syscalls.master Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/linux/linux_proto.h == --- stable/11/sys/amd64/linux/linux_proto.h Sun Apr 28 14:11:21 2019 (r346837) +++ stable/11/sys/amd64/linux/linux_proto.h Sun Apr 28 14:16:00 2019 (r346838) @@ -66,8 +66,8 @@ struct linux_mmap2_args { }; struct linux_mprotect_args { char addr_l_[PADL_(caddr_t)]; caddr_t addr; char addr_r_[PADR_(caddr_t)]; - char len_l_[PADL_(int)]; int len; char len_r_[PADR_(int)]; - char prot_l_[PADL_(int)]; int prot; char prot_r_[PADR_(int)]; + char len_l_[PADL_(l_int)]; l_int len; char len_r_[PADR_(l_int)]; + char prot_l_[PADL_(l_int)]; l_int prot; char prot_r_[PADR_(l_int)]; }; struct linux_brk_args { char dsend_l_[PADL_(l_ulong)]; l_ulong dsend; char dsend_r_[PADR_(l_ulong)]; @@ -173,8 +173,8 @@ struct linux_getpid_args { register_t dummy; }; struct linux_sendfile_args { - char out_l_[PADL_(int)]; int out; char out_r_[PADR_(int)]; - char in_l_[PADL_(int)]; int in; char in_r_[PADR_(int)]; + char out_l_[PADL_(l_int)]; l_int out; char out_r_[PADR_(l_int)]; + char in_l_[PADL_(l_int)]; l_int in; char in_r_[PADR_(l_int)]; char offset_l_[PADL_(l_long *)]; l_long * offset; char offset_r_[PADR_(l_long *)]; char count_l_[PADL_(l_size_t)]; l_size_t count; char count_r_[PADR_(l_size_t)]; }; @@ -281,7 +281,7 @@ struct linux_execve_args { char envp_l_[PADL_(char **)]; char ** envp; char envp_r_[PADR_(char **)]; }; struct linux_exit_args { - char rval_l_[PADL_(int)]; int rval; char rval_r_[PADR_(int)]; + char rval_l_[PADL_(l_int)]; l_int rval; char rval_r_[PADR_(l_int)]; }; struct linux_wait4_args { char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)]; @@ -518,8 +518,8 @@ struct linux_sysfs_args { char arg2_l_[PADL_(l_ulong)]; l_ulong arg2; char arg2_r_[PADR_(l_ulong)]; }; struct linux_getpriority_args { - char which_l_[PADL_(int)]; int which; char which_r_[PADR_(int)]; - char who_l_[PADL_(int)]; int who; char who_r_[PADR_(int)]; + char which_l_[PADL_(l_int)]; l_int which; char which_r_[PADR_(l_int)]; + char who_l_[PADL_(l_int)]; l_int who; char who_r_[PADR_(l_int)]; }; struct linux_sched_setparam_args { char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)]; @@ -654,19 +654,19 @@ struct linux_fremovexattr_args { register_t dummy; }; struct linux_tkill_args { - char tid_l_[PADL_(int)]; int tid; char tid_r_[PADR_(int)]; - char sig_l_[PADL_(int)]; int sig; char sig_r_[PADR_(int)]; + char tid_l_[PADL_(l_int)]; l_int tid; char tid_r_[PADR_(l_int)]; + char sig_l_[PADL_(l_int)]; l_int sig; char sig_r_[PADR_(l_int)]; }; struct linux_time_args { char tm_l_[PADL_(l_time_t *)]; l_time_t * tm; char tm_r_[PADR_(l_time_t *)]; }; struct linux_sys_futex_args { char uaddr_l_[PADL_(void *)]; void * uaddr; char uaddr_r_[PADR_(void *)]; - char op_l_[PADL_(int)]; int op; char op_r_[PADR_(int)]; - char val_l_[PADL_(int)]; int val; char val_r_[PADR_(int)]; + char op_l_[PADL_(l_int)]; l_int op; char op_r_[PADR_(l_int)]; + char val_l_[PADL_(l_int)]; l_int val; char val_r_[PADR_(l_int)]; char timeout_l_[PADL_(struct l_timespec *)]; struct l_timespec * timeout; char timeout_r_[PADR_(struct l_timespec *)]; char uaddr2_l_[PADL_(void *)]; void * uaddr2; char uaddr2_r_[PADR_(void *)]; - char val3_l_[PADL_(int)]; int val3; char val3_r_[PADR_(int)]; + char val3_l_[PADL_(l_int)]; l_int val3; char val3_r_[PADR_(l_int)]; }; struct linux_sched_setaffinity_args { char pid_l_[PADL_(l_pid_t)]; l_pid_t pid; char pid_r_[PADR_(l_pid_t)]; @@ -693,16 +693,16 @@ struct linux_getdents64_args { char count_l_[PADL_(l_uint)]; l_uint count; char count_r_[PADR_(l_uint)]; }; struct linux_set_tid_address_args { - char tidptr_l_[PADL_(int *)]; int * tidptr; char
svn commit: r346835 - in stable/11/sys: amd64/linux amd64/linux32 compat/linux i386/linux
Author: dchagin Date: Sun Apr 28 14:08:05 2019 New Revision: 346835 URL: https://svnweb.freebsd.org/changeset/base/346835 Log: MFC r335515 (by chuck@): Fix the Linux kernel version number calculation The Linux compatibility code was converting the version number (e.g. 2.6.32) in two different ways and then comparing the results. The linux_map_osrel() function converted MAJOR.MINOR.PATCH similar to what FreeBSD does natively. I.e. where major=v0, minor=v1, and patch=v2 v = v0 * 100 + v1 * 1000 + v2; The LINUX_KERNVER() macro, on the other hand, converted the value with bit shifts. I.e. where major=a, minor=b, and patch=c v = (((a) << 16) + ((b) << 8) + (c)) The Linux kernel uses the later format via the KERNEL_VERSION() macro in include/generated/uapi/linux/version.h Fix is to use the LINUX_KERNVER() macro in linux_map_osrel() as well as in the .trans_osrel functions. PR: 229209 Modified: stable/11/sys/amd64/linux/linux_sysvec.c stable/11/sys/amd64/linux32/linux32_sysvec.c stable/11/sys/compat/linux/linux_mib.c stable/11/sys/i386/linux/linux_sysvec.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/linux/linux_sysvec.c == --- stable/11/sys/amd64/linux/linux_sysvec.cSun Apr 28 14:06:22 2019 (r346834) +++ stable/11/sys/amd64/linux/linux_sysvec.cSun Apr 28 14:08:05 2019 (r346835) @@ -794,10 +794,11 @@ linux_trans_osrel(const Elf_Note *note, int32_t *osrel return (false); /* -* For Linux we encode osrel as follows (see linux_mib.c): -* VVVMMMIII (version, major, minor), see linux_mib.c. +* For Linux we encode osrel using the Linux convention of +* (version << 16) | (major << 8) | (minor) +* See macro in linux_mib.h */ - *osrel = desc[1] * 100 + desc[2] * 1000 + desc[3]; + *osrel = LINUX_KERNVER(desc[1], desc[2], desc[3]); return (true); } Modified: stable/11/sys/amd64/linux32/linux32_sysvec.c == --- stable/11/sys/amd64/linux32/linux32_sysvec.cSun Apr 28 14:06:22 2019(r346834) +++ stable/11/sys/amd64/linux32/linux32_sysvec.cSun Apr 28 14:08:05 2019(r346835) @@ -993,10 +993,11 @@ linux32_trans_osrel(const Elf_Note *note, int32_t *osr return (false); /* -* For Linux we encode osrel as follows (see linux_mib.c): -* VVVMMMIII (version, major, minor), see linux_mib.c. +* For Linux we encode osrel using the Linux convention of +* (version << 16) | (major << 8) | (minor) +* See macro in linux_mib.h */ - *osrel = desc[1] * 100 + desc[2] * 1000 + desc[3]; + *osrel = LINUX_KERNVER(desc[1], desc[2], desc[3]); return (true); } Modified: stable/11/sys/compat/linux/linux_mib.c == --- stable/11/sys/compat/linux/linux_mib.c Sun Apr 28 14:06:22 2019 (r346834) +++ stable/11/sys/compat/linux/linux_mib.c Sun Apr 28 14:08:05 2019 (r346835) @@ -149,8 +149,8 @@ linux_map_osrel(char *osrelease, int *osrel) if (osrelease == sep || sep != eosrelease) return (EINVAL); - v = v0 * 100 + v1 * 1000 + v2; - if (v < 100) + v = LINUX_KERNVER(v0, v1, v2); + if (v < LINUX_KERNVER(1, 0, 0)) return (EINVAL); if (osrel != NULL) Modified: stable/11/sys/i386/linux/linux_sysvec.c == --- stable/11/sys/i386/linux/linux_sysvec.c Sun Apr 28 14:06:22 2019 (r346834) +++ stable/11/sys/i386/linux/linux_sysvec.c Sun Apr 28 14:08:05 2019 (r346835) @@ -960,10 +960,11 @@ linux_trans_osrel(const Elf_Note *note, int32_t *osrel return (false); /* -* For Linux we encode osrel as follows (see linux_mib.c): -* VVVMMMIII (version, major, minor), see linux_mib.c. +* For Linux we encode osrel using the Linux convention of +* (version << 16) | (major << 8) | (minor) +* See macro in linux_mib.h */ - *osrel = desc[1] * 100 + desc[2] * 1000 + desc[3]; + *osrel = LINUX_KERNVER(desc[1], desc[2], desc[3]); return (true); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r346837 - stable/11/sys/amd64/linux
Author: dchagin Date: Sun Apr 28 14:11:21 2019 New Revision: 346837 URL: https://svnweb.freebsd.org/changeset/base/346837 Log: MFC r345468: Revert r313993. AMD64_SET_**BASE expects a pointer to a pointer, we just passing in the pointer value itself. Set PCB_FULL_IRET for doreti to restore %fs, %gs and its correspondig base. Modified: stable/11/sys/amd64/linux/linux_machdep.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/linux/linux_machdep.c == --- stable/11/sys/amd64/linux/linux_machdep.c Sun Apr 28 14:09:31 2019 (r346836) +++ stable/11/sys/amd64/linux/linux_machdep.c Sun Apr 28 14:11:21 2019 (r346837) @@ -227,35 +227,38 @@ linux_sigaltstack(struct thread *td, struct linux_siga int linux_arch_prctl(struct thread *td, struct linux_arch_prctl_args *args) { + struct pcb *pcb; int error; - struct sysarch_args bsd_args; + pcb = td->td_pcb; LINUX_CTR2(arch_prctl, "0x%x, %p", args->code, args->addr); switch (args->code) { case LINUX_ARCH_SET_GS: - bsd_args.op = AMD64_SET_GSBASE; - bsd_args.parms = (void *)args->addr; - error = sysarch(td, _args); - if (error == EINVAL) + if (args->addr < VM_MAXUSER_ADDRESS) { + set_pcb_flags(pcb, PCB_FULL_IRET); + pcb->pcb_gsbase = args->addr; + td->td_frame->tf_gs = _ugssel; + error = 0; + } else error = EPERM; break; case LINUX_ARCH_SET_FS: - bsd_args.op = AMD64_SET_FSBASE; - bsd_args.parms = (void *)args->addr; - error = sysarch(td, _args); - if (error == EINVAL) + if (args->addr < VM_MAXUSER_ADDRESS) { + set_pcb_flags(pcb, PCB_FULL_IRET); + pcb->pcb_fsbase = args->addr; + td->td_frame->tf_fs = _ufssel; + error = 0; + } else error = EPERM; break; case LINUX_ARCH_GET_FS: - bsd_args.op = AMD64_GET_FSBASE; - bsd_args.parms = (void *)args->addr; - error = sysarch(td, _args); + error = copyout(>pcb_fsbase, PTRIN(args->addr), + sizeof(args->addr)); break; case LINUX_ARCH_GET_GS: - bsd_args.op = AMD64_GET_GSBASE; - bsd_args.parms = (void *)args->addr; - error = sysarch(td, _args); + error = copyout(>pcb_gsbase, PTRIN(args->addr), + sizeof(args->addr)); break; default: error = EINVAL; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r346834 - stable/11/sys/compat/linux
Author: dchagin Date: Sun Apr 28 14:06:22 2019 New Revision: 346834 URL: https://svnweb.freebsd.org/changeset/base/346834 Log: MFC r335387 (by emaste@): linuxulator: handle V3 capget/capset Linux 2.6.26 introduced 64-bit capability sets. Extend our stub implementation to handle both 32- and 64-bit. (We still report no capabilities in capget, and disallow any in capset.) Modified: stable/11/sys/compat/linux/linux_misc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linux/linux_misc.c == --- stable/11/sys/compat/linux/linux_misc.c Sun Apr 28 14:05:05 2019 (r346833) +++ stable/11/sys/compat/linux/linux_misc.c Sun Apr 28 14:06:22 2019 (r346834) @@ -1864,7 +1864,9 @@ linux_exit_group(struct thread *td, struct linux_exit_ /* NOTREACHED */ } -#define _LINUX_CAPABILITY_VERSION 0x19980330 +#define _LINUX_CAPABILITY_VERSION_1 0x19980330 +#define _LINUX_CAPABILITY_VERSION_2 0x20071026 +#define _LINUX_CAPABILITY_VERSION_3 0x20080522 struct l_user_cap_header { l_int version; @@ -1878,27 +1880,35 @@ struct l_user_cap_data { }; int -linux_capget(struct thread *td, struct linux_capget_args *args) +linux_capget(struct thread *td, struct linux_capget_args *uap) { struct l_user_cap_header luch; - struct l_user_cap_data lucd; - int error; + struct l_user_cap_data lucd[2]; + int error, u32s; - if (args->hdrp == NULL) + if (uap->hdrp == NULL) return (EFAULT); - error = copyin(args->hdrp, , sizeof(luch)); + error = copyin(uap->hdrp, , sizeof(luch)); if (error != 0) return (error); - if (luch.version != _LINUX_CAPABILITY_VERSION) { + switch (luch.version) { + case _LINUX_CAPABILITY_VERSION_1: + u32s = 1; + break; + case _LINUX_CAPABILITY_VERSION_2: + case _LINUX_CAPABILITY_VERSION_3: + u32s = 2; + break; + default: #ifdef DEBUG if (ldebug(capget)) printf(LMSG("invalid capget capability version 0x%x"), luch.version); #endif - luch.version = _LINUX_CAPABILITY_VERSION; - error = copyout(, args->hdrp, sizeof(luch)); + luch.version = _LINUX_CAPABILITY_VERSION_1; + error = copyout(, uap->hdrp, sizeof(luch)); if (error) return (error); return (EINVAL); @@ -1907,42 +1917,50 @@ linux_capget(struct thread *td, struct linux_capget_ar if (luch.pid) return (EPERM); - if (args->datap) { + if (uap->datap) { /* * The current implementation doesn't support setting * a capability (it's essentially a stub) so indicate * that no capabilities are currently set or available * to request. */ - bzero (, sizeof(lucd)); - error = copyout(, args->datap, sizeof(lucd)); + memset(, 0, u32s * sizeof(lucd[0])); + error = copyout(, uap->datap, u32s * sizeof(lucd[0])); } return (error); } int -linux_capset(struct thread *td, struct linux_capset_args *args) +linux_capset(struct thread *td, struct linux_capset_args *uap) { struct l_user_cap_header luch; - struct l_user_cap_data lucd; - int error; + struct l_user_cap_data lucd[2]; + int error, i, u32s; - if (args->hdrp == NULL || args->datap == NULL) + if (uap->hdrp == NULL || uap->datap == NULL) return (EFAULT); - error = copyin(args->hdrp, , sizeof(luch)); + error = copyin(uap->hdrp, , sizeof(luch)); if (error != 0) return (error); - if (luch.version != _LINUX_CAPABILITY_VERSION) { + switch (luch.version) { + case _LINUX_CAPABILITY_VERSION_1: + u32s = 1; + break; + case _LINUX_CAPABILITY_VERSION_2: + case _LINUX_CAPABILITY_VERSION_3: + u32s = 2; + break; + default: #ifdef DEBUG if (ldebug(capset)) printf(LMSG("invalid capset capability version 0x%x"), luch.version); #endif - luch.version = _LINUX_CAPABILITY_VERSION; - error = copyout(, args->hdrp, sizeof(luch)); + luch.version = _LINUX_CAPABILITY_VERSION_1; + error = copyout(, uap->hdrp, sizeof(luch)); if (error) return (error); return (EINVAL); @@ -1951,18 +1969,21 @@ linux_capset(struct thread *td, struct linux_capset_ar if (luch.pid) return (EPERM); - error = copyin(args->datap,
svn commit: r346836 - stable/11/sys/compat/linux
Author: dchagin Date: Sun Apr 28 14:09:31 2019 New Revision: 346836 URL: https://svnweb.freebsd.org/changeset/base/346836 Log: MFC r335644 (by emaste@): Quiet unused fn warning for linuxulator w/o legacy syscalls. Modified: stable/11/sys/compat/linux/linux_sysctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linux/linux_sysctl.c == --- stable/11/sys/compat/linux/linux_sysctl.c Sun Apr 28 14:08:05 2019 (r346835) +++ stable/11/sys/compat/linux/linux_sysctl.c Sun Apr 28 14:09:31 2019 (r346836) @@ -86,6 +86,7 @@ LIN_SDT_PROBE_DEFINE2(sysctl, linux_sysctl, wrong_leng LIN_SDT_PROBE_DEFINE1(sysctl, linux_sysctl, unsupported_sysctl, "char *"); LIN_SDT_PROBE_DEFINE1(sysctl, linux_sysctl, return, "int"); +#ifdef LINUX_LEGACY_SYSCALLS static int handle_string(struct l___sysctl_args *la, char *value) { @@ -115,7 +116,6 @@ handle_string(struct l___sysctl_args *la, char *value) return (0); } -#ifdef LINUX_LEGACY_SYSCALLS int linux_sysctl(struct thread *td, struct linux_sysctl_args *args) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r346833 - stable/11/sys/compat/linux
Author: dchagin Date: Sun Apr 28 14:05:05 2019 New Revision: 346833 URL: https://svnweb.freebsd.org/changeset/base/346833 Log: MFC r335327 (by emaste@): linuxulator: add debugging for invalid capget/capset version. Modified: stable/11/sys/compat/linux/linux_misc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linux/linux_misc.c == --- stable/11/sys/compat/linux/linux_misc.c Sun Apr 28 14:03:32 2019 (r346832) +++ stable/11/sys/compat/linux/linux_misc.c Sun Apr 28 14:05:05 2019 (r346833) @@ -1892,6 +1892,11 @@ linux_capget(struct thread *td, struct linux_capget_ar return (error); if (luch.version != _LINUX_CAPABILITY_VERSION) { +#ifdef DEBUG + if (ldebug(capget)) + printf(LMSG("invalid capget capability version 0x%x"), + luch.version); +#endif luch.version = _LINUX_CAPABILITY_VERSION; error = copyout(, args->hdrp, sizeof(luch)); if (error) @@ -1931,6 +1936,11 @@ linux_capset(struct thread *td, struct linux_capset_ar return (error); if (luch.version != _LINUX_CAPABILITY_VERSION) { +#ifdef DEBUG + if (ldebug(capset)) + printf(LMSG("invalid capset capability version 0x%x"), + luch.version); +#endif luch.version = _LINUX_CAPABILITY_VERSION; error = copyout(, args->hdrp, sizeof(luch)); if (error) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r346832 - in stable/11/sys: amd64/linux amd64/linux32 compat/linux i386/linux
Author: dchagin Date: Sun Apr 28 14:03:32 2019 New Revision: 346832 URL: https://svnweb.freebsd.org/changeset/base/346832 Log: MFC r335201 (by emaste@): linuxulator: do not include legacy syscalls on arm64 Existing linuxulator platforms (i386, amd64) support legacy syscalls, such as non-*at ones like open, but arm64 and other new platforms do not. Wrap these in #ifdef LINUX_LEGACY_SYSCALLS, #defined in the MD linux.h files. We may need finer grained control in the future but this is sufficient for now. Modified: stable/11/sys/amd64/linux/linux.h stable/11/sys/amd64/linux32/linux.h stable/11/sys/compat/linux/linux_event.c stable/11/sys/compat/linux/linux_file.c stable/11/sys/compat/linux/linux_fork.c stable/11/sys/compat/linux/linux_misc.c stable/11/sys/compat/linux/linux_stats.c stable/11/sys/compat/linux/linux_sysctl.c stable/11/sys/i386/linux/linux.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/linux/linux.h == --- stable/11/sys/amd64/linux/linux.h Sun Apr 28 13:45:18 2019 (r346831) +++ stable/11/sys/amd64/linux/linux.h Sun Apr 28 14:03:32 2019 (r346832) @@ -35,6 +35,8 @@ #include #include +#defineLINUX_LEGACY_SYSCALLS + /* * debugging support */ Modified: stable/11/sys/amd64/linux32/linux.h == --- stable/11/sys/amd64/linux32/linux.h Sun Apr 28 13:45:18 2019 (r346831) +++ stable/11/sys/amd64/linux32/linux.h Sun Apr 28 14:03:32 2019 (r346832) @@ -36,6 +36,8 @@ #include #include +#defineLINUX_LEGACY_SYSCALLS + /* * debugging support */ Modified: stable/11/sys/compat/linux/linux_event.c == --- stable/11/sys/compat/linux/linux_event.cSun Apr 28 13:45:18 2019 (r346831) +++ stable/11/sys/compat/linux/linux_event.cSun Apr 28 14:03:32 2019 (r346832) @@ -263,6 +263,7 @@ epoll_create_common(struct thread *td, int flags) return (0); } +#ifdef LINUX_LEGACY_SYSCALLS int linux_epoll_create(struct thread *td, struct linux_epoll_create_args *args) { @@ -276,6 +277,7 @@ linux_epoll_create(struct thread *td, struct linux_epo return (epoll_create_common(td, 0)); } +#endif int linux_epoll_create1(struct thread *td, struct linux_epoll_create1_args *args) @@ -616,6 +618,7 @@ leave1: return (error); } +#ifdef LINUX_LEGACY_SYSCALLS int linux_epoll_wait(struct thread *td, struct linux_epoll_wait_args *args) { @@ -623,6 +626,7 @@ linux_epoll_wait(struct thread *td, struct linux_epoll return (linux_epoll_wait_common(td, args->epfd, args->events, args->maxevents, args->timeout, NULL)); } +#endif int linux_epoll_pwait(struct thread *td, struct linux_epoll_pwait_args *args) @@ -707,12 +711,14 @@ eventfd_create(struct thread *td, uint32_t initval, in return (error); } +#ifdef LINUX_LEGACY_SYSCALLS int linux_eventfd(struct thread *td, struct linux_eventfd_args *args) { return (eventfd_create(td, args->initval, 0)); } +#endif int linux_eventfd2(struct thread *td, struct linux_eventfd2_args *args) Modified: stable/11/sys/compat/linux/linux_file.c == --- stable/11/sys/compat/linux/linux_file.c Sun Apr 28 13:45:18 2019 (r346831) +++ stable/11/sys/compat/linux/linux_file.c Sun Apr 28 14:03:32 2019 (r346832) @@ -68,6 +68,7 @@ static intlinux_common_open(struct thread *, int, cha static int linux_getdents_error(struct thread *, int, int); +#ifdef LINUX_LEGACY_SYSCALLS int linux_creat(struct thread *td, struct linux_creat_args *args) { @@ -84,8 +85,8 @@ linux_creat(struct thread *td, struct linux_creat_args LFREEPATH(path); return (error); } +#endif - static int linux_common_open(struct thread *td, int dirfd, char *path, int l_flags, int mode) { @@ -166,7 +167,11 @@ linux_common_open(struct thread *td, int dirfd, char * done: #ifdef DEBUG +#ifdef LINUX_LEGACY_SYSCALLS if (ldebug(open)) +#else + if (ldebug(openat)) +#endif printf(LMSG("open returns error %d"), error); #endif LFREEPATH(path); @@ -192,6 +197,7 @@ linux_openat(struct thread *td, struct linux_openat_ar return (linux_common_open(td, dfd, path, args->flags, args->mode)); } +#ifdef LINUX_LEGACY_SYSCALLS int linux_open(struct thread *td, struct linux_open_args *args) { @@ -208,6 +214,7 @@ linux_open(struct thread *td, struct linux_open_args * #endif return (linux_common_open(td, AT_FDCWD, path, args->flags, args->mode)); } +#endif int linux_lseek(struct thread *td, struct linux_lseek_args *args) @@ -317,6 +324,7 @@ struct l_dirent64 { #defineLINUX_RECLEN64_RATIO(X) X *
svn commit: r346830 - stable/11/sys/compat/linux
Author: dchagin Date: Sun Apr 28 13:43:58 2019 New Revision: 346830 URL: https://svnweb.freebsd.org/changeset/base/346830 Log: MFC r332893 (by emaste@): Map FreeBSD EDOOFUS to Linux EINVAL Previously EDOOFUS mapped to EBUSY. EINVAL seems more appropriate. Modified: stable/11/sys/compat/linux/linux_errno.inc Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linux/linux_errno.inc == --- stable/11/sys/compat/linux/linux_errno.inc Sun Apr 28 13:42:34 2019 (r346829) +++ stable/11/sys/compat/linux/linux_errno.inc Sun Apr 28 13:43:58 2019 (r346830) @@ -132,7 +132,7 @@ const int linux_errtbl[ELAST + 1] = { -125, -84, -61, - -16,/* EDOOFUS -> EBUSY */ + -22,/* EDOOFUS -> EINVAL */ -74, -72, ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r346831 - stable/11/sys/compat/linux
Author: dchagin Date: Sun Apr 28 13:45:18 2019 New Revision: 346831 URL: https://svnweb.freebsd.org/changeset/base/346831 Log: MFC r335200 (by emaste@): Correct debug control for linuxulator faccessat The Linuxulator provides per-syscall debug control via the compat.linux.debug sysctl. There's generally a 1:1 mapping between sysctl setting and syscall, but faccessat was controlled by the access setting, perhaps due to copy-paste. Modified: stable/11/sys/compat/linux/linux_file.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linux/linux_file.c == --- stable/11/sys/compat/linux/linux_file.c Sun Apr 28 13:43:58 2019 (r346830) +++ stable/11/sys/compat/linux/linux_file.c Sun Apr 28 13:45:18 2019 (r346831) @@ -569,7 +569,7 @@ linux_faccessat(struct thread *td, struct linux_facces LCONVPATHEXIST_AT(td, args->filename, , dfd); #ifdef DEBUG - if (ldebug(access)) + if (ldebug(faccessat)) printf(ARGS(access, "%s, %d"), path, args->amode); #endif ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r346829 - in stable/11/sys: amd64/linux amd64/linux32 compat/linux i386/linux
rride standard shell script execution in order to - * be able to modify the interpreter path. We only do this if a Linux - * binary is doing the exec, so we do not create an EXEC module for it. - */ -static int -linux_exec_imgact_try(struct image_params *imgp) -{ - const char *head = (const char *)imgp->image_header; - char *rpath; - int error = -1; - - /* -* The interpreter for shell scripts run from a Linux binary needs -* to be located in /compat/linux if possible in order to recursively -* maintain Linux path emulation. -*/ - if (((const short *)head)[0] == SHELLMAGIC) { - /* -* Run our normal shell image activator. If it succeeds then -* attempt to use the alternate path for the interpreter. If -* an alternate path is found, use our stringspace to store it. -*/ - if ((error = exec_shell_imgact(imgp)) == 0) { - linux_emul_convpath(FIRST_THREAD_IN_PROC(imgp->proc), - imgp->interpreter_name, UIO_SYSSPACE, , 0, - AT_FDCWD); - if (rpath != NULL) - imgp->args->fname_buf = - imgp->interpreter_name = rpath; - } - } - return (error); } /* Modified: stable/11/sys/compat/linux/linux_emul.c == --- stable/11/sys/compat/linux/linux_emul.c Sun Apr 28 13:41:23 2019 (r346828) +++ stable/11/sys/compat/linux/linux_emul.c Sun Apr 28 13:42:34 2019 (r346829) @@ -1,6 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * + * Copyright (c) 1994-1996 Søren Schmidt * Copyright (c) 2006 Roman Divacky * Copyright (c) 2013 Dmitry Chagin * All rights reserved. @@ -32,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -48,6 +50,11 @@ __FBSDID("$FreeBSD$"); #include #include +#if BYTE_ORDER == LITTLE_ENDIAN +#define SHELLMAGIC 0x2123 /* #! */ +#else +#define SHELLMAGIC 0x2321 +#endif /* * This returns reference to the thread emuldata entry (if found) @@ -166,6 +173,42 @@ linux_proc_exit(void *arg __unused, struct proc *p) sx_destroy(>pem_sx); free(pem, M_LINUX); +} + +/* + * If a Linux binary is exec'ing something, try this image activator + * first. We override standard shell script execution in order to + * be able to modify the interpreter path. We only do this if a Linux + * binary is doing the exec, so we do not create an EXEC module for it. + */ +int +linux_exec_imgact_try(struct image_params *imgp) +{ + const char *head = (const char *)imgp->image_header; + char *rpath; + int error = -1; + + /* +* The interpreter for shell scripts run from a Linux binary needs +* to be located in /compat/linux if possible in order to recursively +* maintain Linux path emulation. +*/ + if (((const short *)head)[0] == SHELLMAGIC) { + /* +* Run our normal shell image activator. If it succeeds attempt +* to use the alternate path for the interpreter. If an +* alternate path is found, use our stringspace to store it. +*/ + if ((error = exec_shell_imgact(imgp)) == 0) { + linux_emul_convpath(FIRST_THREAD_IN_PROC(imgp->proc), + imgp->interpreter_name, UIO_SYSSPACE, , 0, + AT_FDCWD); + if (rpath != NULL) + imgp->args->fname_buf = + imgp->interpreter_name = rpath; + } + } + return (error); } int Modified: stable/11/sys/compat/linux/linux_emul.h == --- stable/11/sys/compat/linux/linux_emul.h Sun Apr 28 13:41:23 2019 (r346828) +++ stable/11/sys/compat/linux/linux_emul.h Sun Apr 28 13:42:34 2019 (r346829) @@ -49,6 +49,7 @@ struct linux_emuldata { struct linux_emuldata *em_find(struct thread *); +intlinux_exec_imgact_try(struct image_params *); void linux_proc_init(struct thread *, struct thread *, int); void linux_proc_exit(void *, struct proc *); void linux_schedtail(struct thread *); Modified: stable/11/sys/i386/linux/linux_sysvec.c == --- stable/11/sys/i386/linux/linux_sysvec.c Sun Apr 28 13:41:23 2019 (r346828) +++ stable/11/sys/i386/linux/linux_sysvec.c Sun Apr 28 13:42:34 2019 (r346829) @@ -76,12 +76,6 @@ __FBSDID("$FreeBSD$"); MODULE_VERSION(linux, 1); -#if BYTE_ORDER == L
svn commit: r346828 - in stable/11/sys: amd64/linux amd64/linux32 i386/linux
Author: dchagin Date: Sun Apr 28 13:41:23 2019 New Revision: 346828 URL: https://svnweb.freebsd.org/changeset/base/346828 Log: MFC r331462 (by emaste@): Remove redundant cast from Linuxulator SYSINITs. Modified: stable/11/sys/amd64/linux/linux_sysvec.c stable/11/sys/amd64/linux32/linux32_sysvec.c stable/11/sys/i386/linux/linux_sysvec.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/linux/linux_sysvec.c == --- stable/11/sys/amd64/linux/linux_sysvec.cSun Apr 28 13:40:17 2019 (r346827) +++ stable/11/sys/amd64/linux/linux_sysvec.cSun Apr 28 13:41:23 2019 (r346828) @@ -809,7 +809,7 @@ linux_vdso_install(void *param) (linux_platform - (caddr_t)elf_linux_sysvec.sv_shared_page_base); } SYSINIT(elf_linux_vdso_init, SI_SUB_EXEC, SI_ORDER_ANY, -(sysinit_cfunc_t)linux_vdso_install, NULL); +linux_vdso_install, NULL); static void linux_vdso_deinstall(void *param) @@ -818,7 +818,7 @@ linux_vdso_deinstall(void *param) __elfN(linux_shared_page_fini)(linux_shared_page_obj); } SYSUNINIT(elf_linux_vdso_uninit, SI_SUB_EXEC, SI_ORDER_FIRST, -(sysinit_cfunc_t)linux_vdso_deinstall, NULL); +linux_vdso_deinstall, NULL); static char GNULINUX_ABI_VENDOR[] = "GNU"; static int GNULINUX_ABI_DESC = 0; Modified: stable/11/sys/amd64/linux32/linux32_sysvec.c == --- stable/11/sys/amd64/linux32/linux32_sysvec.cSun Apr 28 13:40:17 2019(r346827) +++ stable/11/sys/amd64/linux32/linux32_sysvec.cSun Apr 28 13:41:23 2019(r346828) @@ -1008,7 +1008,7 @@ linux_vdso_install(void *param) (linux_platform - (caddr_t)elf_linux_sysvec.sv_shared_page_base); } SYSINIT(elf_linux_vdso_init, SI_SUB_EXEC, SI_ORDER_ANY, -(sysinit_cfunc_t)linux_vdso_install, NULL); +linux_vdso_install, NULL); static void linux_vdso_deinstall(void *param) @@ -1017,7 +1017,7 @@ linux_vdso_deinstall(void *param) __elfN(linux_shared_page_fini)(linux_shared_page_obj); } SYSUNINIT(elf_linux_vdso_uninit, SI_SUB_EXEC, SI_ORDER_FIRST, -(sysinit_cfunc_t)linux_vdso_deinstall, NULL); +linux_vdso_deinstall, NULL); static char GNU_ABI_VENDOR[] = "GNU"; static int GNULINUX_ABI_DESC = 0; Modified: stable/11/sys/i386/linux/linux_sysvec.c == --- stable/11/sys/i386/linux/linux_sysvec.c Sun Apr 28 13:40:17 2019 (r346827) +++ stable/11/sys/i386/linux/linux_sysvec.c Sun Apr 28 13:41:23 2019 (r346828) @@ -975,7 +975,7 @@ linux_vdso_install(void *param) elf_linux_sysvec.sv_shared_page_obj = linux_shared_page_obj; } SYSINIT(elf_linux_vdso_init, SI_SUB_EXEC, SI_ORDER_ANY, -(sysinit_cfunc_t)linux_vdso_install, NULL); +linux_vdso_install, NULL); static void linux_vdso_deinstall(void *param) @@ -984,7 +984,7 @@ linux_vdso_deinstall(void *param) __elfN(linux_shared_page_fini)(linux_shared_page_obj); } SYSUNINIT(elf_linux_vdso_uninit, SI_SUB_EXEC, SI_ORDER_FIRST, -(sysinit_cfunc_t)linux_vdso_deinstall, NULL); +linux_vdso_deinstall, NULL); static char GNU_ABI_VENDOR[] = "GNU"; static int GNULINUX_ABI_DESC = 0; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r346827 - in stable/11: lib/libsysdecode sys/amd64/linux sys/amd64/linux32 sys/compat/linux sys/i386/linux sys/modules/linux_common
Author: dchagin Date: Sun Apr 28 13:40:17 2019 New Revision: 346827 URL: https://svnweb.freebsd.org/changeset/base/346827 Log: MFC r331356 (by emaste@): Share Linux errno table with libsysdecode. Added: stable/11/sys/compat/linux/linux_errno.inc - copied unchanged from r331356, head/sys/compat/linux/linux_errno.inc Modified: stable/11/lib/libsysdecode/errno.c stable/11/sys/amd64/linux/linux_sysvec.c stable/11/sys/amd64/linux32/linux32_sysvec.c stable/11/sys/compat/linux/linux_emul.h stable/11/sys/compat/linux/linux_errno.c stable/11/sys/i386/linux/linux_sysvec.c stable/11/sys/modules/linux_common/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libsysdecode/errno.c == --- stable/11/lib/libsysdecode/errno.c Sun Apr 28 13:38:29 2019 (r346826) +++ stable/11/lib/libsysdecode/errno.c Sun Apr 28 13:40:17 2019 (r346827) @@ -37,25 +37,8 @@ __FBSDID("$FreeBSD$"); #include #if defined(__i386__) || defined(__amd64__) -/* - * Linux syscalls return negative errno's, we do positive and map them - * Reference: - * FreeBSD: src/sys/sys/errno.h - * Linux: include/uapi/asm-generic/errno-base.h - *include/uapi/asm-generic/errno.h - */ -static int bsd_to_linux_errno[ELAST + 1] = { - -0, -1, -2, -3, -4, -5, -6, -7, -8, -9, - -10, -35, -12, -13, -14, -15, -16, -17, -18, -19, - -20, -21, -22, -23, -24, -25, -26, -27, -28, -29, - -30, -31, -32, -33, -34, -11,-115,-114, -88, -89, - -90, -91, -92, -93, -94, -95, -96, -97, -98, -99, - -100,-101,-102,-103,-104,-105,-106,-107,-108,-109, - -110,-111, -40, -36,-112,-113, -39, -11, -87,-122, - -116, -66, -6, -6, -6, -6, -6, -37, -38, -9, - -6, -6, -43, -42, -75,-125, -84, -61, -16, -74, --72, -67, -71, -1, -1, -131, -130 -}; +static +#include #endif #if defined(__aarch64__) || defined(__amd64__) @@ -158,8 +141,8 @@ sysdecode_abi_to_freebsd_errno(enum sysdecode_abi abi, * This is imprecise since it returns the first * matching errno. */ - for (i = 0; i < nitems(bsd_to_linux_errno); i++) { - if (error == bsd_to_linux_errno[i]) + for (i = 0; i < nitems(linux_errtbl); i++) { + if (error == linux_errtbl[i]) return (i); } break; @@ -190,7 +173,7 @@ sysdecode_freebsd_to_abi_errno(enum sysdecode_abi abi, case SYSDECODE_ABI_LINUX: case SYSDECODE_ABI_LINUX32: if (error >= 0 && error <= ELAST) - return (bsd_to_linux_errno[error]); + return (linux_errtbl[error]); break; #endif #if defined(__aarch64__) || defined(__amd64__) Modified: stable/11/sys/amd64/linux/linux_sysvec.c == --- stable/11/sys/amd64/linux/linux_sysvec.cSun Apr 28 13:38:29 2019 (r346826) +++ stable/11/sys/amd64/linux/linux_sysvec.cSun Apr 28 13:40:17 2019 (r346827) @@ -751,7 +751,7 @@ struct sysentvec elf_linux_sysvec = { .sv_table = linux_sysent, .sv_mask= 0, .sv_errsize = ELAST + 1, - .sv_errtbl = bsd_to_linux_errno_generic, + .sv_errtbl = linux_errtbl, .sv_transtrap = linux_translate_traps, .sv_fixup = linux_fixup_elf, .sv_sendsig = linux_rt_sendsig, Modified: stable/11/sys/amd64/linux32/linux32_sysvec.c == --- stable/11/sys/amd64/linux32/linux32_sysvec.cSun Apr 28 13:38:29 2019(r346826) +++ stable/11/sys/amd64/linux32/linux32_sysvec.cSun Apr 28 13:40:17 2019(r346827) @@ -952,7 +952,7 @@ struct sysentvec elf_linux_sysvec = { .sv_table = linux32_sysent, .sv_mask= 0, .sv_errsize = ELAST + 1, - .sv_errtbl = bsd_to_linux_errno_generic, + .sv_errtbl = linux_errtbl, .sv_transtrap = linux_translate_traps, .sv_fixup = linux_fixup_elf, .sv_sendsig = linux_sendsig, Modified: stable/11/sys/compat/linux/linux_emul.h == --- stable/11/sys/compat/linux/linux_emul.h Sun Apr 28 13:38:29 2019 (r346826) +++ stable/11/sys/compat/linux/linux_emul.h Sun Apr 28 13:40:17 2019 (r346827) @@ -77,6 +77,6 @@ struct linux_pemuldata { struct linux_pemuldata *pem_find(struct proc *); -extern const int bsd_to_linux_errno_generic[]; +extern const int linux_errtbl[]; #endif /* !_LINUX_EMUL_H_ */ Modified: stable/11/sys/compat/linux/linux_errno.c
svn commit: r346826 - stable/11/sys/amd64/linux
Author: dchagin Date: Sun Apr 28 13:38:29 2019 New Revision: 346826 URL: https://svnweb.freebsd.org/changeset/base/346826 Log: MFC r331256 (by emaste@): Make linuxulator fn declaration match definition I accidentally swapped 'linux_fixup_elf' to 'linux_elf_fixup' in amd64's declaration (only), while bringing this change over from git and encountering a conflict. Modified: stable/11/sys/amd64/linux/linux_sysvec.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/linux/linux_sysvec.c == --- stable/11/sys/amd64/linux/linux_sysvec.cSun Apr 28 13:37:13 2019 (r346825) +++ stable/11/sys/amd64/linux/linux_sysvec.cSun Apr 28 13:38:29 2019 (r346826) @@ -119,7 +119,7 @@ extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler); static register_t * linux_copyout_strings(struct image_params *imgp); -static int linux_elf_fixup(register_t **stack_base, +static int linux_fixup_elf(register_t **stack_base, struct image_params *iparams); static boollinux_trans_osrel(const Elf_Note *note, int32_t *osrel); static voidlinux_vdso_install(void *param); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r346825 - in stable/11/sys: amd64/linux amd64/linux32 i386/linux
Author: dchagin Date: Sun Apr 28 13:37:13 2019 New Revision: 346825 URL: https://svnweb.freebsd.org/changeset/base/346825 Log: MFC r331226 (byu emaste@): Rename linuxulator functions with linux_ prefix It's preferable to have a consistent prefix. This also reduces differences between the three linux*_sysvec.c files. Modified: stable/11/sys/amd64/linux/linux_sysvec.c stable/11/sys/amd64/linux32/linux.h stable/11/sys/amd64/linux32/linux32_sysvec.c stable/11/sys/i386/linux/linux.h stable/11/sys/i386/linux/linux_sysvec.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/linux/linux_sysvec.c == --- stable/11/sys/amd64/linux/linux_sysvec.cSun Apr 28 13:35:36 2019 (r346824) +++ stable/11/sys/amd64/linux/linux_sysvec.cSun Apr 28 13:37:13 2019 (r346825) @@ -119,14 +119,14 @@ extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler); static register_t * linux_copyout_strings(struct image_params *imgp); -static int elf_linux_fixup(register_t **stack_base, +static int linux_elf_fixup(register_t **stack_base, struct image_params *iparams); static boollinux_trans_osrel(const Elf_Note *note, int32_t *osrel); static voidlinux_vdso_install(void *param); static voidlinux_vdso_deinstall(void *param); static voidlinux_set_syscall_retval(struct thread *td, int error); static int linux_fetch_syscall_args(struct thread *td); -static int exec_linux_imgact_try(struct image_params *iparams); +static int linux_exec_imgact_try(struct image_params *iparams); static voidlinux_exec_setregs(struct thread *td, struct image_params *imgp, u_long stack); static int linux_vsyscall(struct thread *td); @@ -180,7 +180,7 @@ LINUX_VDSO_SYM_CHAR(linux_platform); * MPSAFE */ static int -translate_traps(int signal, int trap_code) +linux_translate_traps(int signal, int trap_code) { if (signal != SIGBUS) @@ -246,7 +246,7 @@ linux_set_syscall_retval(struct thread *td, int error) } static int -elf_linux_fixup(register_t **stack_base, struct image_params *imgp) +linux_fixup_elf(register_t **stack_base, struct image_params *imgp) { Elf_Auxargs *args; Elf_Addr *base; @@ -259,7 +259,7 @@ elf_linux_fixup(register_t **stack_base, struct image_ arginfo = (struct ps_strings *)p->p_sysent->sv_psstrings; KASSERT(curthread->td_proc == imgp->proc, - ("unsafe elf_linux_fixup(), should be curproc")); + ("unsafe linux_fixup_elf(), should be curproc")); base = (Elf64_Addr *)*stack_base; args = (Elf64_Auxargs *)imgp->auxargs; pos = base + (imgp->args->argc + imgp->args->envc + 2); @@ -670,7 +670,7 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigse * binary is doing the exec, so we do not create an EXEC module for it. */ static int -exec_linux_imgact_try(struct image_params *imgp) +linux_exec_imgact_try(struct image_params *imgp) { const char *head = (const char *)imgp->image_header; char *rpath; @@ -752,14 +752,14 @@ struct sysentvec elf_linux_sysvec = { .sv_mask= 0, .sv_errsize = ELAST + 1, .sv_errtbl = bsd_to_linux_errno_generic, - .sv_transtrap = translate_traps, - .sv_fixup = elf_linux_fixup, + .sv_transtrap = linux_translate_traps, + .sv_fixup = linux_fixup_elf, .sv_sendsig = linux_rt_sendsig, .sv_sigcode = &_binary_linux_locore_o_start, .sv_szsigcode = _szsigcode, .sv_name= "Linux ELF64", .sv_coredump= elf64_coredump, - .sv_imgact_try = exec_linux_imgact_try, + .sv_imgact_try = linux_exec_imgact_try, .sv_minsigstksz = LINUX_MINSIGSTKSZ, .sv_pagesize= PAGE_SIZE, .sv_minuser = VM_MIN_ADDRESS, Modified: stable/11/sys/amd64/linux32/linux.h == --- stable/11/sys/amd64/linux32/linux.h Sun Apr 28 13:35:36 2019 (r346824) +++ stable/11/sys/amd64/linux32/linux.h Sun Apr 28 13:37:13 2019 (r346825) @@ -114,7 +114,7 @@ typedef struct { */ #defineLINUX_AT_COUNT 20 /* Count of used aux entry types. * Keep this synchronized with -* elf_linux_fixup() code. +* linux_fixup_elf() code. */ struct l___sysctl_args { Modified: stable/11/sys/amd64/linux32/linux32_sysvec.c == --- stable/11/sys/amd64/linux32/linux32_sysvec.cSun Apr 28 13:35:36 2019(r346824) +++
svn commit: r346824 - in stable/11/sys: amd64/linux amd64/linux32 i386/linux
Author: dchagin Date: Sun Apr 28 13:35:36 2019 New Revision: 346824 URL: https://svnweb.freebsd.org/changeset/base/346824 Log: MFC r331208 (by emaste@): linux*_sysvec.c: rationalize whitespace and comments There's a fair amount of duplication between MD linuxulator files. Make indentation and comments consistent between the three versions of linux_sysvec.c to reduce diffs when comparing them. Modified: stable/11/sys/amd64/linux/linux_sysvec.c stable/11/sys/amd64/linux32/linux32_sysvec.c stable/11/sys/i386/linux/linux_sysvec.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/linux/linux_sysvec.c == --- stable/11/sys/amd64/linux/linux_sysvec.cSun Apr 28 13:33:35 2019 (r346823) +++ stable/11/sys/amd64/linux/linux_sysvec.cSun Apr 28 13:35:36 2019 (r346824) @@ -126,6 +126,7 @@ static void linux_vdso_install(void *param); static voidlinux_vdso_deinstall(void *param); static voidlinux_set_syscall_retval(struct thread *td, int error); static int linux_fetch_syscall_args(struct thread *td); +static int exec_linux_imgact_try(struct image_params *iparams); static voidlinux_exec_setregs(struct thread *td, struct image_params *imgp, u_long stack); static int linux_vsyscall(struct thread *td); @@ -668,8 +669,6 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigse * be able to modify the interpreter path. We only do this if a Linux * binary is doing the exec, so we do not create an EXEC module for it. */ -static int exec_linux_imgact_try(struct image_params *iparams); - static int exec_linux_imgact_try(struct image_params *imgp) { @@ -684,15 +683,14 @@ exec_linux_imgact_try(struct image_params *imgp) */ if (((const short *)head)[0] == SHELLMAGIC) { /* -* Run our normal shell image activator. If it succeeds -* attempt to use the alternate path for the interpreter. -* If an alternate path is found, use our stringspace -* to store it. +* Run our normal shell image activator. If it succeeds then +* attempt to use the alternate path for the interpreter. If +* an alternate path is found, use our stringspace to store it. */ if ((error = exec_shell_imgact(imgp)) == 0) { linux_emul_convpath(FIRST_THREAD_IN_PROC(imgp->proc), - imgp->interpreter_name, UIO_SYSSPACE, - , 0, AT_FDCWD); + imgp->interpreter_name, UIO_SYSSPACE, , 0, + AT_FDCWD); if (rpath != NULL) imgp->args->fname_buf = imgp->interpreter_name = rpath; Modified: stable/11/sys/amd64/linux32/linux32_sysvec.c == --- stable/11/sys/amd64/linux32/linux32_sysvec.cSun Apr 28 13:33:35 2019(r346823) +++ stable/11/sys/amd64/linux32/linux32_sysvec.cSun Apr 28 13:35:36 2019(r346824) @@ -124,6 +124,7 @@ static int elf_linux_fixup(register_t **stack_base, struct image_params *iparams); static register_t *linux_copyout_strings(struct image_params *imgp); static void linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask); +static int exec_linux_imgact_try(struct image_params *iparams); static voidexec_linux_setregs(struct thread *td, struct image_params *imgp, u_long stack); static voidlinux32_fixlimit(struct rlimit *rl, int which); @@ -722,8 +723,6 @@ linux32_fetch_syscall_args(struct thread *td) * be able to modify the interpreter path. We only do this if a Linux * binary is doing the exec, so we do not create an EXEC module for it. */ -static int exec_linux_imgact_try(struct image_params *iparams); - static int exec_linux_imgact_try(struct image_params *imgp) { @@ -732,16 +731,16 @@ exec_linux_imgact_try(struct image_params *imgp) int error = -1; /* - * The interpreter for shell scripts run from a Linux binary needs - * to be located in /compat/linux if possible in order to recursively - * maintain Linux path emulation. - */ +* The interpreter for shell scripts run from a Linux binary needs +* to be located in /compat/linux if possible in order to recursively +* maintain Linux path emulation. +*/ if (((const short *)head)[0] == SHELLMAGIC) { /* - * Run our normal shell image activator. If it succeeds attempt - * to use the alternate path for the interpreter. If an - * alternate * path is found, use our stringspace to store it. -
svn commit: r346823 - in stable/11: lib/libsysdecode sys/amd64/linux sys/amd64/linux32 sys/compat/linux sys/conf sys/i386/linux sys/modules/linux sys/modules/linux_common
Author: dchagin Date: Sun Apr 28 13:33:35 2019 New Revision: 346823 URL: https://svnweb.freebsd.org/changeset/base/346823 Log: MFC r331056: Share a single bsd-linux errno table across MD consumers Three copies of the linuxulator linux_sysvec.c contained identical BSD to Linux errno translation tables, and future work to support other architectures will also use the same table. Move the table to a common file to be used by all. Make it 'const int' to place it in .rodata. (Some existing Linux architectures use MD errno values, but x86 and Arm share the generic set.) This change should introduce no functional change; a followup will add missing errno values. MFC r331057: linux_errno.c: add newer errno values Also introduce a static assert to ensure the list is kept up to date. MFC r331060: Chase r331057 in libsysdecode erno table Added: stable/11/sys/compat/linux/linux_errno.c - copied, changed from r331056, head/sys/compat/linux/linux_errno.c Modified: stable/11/lib/libsysdecode/errno.c stable/11/sys/amd64/linux/linux_sysvec.c stable/11/sys/amd64/linux32/linux32_sysvec.c stable/11/sys/compat/linux/linux_emul.h stable/11/sys/conf/files.amd64 stable/11/sys/conf/files.i386 stable/11/sys/i386/linux/linux_sysvec.c stable/11/sys/modules/linux/Makefile stable/11/sys/modules/linux_common/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libsysdecode/errno.c == --- stable/11/lib/libsysdecode/errno.c Sun Apr 28 13:29:29 2019 (r346822) +++ stable/11/lib/libsysdecode/errno.c Sun Apr 28 13:33:35 2019 (r346823) @@ -41,8 +41,8 @@ __FBSDID("$FreeBSD$"); * Linux syscalls return negative errno's, we do positive and map them * Reference: * FreeBSD: src/sys/sys/errno.h - * Linux: linux-2.6.17.8/include/asm-generic/errno-base.h - *linux-2.6.17.8/include/asm-generic/errno.h + * Linux: include/uapi/asm-generic/errno-base.h + *include/uapi/asm-generic/errno.h */ static int bsd_to_linux_errno[ELAST + 1] = { -0, -1, -2, -3, -4, -5, -6, -7, -8, -9, @@ -54,7 +54,7 @@ static int bsd_to_linux_errno[ELAST + 1] = { -110,-111, -40, -36,-112,-113, -39, -11, -87,-122, -116, -66, -6, -6, -6, -6, -6, -37, -38, -9, -6, -6, -43, -42, -75,-125, -84, -61, -16, -74, --72, -67, -71 +-72, -67, -71, -1, -1, -131, -130 }; #endif Modified: stable/11/sys/amd64/linux/linux_sysvec.c == --- stable/11/sys/amd64/linux/linux_sysvec.cSun Apr 28 13:29:29 2019 (r346822) +++ stable/11/sys/amd64/linux/linux_sysvec.cSun Apr 28 13:33:35 2019 (r346823) @@ -130,26 +130,6 @@ static voidlinux_exec_setregs(struct thread *td, stru u_long stack); static int linux_vsyscall(struct thread *td); -/* - * Linux syscalls return negative errno's, we do positive and map them - * Reference: - * FreeBSD: src/sys/sys/errno.h - * Linux: linux-2.6.17.8/include/asm-generic/errno-base.h - *linux-2.6.17.8/include/asm-generic/errno.h - */ -static int bsd_to_linux_errno[ELAST + 1] = { - -0, -1, -2, -3, -4, -5, -6, -7, -8, -9, - -10, -35, -12, -13, -14, -15, -16, -17, -18, -19, - -20, -21, -22, -23, -24, -25, -26, -27, -28, -29, - -30, -31, -32, -33, -34, -11,-115,-114, -88, -89, - -90, -91, -92, -93, -94, -95, -96, -97, -98, -99, - -100,-101,-102,-103,-104,-105,-106,-107,-108,-109, - -110,-111, -40, -36,-112,-113, -39, -11, -87,-122, - -116, -66, -6, -6, -6, -6, -6, -37, -38, -9, - -6, -6, -43, -42, -75,-125, -84, -61, -16, -74, --72, -67, -71 -}; - #define LINUX_T_UNKNOWN 255 static int _bsd_to_linux_trapcode[] = { LINUX_T_UNKNOWN,/* 0 */ @@ -773,7 +753,7 @@ struct sysentvec elf_linux_sysvec = { .sv_table = linux_sysent, .sv_mask= 0, .sv_errsize = ELAST + 1, - .sv_errtbl = bsd_to_linux_errno, + .sv_errtbl = bsd_to_linux_errno_generic, .sv_transtrap = translate_traps, .sv_fixup = elf_linux_fixup, .sv_sendsig = linux_rt_sendsig, Modified: stable/11/sys/amd64/linux32/linux32_sysvec.c == --- stable/11/sys/amd64/linux32/linux32_sysvec.cSun Apr 28 13:29:29 2019(r346822) +++ stable/11/sys/amd64/linux32/linux32_sysvec.cSun Apr 28 13:33:35 2019(r346823) @@ -131,26 +131,6 @@ static boollinux32_trans_osrel(const Elf_Note *note, static voidlinux_vdso_install(void *param); static voidlinux_vdso_deinstall(void *param); -/* - * Linux syscalls return negative errno's, we do positive and map them - * Reference: -
svn commit: r346822 - in stable/11/sys: amd64/linux amd64/linux32 i386/linux
Author: dchagin Date: Sun Apr 28 13:29:29 2019 New Revision: 346822 URL: https://svnweb.freebsd.org/changeset/base/346822 Log: MFC r330927 (by emaste@): Remove stray ; at end of linux_vdso_deinstall() Modified: stable/11/sys/amd64/linux/linux_sysvec.c stable/11/sys/amd64/linux32/linux32_sysvec.c stable/11/sys/i386/linux/linux_sysvec.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/linux/linux_sysvec.c == --- stable/11/sys/amd64/linux/linux_sysvec.cSun Apr 28 13:28:05 2019 (r346821) +++ stable/11/sys/amd64/linux/linux_sysvec.cSun Apr 28 13:29:29 2019 (r346822) @@ -838,7 +838,7 @@ linux_vdso_deinstall(void *param) { __elfN(linux_shared_page_fini)(linux_shared_page_obj); -}; +} SYSUNINIT(elf_linux_vdso_uninit, SI_SUB_EXEC, SI_ORDER_FIRST, (sysinit_cfunc_t)linux_vdso_deinstall, NULL); Modified: stable/11/sys/amd64/linux32/linux32_sysvec.c == --- stable/11/sys/amd64/linux32/linux32_sysvec.cSun Apr 28 13:28:05 2019(r346821) +++ stable/11/sys/amd64/linux32/linux32_sysvec.cSun Apr 28 13:29:29 2019(r346822) @@ -1036,7 +1036,7 @@ linux_vdso_deinstall(void *param) { __elfN(linux_shared_page_fini)(linux_shared_page_obj); -}; +} SYSUNINIT(elf_linux_vdso_uninit, SI_SUB_EXEC, SI_ORDER_FIRST, (sysinit_cfunc_t)linux_vdso_deinstall, NULL); Modified: stable/11/sys/i386/linux/linux_sysvec.c == --- stable/11/sys/i386/linux/linux_sysvec.c Sun Apr 28 13:28:05 2019 (r346821) +++ stable/11/sys/i386/linux/linux_sysvec.c Sun Apr 28 13:29:29 2019 (r346822) @@ -1002,7 +1002,7 @@ linux_vdso_deinstall(void *param) { __elfN(linux_shared_page_fini)(linux_shared_page_obj); -}; +} SYSUNINIT(elf_linux_vdso_uninit, SI_SUB_EXEC, SI_ORDER_FIRST, (sysinit_cfunc_t)linux_vdso_deinstall, NULL); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r346821 - in stable/11/sys: amd64/linux amd64/linux32 i386/linux kern sys
Author: dchagin Date: Sun Apr 28 13:28:05 2019 New Revision: 346821 URL: https://svnweb.freebsd.org/changeset/base/346821 Log: MFC r330866 (by emaste@): Use C99 boolean type for translate_osrel Migrate to modern types before creating MD Linuxolator bits for new architectures. Modified: stable/11/sys/amd64/linux/linux_sysvec.c stable/11/sys/amd64/linux32/linux32_sysvec.c stable/11/sys/i386/linux/linux_sysvec.c stable/11/sys/kern/imgact_elf.c stable/11/sys/sys/imgact_elf.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/linux/linux_sysvec.c == --- stable/11/sys/amd64/linux/linux_sysvec.cSun Apr 28 13:26:55 2019 (r346820) +++ stable/11/sys/amd64/linux/linux_sysvec.cSun Apr 28 13:28:05 2019 (r346821) @@ -121,7 +121,7 @@ SET_DECLARE(linux_ioctl_handler_set, struct linux_ioct static register_t * linux_copyout_strings(struct image_params *imgp); static int elf_linux_fixup(register_t **stack_base, struct image_params *iparams); -static boolean_t linux_trans_osrel(const Elf_Note *note, int32_t *osrel); +static boollinux_trans_osrel(const Elf_Note *note, int32_t *osrel); static voidlinux_vdso_install(void *param); static voidlinux_vdso_deinstall(void *param); static voidlinux_set_syscall_retval(struct thread *td, int error); @@ -845,7 +845,7 @@ SYSUNINIT(elf_linux_vdso_uninit, SI_SUB_EXEC, SI_ORDER static char GNULINUX_ABI_VENDOR[] = "GNU"; static int GNULINUX_ABI_DESC = 0; -static boolean_t +static bool linux_trans_osrel(const Elf_Note *note, int32_t *osrel) { const Elf32_Word *desc; @@ -856,7 +856,7 @@ linux_trans_osrel(const Elf_Note *note, int32_t *osrel desc = (const Elf32_Word *)p; if (desc[0] != GNULINUX_ABI_DESC) - return (FALSE); + return (false); /* * For Linux we encode osrel as follows (see linux_mib.c): @@ -864,7 +864,7 @@ linux_trans_osrel(const Elf_Note *note, int32_t *osrel */ *osrel = desc[1] * 100 + desc[2] * 1000 + desc[3]; - return (TRUE); + return (true); } static Elf_Brandnote linux64_brandnote = { Modified: stable/11/sys/amd64/linux32/linux32_sysvec.c == --- stable/11/sys/amd64/linux32/linux32_sysvec.cSun Apr 28 13:26:55 2019(r346820) +++ stable/11/sys/amd64/linux32/linux32_sysvec.cSun Apr 28 13:28:05 2019(r346821) @@ -127,7 +127,7 @@ static void linux_sendsig(sig_t catcher, ksiginfo_ static voidexec_linux_setregs(struct thread *td, struct image_params *imgp, u_long stack); static voidlinux32_fixlimit(struct rlimit *rl, int which); -static boolean_t linux32_trans_osrel(const Elf_Note *note, int32_t *osrel); +static boollinux32_trans_osrel(const Elf_Note *note, int32_t *osrel); static voidlinux_vdso_install(void *param); static voidlinux_vdso_deinstall(void *param); @@ -1043,7 +1043,7 @@ SYSUNINIT(elf_linux_vdso_uninit, SI_SUB_EXEC, SI_ORDER static char GNU_ABI_VENDOR[] = "GNU"; static int GNULINUX_ABI_DESC = 0; -static boolean_t +static bool linux32_trans_osrel(const Elf_Note *note, int32_t *osrel) { const Elf32_Word *desc; @@ -1054,7 +1054,7 @@ linux32_trans_osrel(const Elf_Note *note, int32_t *osr desc = (const Elf32_Word *)p; if (desc[0] != GNULINUX_ABI_DESC) - return (FALSE); + return (false); /* * For Linux we encode osrel as follows (see linux_mib.c): @@ -1062,7 +1062,7 @@ linux32_trans_osrel(const Elf_Note *note, int32_t *osr */ *osrel = desc[1] * 100 + desc[2] * 1000 + desc[3]; - return (TRUE); + return (true); } static Elf_Brandnote linux32_brandnote = { Modified: stable/11/sys/i386/linux/linux_sysvec.c == --- stable/11/sys/i386/linux/linux_sysvec.c Sun Apr 28 13:26:55 2019 (r346820) +++ stable/11/sys/i386/linux/linux_sysvec.c Sun Apr 28 13:28:05 2019 (r346821) @@ -115,7 +115,7 @@ static void linux_sendsig(sig_t catcher, ksiginfo_ static voidexec_linux_setregs(struct thread *td, struct image_params *imgp, u_long stack); static register_t *linux_copyout_strings(struct image_params *imgp); -static boolean_t linux_trans_osrel(const Elf_Note *note, int32_t *osrel); +static boollinux_trans_osrel(const Elf_Note *note, int32_t *osrel); static voidlinux_vdso_install(void *param); static voidlinux_vdso_deinstall(void *param); @@ -1009,7 +1009,7 @@ SYSUNINIT(elf_linux_vdso_uninit, SI_SUB_EXEC, SI_ORDER static char GNU_ABI_VENDOR[] = "GNU"; static int GNULINUX_ABI_DESC = 0; -static boolean_t +static bool linux_trans_osrel(const Elf_Note
svn commit: r346820 - stable/11/sys/i386/linux
Author: dchagin Date: Sun Apr 28 13:26:55 2019 New Revision: 346820 URL: https://svnweb.freebsd.org/changeset/base/346820 Log: MFC r330822 (by emaste@): imgact_linux.c: use standard indentation. Modified: stable/11/sys/i386/linux/imgact_linux.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/i386/linux/imgact_linux.c == --- stable/11/sys/i386/linux/imgact_linux.c Sun Apr 28 13:23:52 2019 (r346819) +++ stable/11/sys/i386/linux/imgact_linux.c Sun Apr 28 13:26:55 2019 (r346820) @@ -60,176 +60,166 @@ static intexec_linux_imgact(struct image_params *ipar static int exec_linux_imgact(struct image_params *imgp) { -const struct exec *a_out = (const struct exec *) imgp->image_header; -struct vmspace *vmspace; -vm_offset_t vmaddr; -unsigned long virtual_offset, file_offset; -unsigned long bss_size; -ssize_t aresid; -int error; + const struct exec *a_out = (const struct exec *) imgp->image_header; + struct vmspace *vmspace; + vm_offset_t vmaddr; + unsigned long virtual_offset, file_offset; + unsigned long bss_size; + ssize_t aresid; + int error; -if (((a_out->a_magic >> 16) & 0xff) != 0x64) - return (-1); + if (((a_out->a_magic >> 16) & 0xff) != 0x64) + return (-1); -/* - * Set file/virtual offset based on a.out variant. - */ -switch ((int)(a_out->a_magic & 0x)) { -case 0413: - virtual_offset = 0; - file_offset = 1024; - break; -case 0314: - virtual_offset = 4096; - file_offset = 0; - break; -default: - return (-1); -} -bss_size = round_page(a_out->a_bss); + /* +* Set file/virtual offset based on a.out variant. +*/ + switch ((int)(a_out->a_magic & 0x)) { + case 0413: + virtual_offset = 0; + file_offset = 1024; + break; + case 0314: + virtual_offset = 4096; + file_offset = 0; + break; + default: + return (-1); + } + bss_size = round_page(a_out->a_bss); #ifdef DEBUG -printf("imgact: text: %08lx, data: %08lx, bss: %08lx\n", - (u_long)a_out->a_text, (u_long)a_out->a_data, bss_size); + printf("imgact: text: %08lx, data: %08lx, bss: %08lx\n", + (u_long)a_out->a_text, (u_long)a_out->a_data, bss_size); #endif -/* - * Check various fields in header for validity/bounds. - */ -if (a_out->a_entry < virtual_offset || - a_out->a_entry >= virtual_offset + a_out->a_text || - a_out->a_text & PAGE_MASK || a_out->a_data & PAGE_MASK) - return (-1); + /* +* Check various fields in header for validity/bounds. +*/ + if (a_out->a_entry < virtual_offset || + a_out->a_entry >= virtual_offset + a_out->a_text || + a_out->a_text & PAGE_MASK || a_out->a_data & PAGE_MASK) + return (-1); -/* text + data can't exceed file size */ -if (a_out->a_data + a_out->a_text > imgp->attr->va_size) - return (EFAULT); -/* - * text/data/bss must not exceed limits - */ -PROC_LOCK(imgp->proc); -if (a_out->a_text > maxtsiz || - a_out->a_data + bss_size > lim_cur_proc(imgp->proc, RLIMIT_DATA) || - racct_set(imgp->proc, RACCT_DATA, a_out->a_data + bss_size) != 0) { + /* text + data can't exceed file size */ + if (a_out->a_data + a_out->a_text > imgp->attr->va_size) + return (EFAULT); + /* +* text/data/bss must not exceed limits +*/ + PROC_LOCK(imgp->proc); + if (a_out->a_text > maxtsiz || + a_out->a_data + bss_size > lim_cur_proc(imgp->proc, RLIMIT_DATA) || + racct_set(imgp->proc, RACCT_DATA, a_out->a_data + bss_size) != 0) { + PROC_UNLOCK(imgp->proc); + return (ENOMEM); + } PROC_UNLOCK(imgp->proc); - return (ENOMEM); -} -PROC_UNLOCK(imgp->proc); -VOP_UNLOCK(imgp->vp, 0); + VOP_UNLOCK(imgp->vp, 0); -/* - * Destroy old process VM and create a new one (with a new stack) - */ -error = exec_new_vmspace(imgp, _sysvec); -if (error) - goto fail; -vmspace = imgp->proc->p_vmspace; - -/* - * Check if file_offset page aligned,. - * Currently we cannot handle misaligned file offsets, - * and so we read in the entire image (what a waste). - */ -if (file_offset & PAGE_MASK) { -#ifdef DEBUG - printf("imgact: Non page aligned binary %lu\n", file_offset); -#endif /* -* Map text+data+bss read/write/execute +* Destroy old process VM and create a new one (with a new stack) */ - vmaddr = virtual_offset; - error = vm_map_find(>vm_map, NULL, 0, , - a_out->a_text +
svn commit: r346819 - in stable/11/sys: compat/linux i386/linux
Author: dchagin Date: Sun Apr 28 13:23:52 2019 New Revision: 346819 URL: https://svnweb.freebsd.org/changeset/base/346819 Log: MFC r330798 (by emaste@): Linuxulator: apply style(9) to return. Modified: stable/11/sys/compat/linux/linux_ioctl.c stable/11/sys/compat/linux/linux_signal.c stable/11/sys/compat/linux/linux_stats.c stable/11/sys/compat/linux/linux_util.c stable/11/sys/i386/linux/imgact_linux.c stable/11/sys/i386/linux/linux_machdep.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linux/linux_ioctl.c == --- stable/11/sys/compat/linux/linux_ioctl.cSun Apr 28 13:22:30 2019 (r346818) +++ stable/11/sys/compat/linux/linux_ioctl.cSun Apr 28 13:23:52 2019 (r346819) @@ -388,7 +388,7 @@ linux_to_bsd_speed(int code, struct speedtab *table) for ( ; table->sp_code != -1; table++) if (table->sp_code == code) return (table->sp_speed); - return -1; + return (-1); } static int @@ -397,7 +397,7 @@ bsd_to_linux_speed(int speed, struct speedtab *table) for ( ; table->sp_speed != -1; table++) if (table->sp_speed == speed) return (table->sp_code); - return -1; + return (-1); } static void @@ -2673,7 +2673,7 @@ static int linux_ioctl_drm(struct thread *td, struct linux_ioctl_args *args) { args->cmd = SETDIR(args->cmd); - return sys_ioctl(td, (struct ioctl_args *)args); + return (sys_ioctl(td, (struct ioctl_args *)args)); } #ifdef COMPAT_LINUX32 @@ -3282,9 +3282,9 @@ linux_to_bsd_v4l2_format(struct l_v4l2_format *lvf, st * XXX TODO - needs 32 -> 64 bit conversion: * (unused by webcams?) */ - return EINVAL; + return (EINVAL); memcpy(>fmt, >fmt, sizeof(vf->fmt)); - return 0; + return (0); } static int @@ -3300,9 +3300,9 @@ bsd_to_linux_v4l2_format(struct v4l2_format *vf, struc * XXX TODO - needs 32 -> 64 bit conversion: * (unused by webcams?) */ - return EINVAL; + return (EINVAL); memcpy(>fmt, >fmt, sizeof(vf->fmt)); - return 0; + return (0); } static int linux_ioctl_v4l2(struct thread *td, struct linux_ioctl_args *args) @@ -3322,7 +3322,7 @@ linux_ioctl_v4l2(struct thread *td, struct linux_ioctl case LINUX_VIDIOC_RESERVED: case LINUX_VIDIOC_LOG_STATUS: if ((args->cmd & IOC_DIRMASK) != LINUX_IOC_VOID) - return ENOIOCTL; + return (ENOIOCTL); args->cmd = (args->cmd & 0x) | IOC_VOID; break; Modified: stable/11/sys/compat/linux/linux_signal.c == --- stable/11/sys/compat/linux/linux_signal.c Sun Apr 28 13:22:30 2019 (r346818) +++ stable/11/sys/compat/linux/linux_signal.c Sun Apr 28 13:23:52 2019 (r346819) @@ -279,7 +279,7 @@ linux_rt_sigprocmask(struct thread *td, struct linux_r #endif if (args->sigsetsize != sizeof(l_sigset_t)) - return EINVAL; + return (EINVAL); if (args->mask != NULL) { error = copyin(args->mask, , sizeof(l_sigset_t)); @@ -377,7 +377,7 @@ linux_rt_sigpending(struct thread *td, struct linux_rt l_sigset_t lset; if (args->sigsetsize > sizeof(lset)) - return EINVAL; + return (EINVAL); /* NOT REACHED */ #ifdef DEBUG Modified: stable/11/sys/compat/linux/linux_stats.c == --- stable/11/sys/compat/linux/linux_stats.cSun Apr 28 13:22:30 2019 (r346818) +++ stable/11/sys/compat/linux/linux_stats.cSun Apr 28 13:23:52 2019 (r346819) @@ -436,7 +436,7 @@ linux_statfs64(struct thread *td, struct linux_statfs6 int error; if (args->bufsize != sizeof(struct l_statfs64)) - return EINVAL; + return (EINVAL); LCONVPATHEXIST(td, args->path, ); Modified: stable/11/sys/compat/linux/linux_util.c == --- stable/11/sys/compat/linux/linux_util.c Sun Apr 28 13:22:30 2019 (r346818) +++ stable/11/sys/compat/linux/linux_util.c Sun Apr 28 13:23:52 2019 (r346819) @@ -114,7 +114,7 @@ linux_driver_get_name_dev(device_t dev) const char *device_name = device_get_name(dev); if (device_name == NULL) - return NULL; + return (NULL); TAILQ_FOREACH(de, , list) { if (strcmp(device_name, de->entry.bsd_driver_name) == 0) return (de->entry.linux_driver_name); @@ -131,7
svn commit: r346817 - in stable/11/sys: amd64/linux amd64/linux32 compat/freebsd32 dev/aic7xxx dev/drm2 dev/xen/blkback dev/xen/netback i386/ibcs2 i386/linux i386/pci kern netgraph x86/include
Author: dchagin Date: Sun Apr 28 13:21:01 2019 New Revision: 346817 URL: https://svnweb.freebsd.org/changeset/base/346817 Log: MFC r329873 (by emaste@): Correct pseudo misspelling in sys/ comments contrib code and #define in intel_ata.h unchanged. Modified: stable/11/sys/amd64/linux/syscalls.master stable/11/sys/amd64/linux32/syscalls.master stable/11/sys/compat/freebsd32/syscalls.master stable/11/sys/dev/aic7xxx/aic7xxx.seq stable/11/sys/dev/drm2/drm_fb_helper.c stable/11/sys/dev/xen/blkback/blkback.c stable/11/sys/dev/xen/netback/netback.c stable/11/sys/i386/ibcs2/syscalls.master stable/11/sys/i386/linux/syscalls.master stable/11/sys/i386/pci/pci_pir.c stable/11/sys/kern/syscalls.master stable/11/sys/netgraph/ng_atmllc.c stable/11/sys/x86/include/apicvar.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/linux/syscalls.master == --- stable/11/sys/amd64/linux/syscalls.master Sun Apr 28 13:19:28 2019 (r346816) +++ stable/11/sys/amd64/linux/syscalls.master Sun Apr 28 13:21:01 2019 (r346817) @@ -12,7 +12,7 @@ ; case where the event exists, but we don't want auditing, the ; event should be #defined to AUE_NULL in audit_kevents.h. ; typeone of STD, NOPROTO, UNIMPL -; namepsuedo-prototype of syscall routine +; namepseudo-prototype of syscall routine ; If one of the following alts is different, then all appear: ; altname name of system call if different ; alttag name of args struct tag if different from [o]`name'"_args" Modified: stable/11/sys/amd64/linux32/syscalls.master == --- stable/11/sys/amd64/linux32/syscalls.master Sun Apr 28 13:19:28 2019 (r346816) +++ stable/11/sys/amd64/linux32/syscalls.master Sun Apr 28 13:21:01 2019 (r346817) @@ -12,7 +12,7 @@ ; case where the event exists, but we don't want auditing, the ; event should be #defined to AUE_NULL in audit_kevents.h. ; typeone of STD, NOPROTO, UNIMPL -; namepsuedo-prototype of syscall routine +; namepseudo-prototype of syscall routine ; If one of the following alts is different, then all appear: ; altname name of system call if different ; alttag name of args struct tag if different from [o]`name'"_args" Modified: stable/11/sys/compat/freebsd32/syscalls.master == --- stable/11/sys/compat/freebsd32/syscalls.master Sun Apr 28 13:19:28 2019(r346816) +++ stable/11/sys/compat/freebsd32/syscalls.master Sun Apr 28 13:21:01 2019(r346817) @@ -16,7 +16,7 @@ ; COMPAT7, NODEF, NOARGS, NOPROTO, NOSTD ; The COMPAT* options may be combined with one or more NO* ; options separated by '|' with no spaces (e.g. COMPAT|NOARGS) -; namepsuedo-prototype of syscall routine +; namepseudo-prototype of syscall routine ; If one of the following alts is different, then all appear: ; altname name of system call if different ; alttag name of args struct tag if different from [o]`name'"_args" Modified: stable/11/sys/dev/aic7xxx/aic7xxx.seq == --- stable/11/sys/dev/aic7xxx/aic7xxx.seq Sun Apr 28 13:19:28 2019 (r346816) +++ stable/11/sys/dev/aic7xxx/aic7xxx.seq Sun Apr 28 13:21:01 2019 (r346817) @@ -57,7 +57,7 @@ PREFIX = "ahc_" * a later time. This problem cannot be resolved by holding a single entry * in scratch ram since a reconnecting target can request sense and this will * create yet another SCB waiting for selection. The solution used here is to - * use byte 27 of the SCB as a psuedo-next pointer and to thread a list + * use byte 27 of the SCB as a pseudo-next pointer and to thread a list * of SCBs that are awaiting selection. Since 0-0xfe are valid SCB indexes, * SCB_LIST_NULL is 0xff which is out of range. An entry is also added to * this list every time a request sense occurs or after completing a non-tagged Modified: stable/11/sys/dev/drm2/drm_fb_helper.c == --- stable/11/sys/dev/drm2/drm_fb_helper.c Sun Apr 28 13:19:28 2019 (r346816) +++ stable/11/sys/dev/drm2/drm_fb_helper.c Sun Apr 28 13:21:01 2019 (r346817) @@ -580,7 +580,7 @@ static int setcolreg(struct drm_crtc *crtc, u16 red, u if (info->fix.visual == FB_VISUAL_TRUECOLOR) { u32 *palette; u32 value; - /* place color in psuedopalette */ + /* place color in pseudopalette */ if (regno > 16)
svn commit: r346816 - in stable/11/sys: amd64/linux amd64/linux32 compat/linux i386/linux
Author: dchagin Date: Sun Apr 28 13:19:28 2019 New Revision: 346816 URL: https://svnweb.freebsd.org/changeset/base/346816 Log: MFC r329794, r329801 (by emaste@): Correct proper nouns in the Linuxulator - Capitalize Linux - Spell FreeBSD out in full - Address some style(9) on changed lines Modified: stable/11/sys/amd64/linux/linux_dummy.c stable/11/sys/amd64/linux/linux_sysvec.c stable/11/sys/amd64/linux/syscalls.master stable/11/sys/amd64/linux32/linux32_dummy.c stable/11/sys/amd64/linux32/linux32_sysvec.c stable/11/sys/amd64/linux32/syscalls.master stable/11/sys/compat/linux/linux_emul.c stable/11/sys/compat/linux/linux_file.c stable/11/sys/compat/linux/linux_ioctl.c stable/11/sys/compat/linux/linux_mib.c stable/11/sys/compat/linux/linux_misc.c stable/11/sys/compat/linux/linux_socket.c stable/11/sys/i386/linux/imgact_linux.c stable/11/sys/i386/linux/linux_dummy.c stable/11/sys/i386/linux/linux_machdep.c stable/11/sys/i386/linux/linux_ptrace.c stable/11/sys/i386/linux/linux_sysvec.c stable/11/sys/i386/linux/syscalls.master Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/linux/linux_dummy.c == --- stable/11/sys/amd64/linux/linux_dummy.c Sun Apr 28 13:16:54 2019 (r346815) +++ stable/11/sys/amd64/linux/linux_dummy.c Sun Apr 28 13:19:28 2019 (r346816) @@ -46,15 +46,15 @@ __FBSDID("$FreeBSD$"); LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); UNIMPLEMENTED(afs_syscall); -UNIMPLEMENTED(create_module); /* added in linux 1.0 removed in 2.6 */ +UNIMPLEMENTED(create_module); /* Added in Linux 1.0 removed in 2.6. */ UNIMPLEMENTED(epoll_ctl_old); UNIMPLEMENTED(epoll_wait_old); -UNIMPLEMENTED(get_kernel_syms);/* added in linux 1.0 removed in 2.6 */ +UNIMPLEMENTED(get_kernel_syms);/* Added in Linux 1.0 removed in 2.6. */ UNIMPLEMENTED(get_thread_area); UNIMPLEMENTED(getpmsg); -UNIMPLEMENTED(nfsservctl); /* added in linux 2.2 removed in 3.1 */ +UNIMPLEMENTED(nfsservctl); /* Added in Linux 2.2 removed in 3.1. */ UNIMPLEMENTED(putpmsg); -UNIMPLEMENTED(query_module); /* added in linux 2.2 removed in 2.6 */ +UNIMPLEMENTED(query_module); /* Added in Linux 2.2 removed in 2.6. */ UNIMPLEMENTED(security); UNIMPLEMENTED(set_thread_area); UNIMPLEMENTED(tuxcall); @@ -86,74 +86,74 @@ DUMMY(mq_timedreceive); DUMMY(mq_notify); DUMMY(mq_getsetattr); DUMMY(kexec_load); -/* linux 2.6.11: */ +/* Linux 2.6.11: */ DUMMY(add_key); DUMMY(request_key); DUMMY(keyctl); -/* linux 2.6.13: */ +/* Linux 2.6.13: */ DUMMY(ioprio_set); DUMMY(ioprio_get); DUMMY(inotify_init); DUMMY(inotify_add_watch); DUMMY(inotify_rm_watch); -/* linux 2.6.16: */ +/* Linux 2.6.16: */ DUMMY(migrate_pages); DUMMY(unshare); -/* linux 2.6.17: */ +/* Linux 2.6.17: */ DUMMY(splice); DUMMY(tee); DUMMY(sync_file_range); DUMMY(vmsplice); -/* linux 2.6.18: */ +/* Linux 2.6.18: */ DUMMY(move_pages); -/* linux 2.6.22: */ +/* Linux 2.6.22: */ DUMMY(signalfd); -/* linux 2.6.27: */ +/* Linux 2.6.27: */ DUMMY(signalfd4); DUMMY(inotify_init1); -/* linux 2.6.31: */ +/* Linux 2.6.31: */ DUMMY(perf_event_open); -/* linux 2.6.38: */ +/* Linux 2.6.38: */ DUMMY(fanotify_init); DUMMY(fanotify_mark); -/* linux 2.6.39: */ +/* Linux 2.6.39: */ DUMMY(name_to_handle_at); DUMMY(open_by_handle_at); DUMMY(clock_adjtime); -/* linux 3.0: */ +/* Linux 3.0: */ DUMMY(setns); DUMMY(getcpu); -/* linux 3.2: */ +/* Linux 3.2: */ DUMMY(process_vm_readv); DUMMY(process_vm_writev); -/* linux 3.5: */ +/* Linux 3.5: */ DUMMY(kcmp); -/* linux 3.8: */ +/* Linux 3.8: */ DUMMY(finit_module); DUMMY(sched_setattr); DUMMY(sched_getattr); -/* linux 3.14: */ +/* Linux 3.14: */ DUMMY(renameat2); -/* linux 3.15: */ +/* Linux 3.15: */ DUMMY(seccomp); DUMMY(memfd_create); DUMMY(kexec_file_load); -/* linux 3.18: */ +/* Linux 3.18: */ DUMMY(bpf); -/* linux 3.19: */ +/* Linux 3.19: */ DUMMY(execveat); -/* linux 4.2: */ +/* Linux 4.2: */ DUMMY(userfaultfd); -/* linux 4.3: */ +/* Linux 4.3: */ DUMMY(membarrier); -/* linux 4.4: */ +/* Linux 4.4: */ DUMMY(mlock2); -/* linux 4.5: */ +/* Linux 4.5: */ DUMMY(copy_file_range); -/* linux 4.6: */ +/* Linux 4.6: */ DUMMY(preadv2); DUMMY(pwritev2); -/* linux 4.8: */ +/* Linux 4.8: */ DUMMY(pkey_mprotect); DUMMY(pkey_alloc); DUMMY(pkey_free); Modified: stable/11/sys/amd64/linux/linux_sysvec.c == --- stable/11/sys/amd64/linux/linux_sysvec.cSun Apr 28 13:16:54 2019 (r346815) +++ stable/11/sys/amd64/linux/linux_sysvec.cSun Apr 28 13:19:28 2019 (r346816) @@ -683,9 +683,9 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigse } /* - * If a linux binary is exec'ing something, try this image activator + * If a Linux binary is exec'ing something, try this image activator * first. We override standard shell script execution
svn commit: r346818 - stable/11/sys/amd64/linux
Author: dchagin Date: Sun Apr 28 13:22:30 2019 New Revision: 346818 URL: https://svnweb.freebsd.org/changeset/base/346818 Log: MFC r329876 (by emaste@): Use linux types for linux-specific syscalls. Modified: stable/11/sys/amd64/linux/syscalls.master Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/linux/syscalls.master == --- stable/11/sys/amd64/linux/syscalls.master Sun Apr 28 13:21:01 2019 (r346817) +++ stable/11/sys/amd64/linux/syscalls.master Sun Apr 28 13:22:30 2019 (r346818) @@ -58,8 +58,8 @@ 9 AUE_MMAPSTD { int linux_mmap2(l_ulong addr, l_ulong len, \ l_ulong prot, l_ulong flags, l_ulong fd, \ l_ulong pgoff); } -10 AUE_MPROTECTSTD { int linux_mprotect(caddr_t addr, int len, \ - int prot); } +10 AUE_MPROTECTSTD { int linux_mprotect(caddr_t addr, l_int len, \ + l_int prot); } 11 AUE_MUNMAP NOPROTO { int munmap(caddr_t addr, int len); } 12 AUE_NULLSTD { int linux_brk(l_ulong dsend); } 13 AUE_NULLSTD { int linux_rt_sigaction(l_int sig, \ @@ -115,7 +115,7 @@ struct l_itimerval *itv, \ struct l_itimerval *oitv); } 39 AUE_GETPID STD { int linux_getpid(void); } -40 AUE_SENDFILESTD { int linux_sendfile(int out, int in, \ +40 AUE_SENDFILESTD { int linux_sendfile(l_int out, l_int in, \ l_long *offset, l_size_t count); } 41 AUE_SOCKET STD { int linux_socket(l_int domain, l_int type, \ l_int protocol); } @@ -150,12 +150,12 @@ l_int optname, l_uintptr_t optval, \ l_uintptr_t optlen); } 56 AUE_RFORK STD { int linux_clone(l_int flags, void *stack, \ - void *parent_tidptr, void * child_tidptr, void *tls ); } + void *parent_tidptr, void *child_tidptr, void *tls); } 57 AUE_FORKSTD { int linux_fork(void); } 58 AUE_VFORK STD { int linux_vfork(void); } 59 AUE_EXECVE STD { int linux_execve(char *path, char **argp, \ char **envp); } -60 AUE_EXITSTD { void linux_exit(int rval); } +60 AUE_EXITSTD { void linux_exit(l_int rval); } 61 AUE_WAIT4 STD { int linux_wait4(l_pid_t pid, \ l_int *status, l_int options, \ struct rusage *rusage); } @@ -281,7 +281,7 @@ struct l_statfs_buf *buf); } 139AUE_NULLSTD { int linux_sysfs(l_int option, \ l_ulong arg1, l_ulong arg2); } -140AUE_GETPRIORITY STD { int linux_getpriority(int which, int who); } +140AUE_GETPRIORITY STD { int linux_getpriority(l_int which, l_int who); } 141AUE_SETPRIORITY NOPROTO { int setpriority(int which, int who, \ int prio); } 142AUE_SCHED_SETPARAM STD { int linux_sched_setparam(l_pid_t pid, \ @@ -359,10 +359,10 @@ 197AUE_NULLSTD { int linux_removexattr(void); } 198AUE_NULLSTD { int linux_lremovexattr(void); } 199AUE_NULLSTD { int linux_fremovexattr(void); } -200AUE_NULLSTD { int linux_tkill(int tid, int sig); } +200AUE_NULLSTD { int linux_tkill(l_int tid, l_int sig); } 201AUE_NULLSTD { int linux_time(l_time_t *tm); } -202AUE_NULLSTD { int linux_sys_futex(void *uaddr, int op, int val, \ - struct l_timespec *timeout, void *uaddr2, int val3); } +202AUE_NULLSTD { int linux_sys_futex(void *uaddr, l_int op, l_int val, \ + struct l_timespec *timeout, void *uaddr2, l_int val3); } 203AUE_NULLSTD { int linux_sched_setaffinity(l_pid_t pid, l_uint len, \ l_ulong *user_mask_ptr); } 204AUE_NULLSTD { int linux_sched_getaffinity(l_pid_t pid, l_uint len, \ @@ -381,11 +381,11 @@ 216AUE_NULLSTD { int linux_remap_file_pages(void); } 217AUE_GETDIRENTRIES STD { int linux_getdents64(l_uint fd, \ void *dirent, l_uint count); } -218AUE_NULLSTD { int linux_set_tid_address(int *tidptr); } +218AUE_NULLSTD { int linux_set_tid_address(l_int *tidptr); } 219AUE_NULLUNIMPL restart_syscall 220AUE_NULLSTD { int linux_semtimedop(void); } -221
svn commit: r346815 - stable/11/sys/sys
Author: dchagin Date: Sun Apr 28 13:16:54 2019 New Revision: 346815 URL: https://svnweb.freebsd.org/changeset/base/346815 Log: MFC r329787 (by emaste@): Use 'const int *' for sysentvec errno translation table This allows an sv_errtbl to be read-only .rodata. Modified: stable/11/sys/sys/sysent.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/sys/sysent.h == --- stable/11/sys/sys/sysent.h Sun Apr 28 13:07:38 2019(r346814) +++ stable/11/sys/sys/sysent.h Sun Apr 28 13:16:54 2019(r346815) @@ -92,7 +92,7 @@ struct sysentvec { struct sysent *sv_table; /* pointer to sysent */ u_int sv_mask;/* optional mask to index */ int sv_errsize; /* size of errno translation table */ - int *sv_errtbl; /* errno translation table */ + const int *sv_errtbl; /* errno translation table */ int (*sv_transtrap)(int, int); /* translate trap-to-signal mapping */ int (*sv_fixup)(register_t **, struct image_params *); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r346813 - in stable/11/sys: amd64/linux i386/linux
Author: dchagin Date: Sun Apr 28 09:54:50 2019 New Revision: 346813 URL: https://svnweb.freebsd.org/changeset/base/346813 Log: MFC r328894 (by emaste@): Additional linuxolator whitespace cleanup, missed in r328890. Modified: stable/11/sys/amd64/linux/syscalls.master stable/11/sys/i386/linux/syscalls.master Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/linux/syscalls.master == --- stable/11/sys/amd64/linux/syscalls.master Sun Apr 28 09:53:08 2019 (r346812) +++ stable/11/sys/amd64/linux/syscalls.master Sun Apr 28 09:54:50 2019 (r346813) @@ -76,7 +76,7 @@ l_size_t nbyte, l_loff_t offset); } 18 AUE_PWRITE STD { int linux_pwrite(l_uint fd, char *buf, \ l_size_t nbyte, l_loff_t offset); } -19 AUE_READV NOPROTO { int readv(int fd, struct iovec *iovp, \ +19 AUE_READV NOPROTO { int readv(int fd, struct iovec *iovp, \ u_int iovcnt); } 20 AUE_WRITEV NOPROTO { int writev(int fd, struct iovec *iovp, \ u_int iovcnt); } @@ -472,7 +472,7 @@ 279AUE_NULLSTD { int linux_move_pages(void); } 280AUE_FUTIMESAT STD { int linux_utimensat(l_int dfd, const char *pathname, \ const struct l_timespec *times, l_int flags); } -281AUE_NULLSTD { int linux_epoll_pwait(l_int epfd, struct epoll_event *events, \ +281AUE_NULLSTD { int linux_epoll_pwait(l_int epfd, struct epoll_event *events, \ l_int maxevents, l_int timeout, l_sigset_t *mask, \ l_size_t sigsetsize); } 282AUE_NULLSTD { int linux_signalfd(void); } Modified: stable/11/sys/i386/linux/syscalls.master == --- stable/11/sys/i386/linux/syscalls.masterSun Apr 28 09:53:08 2019 (r346812) +++ stable/11/sys/i386/linux/syscalls.masterSun Apr 28 09:54:50 2019 (r346813) @@ -121,10 +121,10 @@ 61 AUE_CHROOT NOPROTO { int chroot(char *path); } 62 AUE_NULLSTD { int linux_ustat(l_dev_t dev, \ struct l_ustat *ubuf); } -63 AUE_DUP2NOPROTO { int dup2(u_int from, u_int to); } +63 AUE_DUP2NOPROTO { int dup2(u_int from, u_int to); } 64 AUE_GETPPID STD { int linux_getppid(void); } -65 AUE_GETPGRP NOPROTO { int getpgrp(void); } -66 AUE_SETSID NOPROTO { int setsid(void); } +65 AUE_GETPGRP NOPROTO { int getpgrp(void); } +66 AUE_SETSID NOPROTO { int setsid(void); } 67 AUE_NULLSTD { int linux_sigaction(l_int sig, \ l_osigaction_t *nsa, \ l_osigaction_t *osa); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r346812 - in stable/11/sys: amd64/linux amd64/linux32 compat/linux i386/linux
Author: dchagin Date: Sun Apr 28 09:53:08 2019 New Revision: 346812 URL: https://svnweb.freebsd.org/changeset/base/346812 Log: MFC r328890 (by emaste@): Linuxolator whitespace cleanup A version of each of the MD files by necessity exists for each CPU architecture supported by the Linuxolator. Clean these up so that new architectures do not inherit whitespace issues. Clean up shared Linuxolator files while here. Modified: stable/11/sys/amd64/linux/linux.h stable/11/sys/amd64/linux/linux_ptrace.c stable/11/sys/amd64/linux/linux_sysvec.c stable/11/sys/amd64/linux/syscalls.master stable/11/sys/amd64/linux32/linux.h stable/11/sys/amd64/linux32/linux32_dummy.c stable/11/sys/amd64/linux32/linux32_locore.s stable/11/sys/amd64/linux32/linux32_sysvec.c stable/11/sys/amd64/linux32/syscalls.master stable/11/sys/compat/linux/check_internal_locks.d stable/11/sys/compat/linux/linux_emul.c stable/11/sys/compat/linux/linux_event.c stable/11/sys/compat/linux/linux_file.h stable/11/sys/compat/linux/linux_fork.c stable/11/sys/compat/linux/linux_ioctl.c stable/11/sys/compat/linux/linux_ioctl.h stable/11/sys/compat/linux/linux_ipc.c stable/11/sys/compat/linux/linux_ipc.h stable/11/sys/compat/linux/linux_ipc64.h stable/11/sys/compat/linux/linux_misc.c stable/11/sys/compat/linux/linux_persona.h stable/11/sys/compat/linux/linux_signal.c stable/11/sys/compat/linux/linux_socket.c stable/11/sys/compat/linux/linux_socket.h stable/11/sys/compat/linux/linux_time.c stable/11/sys/compat/linux/linux_util.h stable/11/sys/compat/linux/stats_timing.d stable/11/sys/compat/linux/trace_futexes.d stable/11/sys/i386/linux/linux.h stable/11/sys/i386/linux/linux_dummy.c stable/11/sys/i386/linux/linux_locore.s stable/11/sys/i386/linux/linux_machdep.c stable/11/sys/i386/linux/linux_support.s stable/11/sys/i386/linux/linux_sysvec.c stable/11/sys/i386/linux/syscalls.master Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/linux/linux.h == --- stable/11/sys/amd64/linux/linux.h Sun Apr 28 09:49:30 2019 (r346811) +++ stable/11/sys/amd64/linux/linux.h Sun Apr 28 09:53:08 2019 (r346812) @@ -459,7 +459,7 @@ struct l_pollfd { struct linux_robust_list { l_uintptr_t next; }; - + struct linux_robust_list_head { struct linux_robust_listlist; l_long futex_offset; Modified: stable/11/sys/amd64/linux/linux_ptrace.c == --- stable/11/sys/amd64/linux/linux_ptrace.cSun Apr 28 09:49:30 2019 (r346811) +++ stable/11/sys/amd64/linux/linux_ptrace.cSun Apr 28 09:53:08 2019 (r346812) @@ -74,7 +74,7 @@ __FBSDID("$FreeBSD$"); #defineLINUX_PTRACE_O_TRACEVFORKDONE 32 #defineLINUX_PTRACE_O_TRACEEXIT64 #defineLINUX_PTRACE_O_TRACESECCOMP 128 -#defineLINUX_PTRACE_O_EXITKILL 1048576 +#defineLINUX_PTRACE_O_EXITKILL 1048576 #defineLINUX_PTRACE_O_SUSPEND_SECCOMP 2097152 #defineLINUX_NT_PRSTATUS 1 @@ -239,7 +239,7 @@ linux_ptrace_setoptions(struct thread *td, pid_t pid, if (data & LINUX_PTRACE_O_TRACEFORK) mask |= PTRACE_FORK; - if (data & LINUX_PTRACE_O_TRACEVFORK) + if (data & LINUX_PTRACE_O_TRACEVFORK) mask |= PTRACE_VFORK; if (data & LINUX_PTRACE_O_TRACECLONE) Modified: stable/11/sys/amd64/linux/linux_sysvec.c == --- stable/11/sys/amd64/linux/linux_sysvec.cSun Apr 28 09:49:30 2019 (r346811) +++ stable/11/sys/amd64/linux/linux_sysvec.cSun Apr 28 09:53:08 2019 (r346812) @@ -736,7 +736,7 @@ linux_vsyscall(struct thread *td) struct trapframe *frame; uint64_t retqaddr; int code, traced; - int error; + int error; frame = td->td_frame; @@ -810,7 +810,7 @@ linux_vdso_install(void *param) amd64_lower_shared_page(_linux_sysvec); - linux_szsigcode = (&_binary_linux_locore_o_end - + linux_szsigcode = (&_binary_linux_locore_o_end - &_binary_linux_locore_o_start); if (linux_szsigcode > elf_linux_sysvec.sv_shared_page_len) Modified: stable/11/sys/amd64/linux/syscalls.master == --- stable/11/sys/amd64/linux/syscalls.master Sun Apr 28 09:49:30 2019 (r346811) +++ stable/11/sys/amd64/linux/syscalls.master Sun Apr 28 09:53:08 2019 (r346812) @@ -471,10 +471,10 @@ 278AUE_NULLSTD { int linux_vmsplice(void); } 279AUE_NULLSTD { int linux_move_pages(void); } 280AUE_FUTIMESAT STD { int linux_utimensat(l_int
svn commit: r346811 - stable/11/sys/kern
Author: dchagin Date: Sun Apr 28 09:49:30 2019 New Revision: 346811 URL: https://svnweb.freebsd.org/changeset/base/346811 Log: MFC r328598 (by emaste@): makesyscalls: permit a range of syscall numbers for UNIMPL Some ABIs have large gaps in syscall numbers. Allow gaps to be filled as ranges of UNIMPL, with an entry like: 248-1023 AUE_NULLUNIMPL unimplemented Modified: stable/11/sys/kern/makesyscalls.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/makesyscalls.sh == --- stable/11/sys/kern/makesyscalls.sh Sun Apr 28 09:47:33 2019 (r346810) +++ stable/11/sys/kern/makesyscalls.sh Sun Apr 28 09:49:30 2019 (r346811) @@ -243,13 +243,6 @@ sed -e ' print > systraceret next } - syscall != $1 { - printf "%s: line %d: syscall number out of sync at %d\n", - infile, NR, syscall - printf "line is:\n" - print - exit 1 - } # Returns true if the type "name" is the first flag in the type field function type(name, flags, n) { n = split($3, flags, /\|/) @@ -263,6 +256,29 @@ sed -e ' return 1 return 0 } + { + n = split($1, syscall_range, /-/) + if (n == 1) { + syscall_range[2] = syscall_range[1] + } else if (n == 2) { + if (!type("UNIMPL")) { + printf "%s: line %d: range permitted only with UNIMPL\n", + infile, NR + exit 1 + } + } else { + printf "%s: line %d: invalid syscall number or range %s\n", + infile, NR, $1 + exit 1 + } + } + syscall != syscall_range[1] { + printf "%s: line %d: syscall number out of sync at %d\n", + infile, NR, syscall + printf "line is:\n" + print + exit 1 + } function align_sysent_comment(column) { printf("\t") > sysent column = column + 8 - column % 8 @@ -593,11 +609,13 @@ sed -e ' next } type("UNIMPL") { - printf("\t{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },\t\t\t/* %d = %s */\n", - syscall, comment) > sysent - printf("\t\"#%d\",\t\t\t/* %d = %s */\n", - syscall, syscall, comment) > sysnames - syscall++ + while (syscall <= syscall_range[2]) { + printf("\t{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },\t\t\t/* %d = %s */\n", + syscall, comment) > sysent + printf("\t\"#%d\",\t\t\t/* %d = %s */\n", + syscall, syscall, comment) > sysnames + syscall++ + } next } { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r346810 - in stable/11/sys: amd64/linux amd64/linux32 i386/linux
Author: dchagin Date: Sun Apr 28 09:47:33 2019 New Revision: 346810 URL: https://svnweb.freebsd.org/changeset/base/346810 Log: MFC Linuxulator part of r326333 (by brooks@): Disable vim syntax highlighting. Vim's default pick doesn't understand that ';' is a comment character and the result looks horrible. Modified: stable/11/sys/amd64/linux/syscalls.master stable/11/sys/amd64/linux32/syscalls.master stable/11/sys/i386/linux/syscalls.master Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/linux/syscalls.master == --- stable/11/sys/amd64/linux/syscalls.master Sun Apr 28 09:41:46 2019 (r346809) +++ stable/11/sys/amd64/linux/syscalls.master Sun Apr 28 09:47:33 2019 (r346810) @@ -598,3 +598,4 @@ ; please, keep this line at the end. 332AUE_NULLUNIMPL nosys +; vim: syntax=off Modified: stable/11/sys/amd64/linux32/syscalls.master == --- stable/11/sys/amd64/linux32/syscalls.master Sun Apr 28 09:41:46 2019 (r346809) +++ stable/11/sys/amd64/linux32/syscalls.master Sun Apr 28 09:47:33 2019 (r346810) @@ -690,3 +690,4 @@ ; please, keep this line at the end. 383AUE_NULLUNIMPL nosys +; vim: syntax=off Modified: stable/11/sys/i386/linux/syscalls.master == --- stable/11/sys/i386/linux/syscalls.masterSun Apr 28 09:41:46 2019 (r346809) +++ stable/11/sys/i386/linux/syscalls.masterSun Apr 28 09:47:33 2019 (r346810) @@ -697,3 +697,4 @@ ; please, keep this line at the end. 383AUE_NULLUNIMPL nosys +; vim: syntax=off ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r346808 - stable/11/sys/compat/linux
Author: dchagin Date: Sun Apr 28 09:38:41 2019 New Revision: 346808 URL: https://svnweb.freebsd.org/changeset/base/346808 Log: MFC r323980 (by pfg@): Small style(9) issue: spaces vs TAB. Modified: stable/11/sys/compat/linux/linux_stats.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linux/linux_stats.c == --- stable/11/sys/compat/linux/linux_stats.cSun Apr 28 09:35:39 2019 (r346807) +++ stable/11/sys/compat/linux/linux_stats.cSun Apr 28 09:38:41 2019 (r346808) @@ -319,7 +319,7 @@ struct l_statfs { #defineLINUX_PROC_SUPER_MAGIC 0x9fa0L #defineLINUX_UFS_SUPER_MAGIC 0x00011954L /* XXX - UFS_MAGIC in Linux */ #defineLINUX_ZFS_SUPER_MAGIC 0x2FC12FC1 -#define LINUX_DEVFS_SUPER_MAGIC0x1373L +#defineLINUX_DEVFS_SUPER_MAGIC 0x1373L #defineLINUX_SHMFS_MAGIC 0x01021994 static long ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r346807 - in stable/11/sys: amd64/linux amd64/linux32 compat/linux i386/linux
Author: dchagin Date: Sun Apr 28 09:35:39 2019 New Revision: 346807 URL: https://svnweb.freebsd.org/changeset/base/346807 Log: MFC r321728: Avoid using [LINUX_]SHAREDPAGE constant directly in the vdso code. This is needed for https://reviews.freebsd.org/D11780. Modified: stable/11/sys/amd64/linux/linux_sysvec.c stable/11/sys/amd64/linux32/linux32_sysvec.c stable/11/sys/compat/linux/linux_vdso.c stable/11/sys/compat/linux/linux_vdso.h stable/11/sys/i386/linux/linux_sysvec.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/linux/linux_sysvec.c == --- stable/11/sys/amd64/linux/linux_sysvec.cSun Apr 28 08:22:37 2019 (r346806) +++ stable/11/sys/amd64/linux/linux_sysvec.cSun Apr 28 09:35:39 2019 (r346807) @@ -821,14 +821,14 @@ linux_vdso_install(void *param) linux_shared_page_obj = __elfN(linux_shared_page_init) (_shared_page_mapping); - __elfN(linux_vdso_reloc)(_linux_sysvec, SHAREDPAGE); + __elfN(linux_vdso_reloc)(_linux_sysvec); bcopy(elf_linux_sysvec.sv_sigcode, linux_shared_page_mapping, linux_szsigcode); elf_linux_sysvec.sv_shared_page_obj = linux_shared_page_obj; linux_kplatform = linux_shared_page_mapping + - (linux_platform - (caddr_t)SHAREDPAGE); + (linux_platform - (caddr_t)elf_linux_sysvec.sv_shared_page_base); } SYSINIT(elf_linux_vdso_init, SI_SUB_EXEC, SI_ORDER_ANY, (sysinit_cfunc_t)linux_vdso_install, NULL); Modified: stable/11/sys/amd64/linux32/linux32_sysvec.c == --- stable/11/sys/amd64/linux32/linux32_sysvec.cSun Apr 28 08:22:37 2019(r346806) +++ stable/11/sys/amd64/linux32/linux32_sysvec.cSun Apr 28 09:35:39 2019(r346807) @@ -1021,14 +1021,14 @@ linux_vdso_install(void *param) linux_shared_page_obj = __elfN(linux_shared_page_init) (_shared_page_mapping); - __elfN(linux_vdso_reloc)(_linux_sysvec, LINUX32_SHAREDPAGE); + __elfN(linux_vdso_reloc)(_linux_sysvec); bcopy(elf_linux_sysvec.sv_sigcode, linux_shared_page_mapping, linux_szsigcode); elf_linux_sysvec.sv_shared_page_obj = linux_shared_page_obj; linux_kplatform = linux_shared_page_mapping + - (linux_platform - (caddr_t)LINUX32_SHAREDPAGE); + (linux_platform - (caddr_t)elf_linux_sysvec.sv_shared_page_base); } SYSINIT(elf_linux_vdso_init, SI_SUB_EXEC, SI_ORDER_ANY, (sysinit_cfunc_t)linux_vdso_install, NULL); Modified: stable/11/sys/compat/linux/linux_vdso.c == --- stable/11/sys/compat/linux/linux_vdso.c Sun Apr 28 08:22:37 2019 (r346806) +++ stable/11/sys/compat/linux/linux_vdso.c Sun Apr 28 09:35:39 2019 (r346807) @@ -139,7 +139,7 @@ __elfN(linux_vdso_fixup)(struct sysentvec *sv) } void -__elfN(linux_vdso_reloc)(struct sysentvec *sv, long vdso_adjust) +__elfN(linux_vdso_reloc)(struct sysentvec *sv) { struct linux_vdso_sym *lsym; Elf_Ehdr *ehdr; @@ -152,13 +152,13 @@ __elfN(linux_vdso_reloc)(struct sysentvec *sv, long vd ehdr = (Elf_Ehdr *) sv->sv_sigcode; /* Adjust our so relative to the sigcode_base */ - if (vdso_adjust != 0) { - ehdr->e_entry += vdso_adjust; + if (sv->sv_shared_page_base != 0) { + ehdr->e_entry += sv->sv_shared_page_base; phdr = (Elf_Phdr *)((caddr_t)ehdr + ehdr->e_phoff); /* phdrs */ for (i = 0; i < ehdr->e_phnum; i++) { - phdr[i].p_vaddr += vdso_adjust; + phdr[i].p_vaddr += sv->sv_shared_page_base; if (phdr[i].p_type != PT_DYNAMIC) continue; dyn = (Elf_Dyn *)((caddr_t)ehdr + phdr[i].p_offset); @@ -178,13 +178,13 @@ __elfN(linux_vdso_reloc)(struct sysentvec *sv, long vd case DT_VERDEF: case DT_VERNEED: case DT_ADDRRNGLO ... DT_ADDRRNGHI: - dyn->d_un.d_ptr += vdso_adjust; + dyn->d_un.d_ptr += sv->sv_shared_page_base; break; case DT_ENCODING ... DT_LOOS-1: case DT_LOOS ... DT_HIOS: if (dyn->d_tag >= DT_ENCODING && (dyn->d_tag & 1) == 0) - dyn->d_un.d_ptr += vdso_adjust; + dyn->d_un.d_ptr += sv->sv_shared_page_base; break;
Re: svn commit: r346273 - in head/sys: compat/freebsd32 kern
вт, 16 апр. 2019 г. в 16:26, Ed Maste : > Author: emaste > Date: Tue Apr 16 13:26:31 2019 > New Revision: 346273 > URL: https://svnweb.freebsd.org/changeset/base/346273 > > Log: > correct readlinkat(2) return type > > Hi, Ed make sysent? > r176215 corrected readlink(2)'s return type and the type of the last > argument. readlink(2) was introduced in r177788 after being developed > as part of Google Summer of Code 2007; it appears to have inherited the > wrong return type. > > Man pages and header files were already ssize_t; update syscalls.master > to match. > > PR: 197915 > Submitted by: Henning Petersen > MFC after:2 weeks > > Modified: > head/sys/compat/freebsd32/syscalls.master > head/sys/kern/syscalls.master > > Modified: head/sys/compat/freebsd32/syscalls.master > > == > --- head/sys/compat/freebsd32/syscalls.master Tue Apr 16 12:40:49 2019 > (r346272) > +++ head/sys/compat/freebsd32/syscalls.master Tue Apr 16 13:26:31 2019 > (r346273) > @@ -963,7 +963,7 @@ > uint32_t dev); } > 499AUE_OPENAT_RWTC NOPROTO { int openat(int fd, const char *path, \ > int flag, mode_t mode); } > -500AUE_READLINKAT NOPROTO { int readlinkat(int fd, const char *path, > \ > +500AUE_READLINKAT NOPROTO { ssize_t readlinkat(int fd, const char > *path, \ > char *buf, size_t bufsize); } > 501AUE_RENAMEATNOPROTO { int renameat(int oldfd, const char *old, > \ > int newfd, const char *new); } > > Modified: head/sys/kern/syscalls.master > > == > --- head/sys/kern/syscalls.master Tue Apr 16 12:40:49 2019 > (r346272) > +++ head/sys/kern/syscalls.master Tue Apr 16 13:26:31 2019 > (r346273) > @@ -2716,7 +2716,7 @@ > ); > } > 500AUE_READLINKAT STD { > - int readlinkat( > + ssize_t readlinkat( > int fd, > _In_z_ const char *path, > _Out_writes_bytes_(bufsize) char *buf, > > ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r346603 - in head/sys: amd64/linux32 i386/linux
Author: dchagin Date: Tue Apr 23 18:10:46 2019 New Revision: 346603 URL: https://svnweb.freebsd.org/changeset/base/346603 Log: Since r339624 HEAD does not need for backslashes in syscalls.master, however to make a merge r345471 to the stable add backslashes to the syscalls.master. MFC after:3 days Modified: head/sys/amd64/linux32/syscalls.master head/sys/i386/linux/syscalls.master Modified: head/sys/amd64/linux32/syscalls.master == --- head/sys/amd64/linux32/syscalls.master Tue Apr 23 17:28:28 2019 (r346602) +++ head/sys/amd64/linux32/syscalls.master Tue Apr 23 18:10:46 2019 (r346603) @@ -690,7 +690,7 @@ 383AUE_NULLSTD { int linux_statx(l_int dirfd, \ const char *pathname, l_uint flags, \ l_uint mask, void *statxbuf); } -384AUE_NULLSTD { int linux_arch_prctl(l_int option, +384AUE_NULLSTD { int linux_arch_prctl(l_int option, \ l_ulong arg2); } ; Linux 4.18: 385AUE_NULLSTD { int linux_io_pgetevents(void); } Modified: head/sys/i386/linux/syscalls.master == --- head/sys/i386/linux/syscalls.master Tue Apr 23 17:28:28 2019 (r346602) +++ head/sys/i386/linux/syscalls.master Tue Apr 23 18:10:46 2019 (r346603) @@ -698,7 +698,7 @@ 383AUE_NULLSTD { int linux_statx(l_int dirfd, \ const char *pathname, l_uint flags, \ l_uint mask, void *statxbuf); } -384AUE_PRCTL STD { int linux_arch_prctl(l_int option, +384AUE_PRCTL STD { int linux_arch_prctl(l_int option, \ l_ulong arg2); } ; Linux 4.18: 385AUE_NULLSTD { int linux_io_pgetevents(void); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r345473 - head/sys/compat/linux
Author: dchagin Date: Sun Mar 24 15:08:30 2019 New Revision: 345473 URL: https://svnweb.freebsd.org/changeset/base/345473 Log: Whitespace cleanup (annoying). MFC after:1 month Modified: head/sys/compat/linux/linux_fork.c Modified: head/sys/compat/linux/linux_fork.c == --- head/sys/compat/linux/linux_fork.c Sun Mar 24 14:51:17 2019 (r345472) +++ head/sys/compat/linux/linux_fork.c Sun Mar 24 15:08:30 2019 (r345473) @@ -353,7 +353,7 @@ linux_clone_thread(struct thread *td, struct linux_clo thread_unlock(td); if (P_SHOULDSTOP(p)) newtd->td_flags |= TDF_ASTPENDING | TDF_NEEDSUSPCHK; - + if (p->p_ptevents & PTRACE_LWP) newtd->td_dbgflags |= TDB_BORN; PROC_UNLOCK(p); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r345472 - in head/sys: amd64/linux amd64/linux32 i386/linux
Author: dchagin Date: Sun Mar 24 14:51:17 2019 New Revision: 345472 URL: https://svnweb.freebsd.org/changeset/base/345472 Log: Regen from r345471. MFC after:1 month Modified: head/sys/amd64/linux/linux_proto.h head/sys/amd64/linux/linux_syscall.h head/sys/amd64/linux/linux_syscalls.c head/sys/amd64/linux/linux_sysent.c head/sys/amd64/linux/linux_systrace_args.c head/sys/amd64/linux32/linux32_proto.h head/sys/amd64/linux32/linux32_syscall.h head/sys/amd64/linux32/linux32_syscalls.c head/sys/amd64/linux32/linux32_sysent.c head/sys/amd64/linux32/linux32_systrace_args.c head/sys/i386/linux/linux_proto.h head/sys/i386/linux/linux_syscall.h head/sys/i386/linux/linux_syscalls.c head/sys/i386/linux/linux_sysent.c head/sys/i386/linux/linux_systrace_args.c Modified: head/sys/amd64/linux/linux_proto.h == --- head/sys/amd64/linux/linux_proto.h Sun Mar 24 14:50:02 2019 (r345471) +++ head/sys/amd64/linux/linux_proto.h Sun Mar 24 14:51:17 2019 (r345472) @@ -1213,6 +1213,34 @@ struct linux_pkey_alloc_args { struct linux_pkey_free_args { char pkey_l_[PADL_(l_int)]; l_int pkey; char pkey_r_[PADR_(l_int)]; }; +struct linux_statx_args { + char dirfd_l_[PADL_(l_int)]; l_int dirfd; char dirfd_r_[PADR_(l_int)]; + char pathname_l_[PADL_(const char *)]; const char * pathname; char pathname_r_[PADR_(const char *)]; + char flags_l_[PADL_(l_uint)]; l_uint flags; char flags_r_[PADR_(l_uint)]; + char mask_l_[PADL_(l_uint)]; l_uint mask; char mask_r_[PADR_(l_uint)]; + char statxbuf_l_[PADL_(void *)]; void * statxbuf; char statxbuf_r_[PADR_(void *)]; +}; +struct linux_io_pgetevents_args { + register_t dummy; +}; +struct linux_rseq_args { + register_t dummy; +}; +struct linux_pidfd_send_signal_args { + char pidfd_l_[PADL_(l_int)]; l_int pidfd; char pidfd_r_[PADR_(l_int)]; + char sig_l_[PADL_(l_int)]; l_int sig; char sig_r_[PADR_(l_int)]; + char info_l_[PADL_(l_siginfo_t *)]; l_siginfo_t * info; char info_r_[PADR_(l_siginfo_t *)]; + char flags_l_[PADL_(l_uint)]; l_uint flags; char flags_r_[PADR_(l_uint)]; +}; +struct linux_io_uring_setup_args { + register_t dummy; +}; +struct linux_io_uring_enter_args { + register_t dummy; +}; +struct linux_io_uring_register_args { + register_t dummy; +}; #definenosys linux_nosys intlinux_open(struct thread *, struct linux_open_args *); intlinux_newstat(struct thread *, struct linux_newstat_args *); @@ -1479,6 +1507,13 @@ int linux_pwritev2(struct thread *, struct linux_pwrit intlinux_pkey_mprotect(struct thread *, struct linux_pkey_mprotect_args *); intlinux_pkey_alloc(struct thread *, struct linux_pkey_alloc_args *); intlinux_pkey_free(struct thread *, struct linux_pkey_free_args *); +intlinux_statx(struct thread *, struct linux_statx_args *); +intlinux_io_pgetevents(struct thread *, struct linux_io_pgetevents_args *); +intlinux_rseq(struct thread *, struct linux_rseq_args *); +intlinux_pidfd_send_signal(struct thread *, struct linux_pidfd_send_signal_args *); +intlinux_io_uring_setup(struct thread *, struct linux_io_uring_setup_args *); +intlinux_io_uring_enter(struct thread *, struct linux_io_uring_enter_args *); +intlinux_io_uring_register(struct thread *, struct linux_io_uring_register_args *); #ifdef COMPAT_43 @@ -1786,6 +1821,13 @@ int linux_pkey_free(struct thread *, struct linux_pkey #defineLINUX_SYS_AUE_linux_pkey_mprotect AUE_NULL #defineLINUX_SYS_AUE_linux_pkey_alloc AUE_NULL #defineLINUX_SYS_AUE_linux_pkey_free AUE_NULL +#defineLINUX_SYS_AUE_linux_statx AUE_NULL +#defineLINUX_SYS_AUE_linux_io_pgetevents AUE_NULL +#defineLINUX_SYS_AUE_linux_rseqAUE_NULL +#defineLINUX_SYS_AUE_linux_pidfd_send_signal AUE_NULL +#defineLINUX_SYS_AUE_linux_io_uring_setup AUE_NULL +#defineLINUX_SYS_AUE_linux_io_uring_enter AUE_NULL +#defineLINUX_SYS_AUE_linux_io_uring_register AUE_NULL #undef PAD_ #undef PADL_ Modified: head/sys/amd64/linux/linux_syscall.h == --- head/sys/amd64/linux/linux_syscall.hSun Mar 24 14:50:02 2019 (r345471) +++ head/sys/amd64/linux/linux_syscall.hSun Mar 24 14:51:17 2019 (r345472) @@ -313,4 +313,11 @@ #defineLINUX_SYS_linux_pkey_mprotect 329 #defineLINUX_SYS_linux_pkey_alloc 330 #defineLINUX_SYS_linux_pkey_free 331 -#defineLINUX_SYS_MAXSYSCALL333 +#defineLINUX_SYS_linux_statx 332 +#defineLINUX_SYS_linux_io_pgetevents 333 +#defineLINUX_SYS_linux_rseq334 +#defineLINUX_SYS_linux_pidfd_send_signal 424 +#defineLINUX_SYS_linux_io_uring_setup
svn commit: r345469 - in head/sys: amd64/linux32 compat/linux i386/linux
Author: dchagin Date: Sun Mar 24 14:44:35 2019 New Revision: 345469 URL: https://svnweb.freebsd.org/changeset/base/345469 Log: Linux between 4.18 and 5.0 split IPC system calls. In preparation for doing this in the Linuxulator modify our linux_shmat() to match actual Linux shmat() system call. MFC after:1 month Modified: head/sys/amd64/linux32/linux32_machdep.c head/sys/amd64/linux32/syscalls.master head/sys/compat/linux/linux_ipc.c head/sys/compat/linux/linux_ipc.h head/sys/i386/linux/linux_machdep.c head/sys/i386/linux/syscalls.master Modified: head/sys/amd64/linux32/linux32_machdep.c == --- head/sys/amd64/linux32/linux32_machdep.cSun Mar 24 14:02:57 2019 (r345468) +++ head/sys/amd64/linux32/linux32_machdep.cSun Mar 24 14:44:35 2019 (r345469) @@ -259,7 +259,7 @@ linux_ipc(struct thread *td, struct linux_ipc_args *ar struct linux_semop_args a; a.semid = args->arg1; - a.tsops = args->ptr; + a.tsops = PTRIN(args->ptr); a.nsops = args->arg2; return (linux_semop(td, )); } @@ -278,7 +278,7 @@ linux_ipc(struct thread *td, struct linux_ipc_args *ar a.semid = args->arg1; a.semnum = args->arg2; a.cmd = args->arg3; - error = copyin(args->ptr, , sizeof(a.arg)); + error = copyin(PTRIN(args->ptr), , sizeof(a.arg)); if (error) return (error); return (linux_semctl(td, )); @@ -287,7 +287,7 @@ linux_ipc(struct thread *td, struct linux_ipc_args *ar struct linux_msgsnd_args a; a.msqid = args->arg1; - a.msgp = args->ptr; + a.msgp = PTRIN(args->ptr); a.msgsz = args->arg2; a.msgflg = args->arg3; return (linux_msgsnd(td, )); @@ -304,13 +304,13 @@ linux_ipc(struct thread *td, struct linux_ipc_args *ar if (args->ptr == 0) return (EINVAL); - error = copyin(args->ptr, , sizeof(tmp)); + error = copyin(PTRIN(args->ptr), , sizeof(tmp)); if (error) return (error); a.msgp = PTRIN(tmp.msgp); a.msgtyp = tmp.msgtyp; } else { - a.msgp = args->ptr; + a.msgp = PTRIN(args->ptr); a.msgtyp = args->arg5; } return (linux_msgrcv(td, )); @@ -327,22 +327,29 @@ linux_ipc(struct thread *td, struct linux_ipc_args *ar a.msqid = args->arg1; a.cmd = args->arg2; - a.buf = args->ptr; + a.buf = PTRIN(args->ptr); return (linux_msgctl(td, )); } case LINUX_SHMAT: { struct linux_shmat_args a; + l_uintptr_t addr; + int error; a.shmid = args->arg1; - a.shmaddr = args->ptr; + a.shmaddr = PTRIN(args->ptr); a.shmflg = args->arg2; - a.raddr = PTRIN((l_uint)args->arg3); - return (linux_shmat(td, )); + error = linux_shmat(td, ); + if (error != 0) + return (error); + addr = td->td_retval[0]; + error = copyout(, PTRIN(args->arg3), sizeof(addr)); + td->td_retval[0] = 0; + return (error); } case LINUX_SHMDT: { struct linux_shmdt_args a; - a.shmaddr = args->ptr; + a.shmaddr = PTRIN(args->ptr); return (linux_shmdt(td, )); } case LINUX_SHMGET: { @@ -358,7 +365,7 @@ linux_ipc(struct thread *td, struct linux_ipc_args *ar a.shmid = args->arg1; a.cmd = args->arg2; - a.buf = args->ptr; + a.buf = PTRIN(args->ptr); return (linux_shmctl(td, )); } default: Modified: head/sys/amd64/linux32/syscalls.master == --- head/sys/amd64/linux32/syscalls.master Sun Mar 24 14:02:57 2019 (r345468) +++ head/sys/amd64/linux32/syscalls.master Sun Mar 24 14:44:35 2019 (r345469) @@ -212,8 +212,8 @@ 115AUE_SWAPOFF STD { int linux_swapoff(void); } 116AUE_NULLSTD { int linux_sysinfo(struct l_sysinfo *info); } 117AUE_NULLSTD { int linux_ipc(l_uint what, l_int arg1, \ - l_int arg2, l_int arg3, void *ptr, \ - l_long arg5); } + l_int arg2, l_uint arg3, l_uintptr_t ptr, \
svn commit: r345470 - in head/sys: amd64/linux32 i386/linux
Author: dchagin Date: Sun Mar 24 14:46:07 2019 New Revision: 345470 URL: https://svnweb.freebsd.org/changeset/base/345470 Log: Regen for r345469 (shmat()). MFC after:1 month Modified: head/sys/amd64/linux32/linux32_proto.h head/sys/amd64/linux32/linux32_systrace_args.c head/sys/i386/linux/linux_proto.h head/sys/i386/linux/linux_systrace_args.c Modified: head/sys/amd64/linux32/linux32_proto.h == --- head/sys/amd64/linux32/linux32_proto.h Sun Mar 24 14:44:35 2019 (r345469) +++ head/sys/amd64/linux32/linux32_proto.h Sun Mar 24 14:46:07 2019 (r345470) @@ -369,9 +369,9 @@ struct linux_ipc_args { char what_l_[PADL_(l_uint)]; l_uint what; char what_r_[PADR_(l_uint)]; char arg1_l_[PADL_(l_int)]; l_int arg1; char arg1_r_[PADR_(l_int)]; char arg2_l_[PADL_(l_int)]; l_int arg2; char arg2_r_[PADR_(l_int)]; - char arg3_l_[PADL_(l_int)]; l_int arg3; char arg3_r_[PADR_(l_int)]; - char ptr_l_[PADL_(void *)]; void * ptr; char ptr_r_[PADR_(void *)]; - char arg5_l_[PADL_(l_long)]; l_long arg5; char arg5_r_[PADR_(l_long)]; + char arg3_l_[PADL_(l_uint)]; l_uint arg3; char arg3_r_[PADR_(l_uint)]; + char ptr_l_[PADL_(l_uintptr_t)]; l_uintptr_t ptr; char ptr_r_[PADR_(l_uintptr_t)]; + char arg5_l_[PADL_(l_uint)]; l_uint arg5; char arg5_r_[PADR_(l_uint)]; }; struct linux_sigreturn_args { char sfp_l_[PADL_(struct l_sigframe *)]; struct l_sigframe * sfp; char sfp_r_[PADR_(struct l_sigframe *)]; Modified: head/sys/amd64/linux32/linux32_systrace_args.c == --- head/sys/amd64/linux32/linux32_systrace_args.c Sun Mar 24 14:44:35 2019(r345469) +++ head/sys/amd64/linux32/linux32_systrace_args.c Sun Mar 24 14:46:07 2019(r345470) @@ -785,9 +785,9 @@ systrace_args(int sysnum, void *params, uint64_t *uarg iarg[0] = p->what; /* l_uint */ iarg[1] = p->arg1; /* l_int */ iarg[2] = p->arg2; /* l_int */ - iarg[3] = p->arg3; /* l_int */ - uarg[4] = (intptr_t) p->ptr; /* void * */ - iarg[5] = p->arg5; /* l_long */ + iarg[3] = p->arg3; /* l_uint */ + iarg[4] = p->ptr; /* l_uintptr_t */ + iarg[5] = p->arg5; /* l_uint */ *n_args = 6; break; } @@ -3894,13 +3894,13 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d p = "l_int"; break; case 3: - p = "l_int"; + p = "l_uint"; break; case 4: - p = "userland void *"; + p = "l_uintptr_t"; break; case 5: - p = "l_long"; + p = "l_uint"; break; default: break; Modified: head/sys/i386/linux/linux_proto.h == --- head/sys/i386/linux/linux_proto.h Sun Mar 24 14:44:35 2019 (r345469) +++ head/sys/i386/linux/linux_proto.h Sun Mar 24 14:46:07 2019 (r345470) @@ -372,9 +372,9 @@ struct linux_ipc_args { char what_l_[PADL_(l_uint)]; l_uint what; char what_r_[PADR_(l_uint)]; char arg1_l_[PADL_(l_int)]; l_int arg1; char arg1_r_[PADR_(l_int)]; char arg2_l_[PADL_(l_int)]; l_int arg2; char arg2_r_[PADR_(l_int)]; - char arg3_l_[PADL_(l_int)]; l_int arg3; char arg3_r_[PADR_(l_int)]; - char ptr_l_[PADL_(void *)]; void * ptr; char ptr_r_[PADR_(void *)]; - char arg5_l_[PADL_(l_long)]; l_long arg5; char arg5_r_[PADR_(l_long)]; + char arg3_l_[PADL_(l_uint)]; l_uint arg3; char arg3_r_[PADR_(l_uint)]; + char ptr_l_[PADL_(l_uintptr_t)]; l_uintptr_t ptr; char ptr_r_[PADR_(l_uintptr_t)]; + char arg5_l_[PADL_(l_uint)]; l_uint arg5; char arg5_r_[PADR_(l_uint)]; }; struct linux_sigreturn_args { char sfp_l_[PADL_(struct l_sigframe *)]; struct l_sigframe * sfp; char sfp_r_[PADR_(struct l_sigframe *)]; Modified: head/sys/i386/linux/linux_systrace_args.c == --- head/sys/i386/linux/linux_systrace_args.c Sun Mar 24 14:44:35 2019 (r345469) +++ head/sys/i386/linux/linux_systrace_args.c Sun Mar 24 14:46:07 2019 (r345470) @@ -814,9 +814,9 @@ systrace_args(int sysnum, void *params, uint64_t *uarg iarg[0] = p->what; /* l_uint */ iarg[1] = p->arg1; /* l_int */ iarg[2] = p->arg2; /* l_int */ - iarg[3] = p->arg3; /* l_int */ - uarg[4] = (intptr_t) p->ptr; /* void * */ - iarg[5] = p->arg5; /* l_long */ +
svn commit: r345471 - in head/sys: amd64/linux amd64/linux32 compat/linux i386/linux
Author: dchagin Date: Sun Mar 24 14:50:02 2019 New Revision: 345471 URL: https://svnweb.freebsd.org/changeset/base/345471 Log: Update syscall.master to 5.0. For 32-bit Linuxulator, ipc() syscall was historically the entry point for the IPC API. Starting in Linux 4.18, direct syscalls are provided for the IPC. Enable it. MFC after:1 month Modified: head/sys/amd64/linux/linux_dummy.c head/sys/amd64/linux/syscalls.master head/sys/amd64/linux32/linux32_dummy.c head/sys/amd64/linux32/syscalls.master head/sys/compat/linux/linux_ipc.h head/sys/i386/linux/linux.h head/sys/i386/linux/linux_dummy.c head/sys/i386/linux/syscalls.master Modified: head/sys/amd64/linux/linux_dummy.c == --- head/sys/amd64/linux/linux_dummy.c Sun Mar 24 14:46:07 2019 (r345470) +++ head/sys/amd64/linux/linux_dummy.c Sun Mar 24 14:50:02 2019 (r345471) @@ -155,6 +155,16 @@ DUMMY(pwritev2); DUMMY(pkey_mprotect); DUMMY(pkey_alloc); DUMMY(pkey_free); +/* Linux 4.11: */ +DUMMY(statx); +/* Linux 4.18: */ +DUMMY(io_pgetevents); +DUMMY(rseq); +/* Linux 5.0: */ +DUMMY(pidfd_send_signal); +DUMMY(io_uring_setup); +DUMMY(io_uring_enter); +DUMMY(io_uring_register); #define DUMMY_XATTR(s) \ int\ Modified: head/sys/amd64/linux/syscalls.master == --- head/sys/amd64/linux/syscalls.masterSun Mar 24 14:46:07 2019 (r345470) +++ head/sys/amd64/linux/syscalls.masterSun Mar 24 14:50:02 2019 (r345471) @@ -595,7 +595,21 @@ 330AUE_NULLSTD { int linux_pkey_alloc(l_ulong flags, \ l_ulong init_val); } 331AUE_NULLSTD { int linux_pkey_free(l_int pkey); } +; Linux 4.11: +332AUE_NULLSTD { int linux_statx(l_int dirfd, \ + const char *pathname, l_uint flags, \ + l_uint mask, void *statxbuf); } +; Linux 4.18: +333AUE_NULLSTD { int linux_io_pgetevents(void); } +334AUE_NULLSTD { int linux_rseq(void); } +; Linux 5.0: +335-423AUE_NULLUNIMPL nosys +424AUE_NULLSTD { int linux_pidfd_send_signal(l_int pidfd, \ + l_int sig, l_siginfo_t *info, l_uint flags); } +425AUE_NULLSTD { int linux_io_uring_setup(void); } +426AUE_NULLSTD { int linux_io_uring_enter(void); } +427AUE_NULLSTD { int linux_io_uring_register(void); } ; please, keep this line at the end. -332AUE_NULLUNIMPL nosys +428AUE_NULLUNIMPL nosys ; vim: syntax=off Modified: head/sys/amd64/linux32/linux32_dummy.c == --- head/sys/amd64/linux32/linux32_dummy.c Sun Mar 24 14:46:07 2019 (r345470) +++ head/sys/amd64/linux32/linux32_dummy.c Sun Mar 24 14:50:02 2019 (r345471) @@ -161,6 +161,37 @@ DUMMY(pwritev2); DUMMY(pkey_mprotect); DUMMY(pkey_alloc); DUMMY(pkey_free); +/* Linux 4.11: */ +DUMMY(statx); +DUMMY(arch_prctl); +/* Linux 4.18: */ +DUMMY(io_pgetevents); +DUMMY(rseq); +/* Linux 5.0: */ +DUMMY(clock_gettime64); +DUMMY(clock_settime64); +DUMMY(clock_adjtime64); +DUMMY(clock_getres_time64); +DUMMY(clock_nanosleep_time64); +DUMMY(timer_gettime64); +DUMMY(timer_settime64); +DUMMY(timerfd_gettime64); +DUMMY(timerfd_settime64); +DUMMY(utimensat_time64); +DUMMY(pselect6_time64); +DUMMY(ppoll_time64); +DUMMY(io_pgetevents_time64); +DUMMY(recvmmsg_time64); +DUMMY(mq_timedsend_time64); +DUMMY(mq_timedreceive_time64); +DUMMY(semtimedop_time64); +DUMMY(rt_sigtimedwait_time64); +DUMMY(futex_time64); +DUMMY(sched_rr_get_interval_time64); +DUMMY(pidfd_send_signal); +DUMMY(io_uring_setup); +DUMMY(io_uring_enter); +DUMMY(io_uring_register); #define DUMMY_XATTR(s) \ int\ Modified: head/sys/amd64/linux32/syscalls.master == --- head/sys/amd64/linux32/syscalls.master Sun Mar 24 14:46:07 2019 (r345470) +++ head/sys/amd64/linux32/syscalls.master Sun Mar 24 14:50:02 2019 (r345471) @@ -686,7 +686,64 @@ 381AUE_NULLSTD { int linux_pkey_alloc(l_ulong flags, \ l_ulong init_val); } 382AUE_NULLSTD { int linux_pkey_free(l_int pkey); } +; Linux 4.11: +383AUE_NULLSTD { int linux_statx(l_int dirfd, \ + const char *pathname, l_uint flags, \ + l_uint mask,
svn commit: r345468 - head/sys/amd64/linux
Author: dchagin Date: Sun Mar 24 14:02:57 2019 New Revision: 345468 URL: https://svnweb.freebsd.org/changeset/base/345468 Log: Revert r313993. AMD64_SET_**BASE expects a pointer to a pointer, we just passing in the pointer value itself. Set PCB_FULL_IRET for doreti to restore %fs, %gs and its correspondig base. PR: 225105 Reported by: trasz@ MFC after:1 month Modified: head/sys/amd64/linux/linux_machdep.c Modified: head/sys/amd64/linux/linux_machdep.c == --- head/sys/amd64/linux/linux_machdep.cSun Mar 24 12:13:05 2019 (r345467) +++ head/sys/amd64/linux/linux_machdep.cSun Mar 24 14:02:57 2019 (r345468) @@ -228,35 +228,38 @@ linux_sigaltstack(struct thread *td, struct linux_siga int linux_arch_prctl(struct thread *td, struct linux_arch_prctl_args *args) { + struct pcb *pcb; int error; - struct sysarch_args bsd_args; + pcb = td->td_pcb; LINUX_CTR2(arch_prctl, "0x%x, %p", args->code, args->addr); switch (args->code) { case LINUX_ARCH_SET_GS: - bsd_args.op = AMD64_SET_GSBASE; - bsd_args.parms = (void *)args->addr; - error = sysarch(td, _args); - if (error == EINVAL) + if (args->addr < VM_MAXUSER_ADDRESS) { + set_pcb_flags(pcb, PCB_FULL_IRET); + pcb->pcb_gsbase = args->addr; + td->td_frame->tf_gs = _ugssel; + error = 0; + } else error = EPERM; break; case LINUX_ARCH_SET_FS: - bsd_args.op = AMD64_SET_FSBASE; - bsd_args.parms = (void *)args->addr; - error = sysarch(td, _args); - if (error == EINVAL) + if (args->addr < VM_MAXUSER_ADDRESS) { + set_pcb_flags(pcb, PCB_FULL_IRET); + pcb->pcb_fsbase = args->addr; + td->td_frame->tf_fs = _ufssel; + error = 0; + } else error = EPERM; break; case LINUX_ARCH_GET_FS: - bsd_args.op = AMD64_GET_FSBASE; - bsd_args.parms = (void *)args->addr; - error = sysarch(td, _args); + error = copyout(>pcb_fsbase, PTRIN(args->addr), + sizeof(args->addr)); break; case LINUX_ARCH_GET_GS: - bsd_args.op = AMD64_GET_GSBASE; - bsd_args.parms = (void *)args->addr; - error = sysarch(td, _args); + error = copyout(>pcb_gsbase, PTRIN(args->addr), + sizeof(args->addr)); break; default: error = EINVAL; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r322340 - in stable/11: share/man/man4 share/man/man5 sys/fs/fdescfs sys/kern sys/sys
Author: dchagin Date: Thu Aug 10 05:38:31 2017 New Revision: 322340 URL: https://svnweb.freebsd.org/changeset/base/322340 Log: MFC r321839: Implement proper Linux /dev/fd and /proc/self/fd behavior by adding Linux specific things to the native fdescfs file system. Unlike FreeBSD, the Linux fdescfs is a directory containing a symbolic links to the actual files, which the process has open. A readlink(2) call on this file returns a full path in case of regular file or a string in a special format (type:[inode], anon_inode:, etc..). As well as in a FreeBSD, opening the file in the Linux fdescfs directory is equivalent to duplicating the corresponding file descriptor. Here we have mutually exclusive requirements: - in case of readlink(2) call fdescfs lookup() method should return VLNK vnode otherwise our kern_readlink() fail with EINVAL error; - in the other calls fdescfs lookup() method should return non VLNK vnode. For what new vnode v_flag VV_READLINK was added, which is set if fdescfs has beed mounted with linrdlnk option an modified kern_readlinkat() to properly handle it. For now For Linux ABI compatibility mount fdescfs volume with linrdlnk option: mount -t fdescfs -o linrdlnk null /compat/linux/dev/fd Relnotes: yes Differential Revision:https://reviews.freebsd.org/D11452 Modified: stable/11/share/man/man4/linux.4 stable/11/share/man/man5/fdescfs.5 stable/11/sys/fs/fdescfs/fdesc.h stable/11/sys/fs/fdescfs/fdesc_vfsops.c stable/11/sys/fs/fdescfs/fdesc_vnops.c stable/11/sys/kern/vfs_syscalls.c stable/11/sys/sys/vnode.h Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/linux.4 == --- stable/11/share/man/man4/linux.4Thu Aug 10 05:35:45 2017 (r322339) +++ stable/11/share/man/man4/linux.4Thu Aug 10 05:38:31 2017 (r322340) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 8, 2010 +.Dd August 1, 2017 .Dt LINUX 4 .Os .Sh NAME @@ -127,9 +127,11 @@ regardless of whether the module is statically linked into the kernel or loaded as a module. .Sh FILES -.Bl -tag -width /compat/linux/proc -compact +.Bl -tag -width /compat/linux/dev/fd -compact .It Pa /compat/linux minimal Linux run-time environment +.It Pa /compat/linux/dev/fd +limited Linux file-descriptor file system .It Pa /compat/linux/proc limited Linux process file system .It Pa /compat/linux/sys @@ -138,6 +140,7 @@ limited Linux system file system .Sh SEE ALSO .Xr brandelf 1 , .Xr elf 5 , +.Xr fdescfs 5 , .Xr linprocfs 5 , .Xr linsysfs 5 .Sh HISTORY Modified: stable/11/share/man/man5/fdescfs.5 == --- stable/11/share/man/man5/fdescfs.5 Thu Aug 10 05:35:45 2017 (r322339) +++ stable/11/share/man/man5/fdescfs.5 Thu Aug 10 05:38:31 2017 (r322340) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 18, 2010 +.Dd August 1, 2017 .Dt FDESCFS 5 .Os .Sh NAME @@ -92,6 +92,14 @@ and files are created by default when devfs alone is mounted. .Nm creates entries for all file descriptors opened by the process. +.Pp +For +.Xr linux 4 +ABI compatibility mount +.Nm +volume with +.Cm linrdlnk +option. .Sh FILES .Bl -tag -width /dev/stderr -compact .It Pa /dev/fd/# @@ -103,6 +111,12 @@ volume located on .Pa /dev/fd : .Pp .Dl "mount -t fdescfs null /dev/fd" +.Pp +For +.Xr linux 4 +ABI compatibility: +.Pp +.Dl "mount -t fdescfs -o linrdlnk null /compat/linux/dev/fd" .Sh SEE ALSO .Xr devfs 5 , .Xr mount 8 Modified: stable/11/sys/fs/fdescfs/fdesc.h == --- stable/11/sys/fs/fdescfs/fdesc.hThu Aug 10 05:35:45 2017 (r322339) +++ stable/11/sys/fs/fdescfs/fdesc.hThu Aug 10 05:38:31 2017 (r322340) @@ -38,7 +38,9 @@ #define _FS_FDESC_H_ /* Private mount flags for fdescfs. */ -#define FMNT_UNMOUNTF 0x01 +#define FMNT_UNMOUNTF 0x01 +#define FMNT_LINRDLNKF 0x02 + struct fdescmount { struct vnode*f_root;/* Root node */ int flags; Modified: stable/11/sys/fs/fdescfs/fdesc_vfsops.c == --- stable/11/sys/fs/fdescfs/fdesc_vfsops.c Thu Aug 10 05:35:45 2017 (r322339) +++ stable/11/sys/fs/fdescfs/fdesc_vfsops.c Thu Aug 10 05:38:31 2017 (r322340) @@ -101,6 +101,8 @@ fdesc_mount(struct mount *mp) */ mp->mnt_data = fmp; fmp->flags = 0; + if (vfs_getopt(mp->mnt_optnew, "linrdlnk", NULL, NULL) == 0) + fmp->flags |= FMNT_LINRDLNKF; error = fdesc_allocvp(Froot, -1, FD_ROOT, mp, ); if (error) { free(fmp, M_FDESCMNT); Modified: stable/11/sys/fs/fdescfs/fdesc_vnops.c ==
svn commit: r322339 - stable/11/sys/fs/fdescfs
Author: dchagin Date: Thu Aug 10 05:35:45 2017 New Revision: 322339 URL: https://svnweb.freebsd.org/changeset/base/322339 Log: MFC r321460: Replace unnecessary _KERNEL by double-include protection. Modified: stable/11/sys/fs/fdescfs/fdesc.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/fdescfs/fdesc.h == --- stable/11/sys/fs/fdescfs/fdesc.hThu Aug 10 03:43:23 2017 (r322338) +++ stable/11/sys/fs/fdescfs/fdesc.hThu Aug 10 05:35:45 2017 (r322339) @@ -34,7 +34,9 @@ * $FreeBSD$ */ -#ifdef _KERNEL +#ifndef _FS_FDESC_H_ +#define _FS_FDESC_H_ + /* Private mount flags for fdescfs. */ #define FMNT_UNMOUNTF 0x01 struct fdescmount { @@ -66,4 +68,4 @@ extern vfs_init_t fdesc_init; extern vfs_uninit_t fdesc_uninit; extern int fdesc_allocvp(fdntype, unsigned, int, struct mount *, struct vnode **); -#endif /* _KERNEL */ +#endif /* !_FS_FDESC_H_ */ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r321839 - in head: share/man/man4 share/man/man5 sys/fs/fdescfs sys/kern sys/sys
Author: dchagin Date: Tue Aug 1 03:40:19 2017 New Revision: 321839 URL: https://svnweb.freebsd.org/changeset/base/321839 Log: Implement proper Linux /dev/fd and /proc/self/fd behavior by adding Linux specific things to the native fdescfs file system. Unlike FreeBSD, the Linux fdescfs is a directory containing a symbolic links to the actual files, which the process has open. A readlink(2) call on this file returns a full path in case of regular file or a string in a special format (type:[inode], anon_inode:, etc..). As well as in a FreeBSD, opening the file in the Linux fdescfs directory is equivalent to duplicating the corresponding file descriptor. Here we have mutually exclusive requirements: - in case of readlink(2) call fdescfs lookup() method should return VLNK vnode otherwise our kern_readlink() fail with EINVAL error; - in the other calls fdescfs lookup() method should return non VLNK vnode. For what new vnode v_flag VV_READLINK was added, which is set if fdescfs has beed mounted with linrdlnk option an modified kern_readlinkat() to properly handle it. For now For Linux ABI compatibility mount fdescfs volume with linrdlnk option: mount -t fdescfs -o linrdlnk null /compat/linux/dev/fd Reviewed by: kib@ MFC after:1 week Relnotes: yes Modified: head/share/man/man4/linux.4 head/share/man/man5/fdescfs.5 head/sys/fs/fdescfs/fdesc.h head/sys/fs/fdescfs/fdesc_vfsops.c head/sys/fs/fdescfs/fdesc_vnops.c head/sys/kern/vfs_syscalls.c head/sys/sys/vnode.h Modified: head/share/man/man4/linux.4 == --- head/share/man/man4/linux.4 Tue Aug 1 03:13:43 2017(r321838) +++ head/share/man/man4/linux.4 Tue Aug 1 03:40:19 2017(r321839) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 8, 2010 +.Dd August 1, 2017 .Dt LINUX 4 .Os .Sh NAME @@ -127,9 +127,11 @@ regardless of whether the module is statically linked into the kernel or loaded as a module. .Sh FILES -.Bl -tag -width /compat/linux/proc -compact +.Bl -tag -width /compat/linux/dev/fd -compact .It Pa /compat/linux minimal Linux run-time environment +.It Pa /compat/linux/dev/fd +limited Linux file-descriptor file system .It Pa /compat/linux/proc limited Linux process file system .It Pa /compat/linux/sys @@ -138,6 +140,7 @@ limited Linux system file system .Sh SEE ALSO .Xr brandelf 1 , .Xr elf 5 , +.Xr fdescfs 5 , .Xr linprocfs 5 , .Xr linsysfs 5 .Sh HISTORY Modified: head/share/man/man5/fdescfs.5 == --- head/share/man/man5/fdescfs.5 Tue Aug 1 03:13:43 2017 (r321838) +++ head/share/man/man5/fdescfs.5 Tue Aug 1 03:40:19 2017 (r321839) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 18, 2010 +.Dd August 1, 2017 .Dt FDESCFS 5 .Os .Sh NAME @@ -92,6 +92,14 @@ and files are created by default when devfs alone is mounted. .Nm creates entries for all file descriptors opened by the process. +.Pp +For +.Xr linux 4 +ABI compatibility mount +.Nm +volume with +.Cm linrdlnk +option. .Sh FILES .Bl -tag -width /dev/stderr -compact .It Pa /dev/fd/# @@ -103,6 +111,12 @@ volume located on .Pa /dev/fd : .Pp .Dl "mount -t fdescfs null /dev/fd" +.Pp +For +.Xr linux 4 +ABI compatibility: +.Pp +.Dl "mount -t fdescfs -o linrdlnk null /compat/linux/dev/fd" .Sh SEE ALSO .Xr devfs 5 , .Xr mount 8 Modified: head/sys/fs/fdescfs/fdesc.h == --- head/sys/fs/fdescfs/fdesc.h Tue Aug 1 03:13:43 2017(r321838) +++ head/sys/fs/fdescfs/fdesc.h Tue Aug 1 03:40:19 2017(r321839) @@ -38,7 +38,9 @@ #define _FS_FDESC_H_ /* Private mount flags for fdescfs. */ -#define FMNT_UNMOUNTF 0x01 +#define FMNT_UNMOUNTF 0x01 +#define FMNT_LINRDLNKF 0x02 + struct fdescmount { struct vnode*f_root;/* Root node */ int flags; Modified: head/sys/fs/fdescfs/fdesc_vfsops.c == --- head/sys/fs/fdescfs/fdesc_vfsops.c Tue Aug 1 03:13:43 2017 (r321838) +++ head/sys/fs/fdescfs/fdesc_vfsops.c Tue Aug 1 03:40:19 2017 (r321839) @@ -101,6 +101,8 @@ fdesc_mount(struct mount *mp) */ mp->mnt_data = fmp; fmp->flags = 0; + if (vfs_getopt(mp->mnt_optnew, "linrdlnk", NULL, NULL) == 0) + fmp->flags |= FMNT_LINRDLNKF; error = fdesc_allocvp(Froot, -1, FD_ROOT, mp, ); if (error) { free(fmp, M_FDESCMNT); Modified: head/sys/fs/fdescfs/fdesc_vnops.c == --- head/sys/fs/fdescfs/fdesc_vnops.c Tue Aug 1 03:13:43 2017 (r321838) +++ head/sys/fs/fdescfs/fdesc_vnops.c Tue Aug 1 03:40:19 2017 (r321839) @@ -69,6 +69,7 @@ static vop_getattr_t
svn commit: r321728 - in head/sys: amd64/linux amd64/linux32 compat/linux i386/linux
Author: dchagin Date: Sun Jul 30 21:24:20 2017 New Revision: 321728 URL: https://svnweb.freebsd.org/changeset/base/321728 Log: Avoid using [LINUX_]SHAREDPAGE constant directly in the vdso code. This is needed for https://reviews.freebsd.org/D11780. Reported by: kib@ Modified: head/sys/amd64/linux/linux_sysvec.c head/sys/amd64/linux32/linux32_sysvec.c head/sys/compat/linux/linux_vdso.c head/sys/compat/linux/linux_vdso.h head/sys/i386/linux/linux_sysvec.c Modified: head/sys/amd64/linux/linux_sysvec.c == --- head/sys/amd64/linux/linux_sysvec.c Sun Jul 30 19:58:31 2017 (r321727) +++ head/sys/amd64/linux/linux_sysvec.c Sun Jul 30 21:24:20 2017 (r321728) @@ -844,14 +844,14 @@ linux_vdso_install(void *param) linux_shared_page_obj = __elfN(linux_shared_page_init) (_shared_page_mapping); - __elfN(linux_vdso_reloc)(_linux_sysvec, SHAREDPAGE); + __elfN(linux_vdso_reloc)(_linux_sysvec); bcopy(elf_linux_sysvec.sv_sigcode, linux_shared_page_mapping, linux_szsigcode); elf_linux_sysvec.sv_shared_page_obj = linux_shared_page_obj; linux_kplatform = linux_shared_page_mapping + - (linux_platform - (caddr_t)SHAREDPAGE); + (linux_platform - (caddr_t)elf_linux_sysvec.sv_shared_page_base); } SYSINIT(elf_linux_vdso_init, SI_SUB_EXEC, SI_ORDER_ANY, (sysinit_cfunc_t)linux_vdso_install, NULL); Modified: head/sys/amd64/linux32/linux32_sysvec.c == --- head/sys/amd64/linux32/linux32_sysvec.c Sun Jul 30 19:58:31 2017 (r321727) +++ head/sys/amd64/linux32/linux32_sysvec.c Sun Jul 30 21:24:20 2017 (r321728) @@ -1062,14 +1062,14 @@ linux_vdso_install(void *param) linux_shared_page_obj = __elfN(linux_shared_page_init) (_shared_page_mapping); - __elfN(linux_vdso_reloc)(_linux_sysvec, LINUX32_SHAREDPAGE); + __elfN(linux_vdso_reloc)(_linux_sysvec); bcopy(elf_linux_sysvec.sv_sigcode, linux_shared_page_mapping, linux_szsigcode); elf_linux_sysvec.sv_shared_page_obj = linux_shared_page_obj; linux_kplatform = linux_shared_page_mapping + - (linux_platform - (caddr_t)LINUX32_SHAREDPAGE); + (linux_platform - (caddr_t)elf_linux_sysvec.sv_shared_page_base); } SYSINIT(elf_linux_vdso_init, SI_SUB_EXEC, SI_ORDER_ANY, (sysinit_cfunc_t)linux_vdso_install, NULL); Modified: head/sys/compat/linux/linux_vdso.c == --- head/sys/compat/linux/linux_vdso.c Sun Jul 30 19:58:31 2017 (r321727) +++ head/sys/compat/linux/linux_vdso.c Sun Jul 30 21:24:20 2017 (r321728) @@ -139,7 +139,7 @@ __elfN(linux_vdso_fixup)(struct sysentvec *sv) } void -__elfN(linux_vdso_reloc)(struct sysentvec *sv, long vdso_adjust) +__elfN(linux_vdso_reloc)(struct sysentvec *sv) { struct linux_vdso_sym *lsym; Elf_Ehdr *ehdr; @@ -152,13 +152,13 @@ __elfN(linux_vdso_reloc)(struct sysentvec *sv, long vd ehdr = (Elf_Ehdr *) sv->sv_sigcode; /* Adjust our so relative to the sigcode_base */ - if (vdso_adjust != 0) { - ehdr->e_entry += vdso_adjust; + if (sv->sv_shared_page_base != 0) { + ehdr->e_entry += sv->sv_shared_page_base; phdr = (Elf_Phdr *)((caddr_t)ehdr + ehdr->e_phoff); /* phdrs */ for (i = 0; i < ehdr->e_phnum; i++) { - phdr[i].p_vaddr += vdso_adjust; + phdr[i].p_vaddr += sv->sv_shared_page_base; if (phdr[i].p_type != PT_DYNAMIC) continue; dyn = (Elf_Dyn *)((caddr_t)ehdr + phdr[i].p_offset); @@ -178,13 +178,13 @@ __elfN(linux_vdso_reloc)(struct sysentvec *sv, long vd case DT_VERDEF: case DT_VERNEED: case DT_ADDRRNGLO ... DT_ADDRRNGHI: - dyn->d_un.d_ptr += vdso_adjust; + dyn->d_un.d_ptr += sv->sv_shared_page_base; break; case DT_ENCODING ... DT_LOOS-1: case DT_LOOS ... DT_HIOS: if (dyn->d_tag >= DT_ENCODING && (dyn->d_tag & 1) == 0) - dyn->d_un.d_ptr += vdso_adjust; + dyn->d_un.d_ptr += sv->sv_shared_page_base; break; default: break; @@ -197,7 +197,7 @@ __elfN(linux_vdso_reloc)(struct
svn commit: r321716 - stable/11/sys/fs/fdescfs
Author: dchagin Date: Sun Jul 30 08:02:06 2017 New Revision: 321716 URL: https://svnweb.freebsd.org/changeset/base/321716 Log: MFC r320837: Style(9). Whitespace. Modified: stable/11/sys/fs/fdescfs/fdesc_vnops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/fdescfs/fdesc_vnops.c == --- stable/11/sys/fs/fdescfs/fdesc_vnops.c Sun Jul 30 08:00:54 2017 (r321715) +++ stable/11/sys/fs/fdescfs/fdesc_vnops.c Sun Jul 30 08:02:06 2017 (r321716) @@ -358,7 +358,7 @@ fdesc_lookup(struct vop_lookup_args *ap) error = vn_vget_ino_gen(dvp, fdesc_get_ino_alloc, , LK_EXCLUSIVE, ); } - + if (error) goto bad; *vpp = fvp; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r321715 - stable/11/sys/fs/fdescfs
Author: dchagin Date: Sun Jul 30 08:00:54 2017 New Revision: 321715 URL: https://svnweb.freebsd.org/changeset/base/321715 Log: MFC r320836: Eliminate bogus casts. Modified: stable/11/sys/fs/fdescfs/fdesc_vnops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/fdescfs/fdesc_vnops.c == --- stable/11/sys/fs/fdescfs/fdesc_vnops.c Sun Jul 30 06:53:58 2017 (r321714) +++ stable/11/sys/fs/fdescfs/fdesc_vnops.c Sun Jul 30 08:00:54 2017 (r321715) @@ -162,7 +162,7 @@ loop: * If a forced unmount is progressing, we need to drop it. The flags are * protected by the hashmtx. */ - fmp = (struct fdescmount *)mp->mnt_data; + fmp = mp->mnt_data; if (fmp == NULL || fmp->flags & FMNT_UNMOUNTF) { mtx_unlock(_hashmtx); return (-1); @@ -207,7 +207,7 @@ loop: * If a forced unmount is progressing, we need to drop it. The flags are * protected by the hashmtx. */ - fmp = (struct fdescmount *)mp->mnt_data; + fmp = mp->mnt_data; if (fmp == NULL || fmp->flags & FMNT_UNMOUNTF) { mtx_unlock(_hashmtx); vgone(vp); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r321682 - stable/11/sys/compat/linux
Author: dchagin Date: Sat Jul 29 10:31:57 2017 New Revision: 321682 URL: https://svnweb.freebsd.org/changeset/base/321682 Log: MFC r321366: Style(9) whitespace fix. Modified: stable/11/sys/compat/linux/linux_ioctl.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linux/linux_ioctl.h == --- stable/11/sys/compat/linux/linux_ioctl.hSat Jul 29 10:30:13 2017 (r321681) +++ stable/11/sys/compat/linux/linux_ioctl.hSat Jul 29 10:31:57 2017 (r321682) @@ -198,7 +198,7 @@ #defineLINUX_VT_SETMODE0x5602 #defineLINUX_VT_GETSTATE 0x5603 #defineLINUX_VT_RELDISP0x5605 -#defineLINUX_VT_ACTIVATE 0x5606 +#defineLINUX_VT_ACTIVATE 0x5606 #defineLINUX_VT_WAITACTIVE 0x5607 #defineLINUX_IOCTL_CONSOLE_MIN LINUX_KIOCSOUND ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r321681 - stable/11/sys/fs/fdescfs
Author: dchagin Date: Sat Jul 29 10:30:13 2017 New Revision: 321681 URL: https://svnweb.freebsd.org/changeset/base/321681 Log: MFC r320814: Style(9). Add blank line aftr {. MFC r320815: Remove init from declaration. MFC r320816: Remove init from declaration, collapse two int vars declarations into single. MFC r320817: Don't take a lock around atomic operation. MFC r320818: Eliminate the bogus cast. MFC r320819: Eliminate the bogus cast. MFC r320820: Don't initialize error in declaration. Modified: stable/11/sys/fs/fdescfs/fdesc_vfsops.c stable/11/sys/fs/fdescfs/fdesc_vnops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/fdescfs/fdesc_vfsops.c == --- stable/11/sys/fs/fdescfs/fdesc_vfsops.c Sat Jul 29 09:56:07 2017 (r321680) +++ stable/11/sys/fs/fdescfs/fdesc_vfsops.c Sat Jul 29 10:30:13 2017 (r321681) @@ -68,6 +68,7 @@ static vfs_root_t fdesc_root; int fdesc_cmount(struct mntarg *ma, void *data, uint64_t flags) { + return kernel_mount(ma, flags); } @@ -77,10 +78,10 @@ fdesc_cmount(struct mntarg *ma, void *data, uint64_t f static int fdesc_mount(struct mount *mp) { - int error = 0; struct fdescmount *fmp; struct thread *td = curthread; struct vnode *rvp; + int error; if (!prison_allow(td->td_ucred, PR_ALLOW_MOUNT_FDESCFS)) return (EPERM); @@ -98,7 +99,7 @@ fdesc_mount(struct mount *mp) * We need to initialize a few bits of our local mount point struct to * avoid confusion in allocvp. */ - mp->mnt_data = (qaddr_t) fmp; + mp->mnt_data = fmp; fmp->flags = 0; error = fdesc_allocvp(Froot, -1, FD_ROOT, mp, ); if (error) { @@ -122,11 +123,10 @@ static int fdesc_unmount(struct mount *mp, int mntflags) { struct fdescmount *fmp; - caddr_t data; - int error; - int flags = 0; + int error, flags; - fmp = (struct fdescmount *)mp->mnt_data; + flags = 0; + fmp = mp->mnt_data; if (mntflags & MNT_FORCE) { /* The hash mutex protects the private mount flags. */ mtx_lock(_hashmtx); @@ -147,15 +147,10 @@ fdesc_unmount(struct mount *mp, int mntflags) return (error); /* -* Finally, throw away the fdescmount structure. Hold the hashmtx to -* protect the fdescmount structure. +* Finally, throw away the fdescmount structure. */ - mtx_lock(_hashmtx); - data = mp->mnt_data; mp->mnt_data = NULL; - mtx_unlock(_hashmtx); - free(data, M_FDESCMNT); /* XXX */ - + free(fmp, M_FDESCMNT); return (0); } Modified: stable/11/sys/fs/fdescfs/fdesc_vnops.c == --- stable/11/sys/fs/fdescfs/fdesc_vnops.c Sat Jul 29 09:56:07 2017 (r321680) +++ stable/11/sys/fs/fdescfs/fdesc_vnops.c Sat Jul 29 10:30:13 2017 (r321681) @@ -152,7 +152,7 @@ fdesc_allocvp(fdntype ftype, unsigned fd_fd, int ix, s struct fdescnode *fd, *fd2; struct vnode *vp, *vp2; struct thread *td; - int error = 0; + int error; td = curthread; fc = FD_NHASH(ix); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r321460 - head/sys/fs/fdescfs
Author: dchagin Date: Tue Jul 25 06:59:35 2017 New Revision: 321460 URL: https://svnweb.freebsd.org/changeset/base/321460 Log: Replace unnecessary _KERNEL by double-include protection. MFC after:2 week Modified: head/sys/fs/fdescfs/fdesc.h Modified: head/sys/fs/fdescfs/fdesc.h == --- head/sys/fs/fdescfs/fdesc.h Tue Jul 25 04:13:43 2017(r321459) +++ head/sys/fs/fdescfs/fdesc.h Tue Jul 25 06:59:35 2017(r321460) @@ -34,7 +34,9 @@ * $FreeBSD$ */ -#ifdef _KERNEL +#ifndef _FS_FDESC_H_ +#define _FS_FDESC_H_ + /* Private mount flags for fdescfs. */ #define FMNT_UNMOUNTF 0x01 struct fdescmount { @@ -66,4 +68,4 @@ extern vfs_init_t fdesc_init; extern vfs_uninit_t fdesc_uninit; extern int fdesc_allocvp(fdntype, unsigned, int, struct mount *, struct vnode **); -#endif /* _KERNEL */ +#endif /* !_FS_FDESC_H_ */ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r321366 - head/sys/compat/linux
Author: dchagin Date: Sat Jul 22 09:03:40 2017 New Revision: 321366 URL: https://svnweb.freebsd.org/changeset/base/321366 Log: Style(9) whitespace fix. MFC after:1 week Modified: head/sys/compat/linux/linux_ioctl.h Modified: head/sys/compat/linux/linux_ioctl.h == --- head/sys/compat/linux/linux_ioctl.h Sat Jul 22 07:28:44 2017 (r321365) +++ head/sys/compat/linux/linux_ioctl.h Sat Jul 22 09:03:40 2017 (r321366) @@ -198,7 +198,7 @@ #defineLINUX_VT_SETMODE0x5602 #defineLINUX_VT_GETSTATE 0x5603 #defineLINUX_VT_RELDISP0x5605 -#defineLINUX_VT_ACTIVATE 0x5606 +#defineLINUX_VT_ACTIVATE 0x5606 #defineLINUX_VT_WAITACTIVE 0x5607 #defineLINUX_IOCTL_CONSOLE_MIN LINUX_KIOCSOUND ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r321026 - in stable/10/sys: amd64/linux compat/linux
Author: dchagin Date: Sat Jul 15 18:25:59 2017 New Revision: 321026 URL: https://svnweb.freebsd.org/changeset/base/321026 Log: MFC r305994 (by emaste@): Catch up to sys/capability.h rename to sys/capsicum.h in r263232 Modified: stable/10/sys/amd64/linux/linux_machdep.c stable/10/sys/compat/linux/linux_event.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/linux/linux_machdep.c == --- stable/10/sys/amd64/linux/linux_machdep.c Sat Jul 15 18:08:20 2017 (r321025) +++ stable/10/sys/amd64/linux/linux_machdep.c Sat Jul 15 18:25:59 2017 (r321026) @@ -35,7 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include #include Modified: stable/10/sys/compat/linux/linux_event.c == --- stable/10/sys/compat/linux/linux_event.cSat Jul 15 18:08:20 2017 (r321025) +++ stable/10/sys/compat/linux/linux_event.cSat Jul 15 18:25:59 2017 (r321026) @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include #include ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r321025 - stable/10/sys/compat/linux
Author: dchagin Date: Sat Jul 15 18:08:20 2017 New Revision: 321025 URL: https://svnweb.freebsd.org/changeset/base/321025 Log: MFC r298071 (by pfg@): compat/linux: for pointers replace 0 with NULL. plvc is a pointer, no functional change. Found with devel/coccinelle. Modified: stable/10/sys/compat/linux/linux_ioctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/compat/linux/linux_ioctl.c == --- stable/10/sys/compat/linux/linux_ioctl.cSat Jul 15 18:05:28 2017 (r321024) +++ stable/10/sys/compat/linux/linux_ioctl.cSat Jul 15 18:08:20 2017 (r321025) @@ -2912,7 +2912,7 @@ linux_v4l_cliplist_copy(struct l_video_window *lvw, st vw->clips = NULL; ppvc = &(vw->clips); while (clipcount-- > 0) { - if (plvc == 0) { + if (plvc == NULL) { error = EFAULT; break; } else { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"