svn commit: r368510 - head/usr.sbin/diskinfo
Author: trasz Date: Thu Dec 10 10:23:18 2020 New Revision: 368510 URL: https://svnweb.freebsd.org/changeset/base/368510 Log: Make "diskinfo -i" also test 1MB reads. Modified: head/usr.sbin/diskinfo/diskinfo.c Modified: head/usr.sbin/diskinfo/diskinfo.c == --- head/usr.sbin/diskinfo/diskinfo.c Thu Dec 10 10:00:43 2020 (r368509) +++ head/usr.sbin/diskinfo/diskinfo.c Thu Dec 10 10:23:18 2020 (r368510) @@ -644,6 +644,9 @@ iopsbench(int fd, off_t mediasize, u_int sectorsize) printf("\t128 kbytes: "); iops(fd, mediasize, 128 * 1024); + printf("\t1024 kbytes: "); + iops(fd, mediasize, 1024 * 1024); + printf("\n"); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367956 - head/usr.sbin/ctladm
Author: trasz Date: Mon Nov 23 14:30:27 2020 New Revision: 367956 URL: https://svnweb.freebsd.org/changeset/base/367956 Log: Replace paths in ctladm(8) examples with something sensible. PR: 251181 Reviewed by: 0mp, rm, ygy MFC after:2 weeks Sponsored by: EPSRC Differential Revision:https://reviews.freebsd.org/D27249 Modified: head/usr.sbin/ctladm/ctladm.8 Modified: head/usr.sbin/ctladm/ctladm.8 == --- head/usr.sbin/ctladm/ctladm.8 Mon Nov 23 14:30:22 2020 (r367955) +++ head/usr.sbin/ctladm/ctladm.8 Mon Nov 23 14:30:27 2020 (r367956) @@ -36,7 +36,7 @@ .\" $Id: //depot/users/kenm/FreeBSD-test2/usr.sbin/ctladm/ctladm.8#3 $ .\" $FreeBSD$ .\" -.Dd August 6, 2020 +.Dd November 23, 2020 .Dt CTLADM 8 .Os .Sh NAME @@ -1029,23 +1029,17 @@ while reporting size of 10 terabytes, .Pp .Dl ctladm create -b ramdisk -s 10T -o capacity=10G .Pp -Create a LUN using the block backend, and specify the file -.Pa src/usr.sbin/ctladm/ctladm.8 -as the backing store. -The size of the LUN will be derived from the size of the file. -.Pp -.Dl ctladm create -b block -o file=src/usr.sbin/ctladm/ctladm.8 -.Pp -Create a LUN using the block backend, specify the file -.Pa src/usr.sbin/ctladm/ctladm.8 +Create a LUN using the block backend, specify the ZFS volume +.Pa tank/example as the backing store, and specify the .Tn SCSI VPD page 0x80 and 0x83 serial number .Fl ( S ) and device ID .Fl ( d ) . +The size of the LUN will be derived from the size of the ZVOL. .Pp -.Dl ctladm create -b block -o file=src/usr.sbin/ctladm/ctladm.8 -S MYSERIAL321 -d MYDEVID123 +.Dl ctladm create -b block -o file=/dev/zvol/tank/example -S MYSERIAL321 -d MYDEVID123 .Pp Use to specify generic options on ioctl frontend port, now it is only possible to set pp and/or vp port number. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367954 - head/share/man/man7
Author: trasz Date: Mon Nov 23 14:26:59 2020 New Revision: 367954 URL: https://svnweb.freebsd.org/changeset/base/367954 Log: Assorted tweaks to hier(7): punctuation, some .Xr's, clarify wording. Reviewed by: 0mp, bcr, imp MFC after:2 weeks Sponsored by: EPSRC Differential Revision:https://reviews.freebsd.org/D27248 Modified: head/share/man/man7/hier.7 Modified: head/share/man/man7/hier.7 == --- head/share/man/man7/hier.7 Mon Nov 23 13:05:11 2020(r367953) +++ head/share/man/man7/hier.7 Mon Nov 23 14:26:59 2020(r367954) @@ -28,7 +28,7 @@ .\"@(#)hier.7 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd January 20, 2020 +.Dd November 23, 2020 .Dt HIER 7 .Os .Sh NAME @@ -54,7 +54,7 @@ Compiled flattened device tree (FDT) files; see and .Xr dtc 1 .It Pa efi/ -Mount point for EFI System Partition (ESP) on UEFI systems. +Mount point for EFI System Partition (ESP) on UEFI systems .It Pa firmware/ loadable kernel modules containing binary firmware for hardware that needs firmware downloaded to it to function @@ -62,9 +62,8 @@ firmware downloaded to it to function pure kernel executable (the operating system loaded into memory at boot time) and kernel modules .It Pa modules/ -third-party loadable kernel modules; -see -.Xr kldstat 8 +third-party loadable kernel modules, such as the ones installed from +.Xr ports 7 .It Pa overlays/ Compiled flattened device tree (FDT) overlays; see .Xr fdt 4 @@ -197,8 +196,9 @@ contains the majority of user utilities and applicatio .It Pa bin/ common utilities, programming tools, and applications .It Pa compat/ -files needed to support binary compatibility with other operating systems, -such as Linux +files needed to support binary compatibility with other operating systems; +see +.Xr linux 4 .It Pa include/ standard C include files .Pp @@ -435,7 +435,7 @@ tree .Xr ports 7 , the .Fx -ports collection. +ports collection .It Pa sbin/ system daemons & system utilities (executed by users) .It Pa share/ @@ -604,8 +604,8 @@ see .El .Pp .It Pa src/ -.Bx , -third-party, and/or local source files +.Fx +source code .Pp .Bl -tag -width "kerberos5/" -compact .It Pa bin/ @@ -734,10 +734,8 @@ source code for files in .It Pa tests/ The .Fx -test suite. -See +test suite; see .Xr tests 7 -for more details. .El .It Pa /var/ multi-purpose log, temporary, transient, and spool files ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367953 - head/sys/dev/firewire
Author: trasz Date: Mon Nov 23 13:05:11 2020 New Revision: 367953 URL: https://svnweb.freebsd.org/changeset/base/367953 Log: Make sbp(4) use xpt_alloc_ccb/xpt_free_ccb instead of malloc/free. Reviewed by: imp, mav MFC after:2 weeks Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision:https://reviews.freebsd.org/D26843 Modified: head/sys/dev/firewire/sbp.c Modified: head/sys/dev/firewire/sbp.c == --- head/sys/dev/firewire/sbp.c Mon Nov 23 13:02:23 2020(r367952) +++ head/sys/dev/firewire/sbp.c Mon Nov 23 13:05:11 2020(r367953) @@ -987,7 +987,7 @@ END_DEBUG sdev = sbp_next_dev(target, sdev->lun_id + 1); if (sdev == NULL) { SBP_UNLOCK(sbp); - free(ccb, M_SBP); + xpt_free_ccb(ccb); return; } /* reuse ccb */ @@ -1019,9 +1019,9 @@ SBP_DEBUG(0) device_printf(sdev->target->sbp->fd.dev, "%s:%s\n", __func__, sdev->bustgtlun); END_DEBUG - ccb = malloc(sizeof(union ccb), M_SBP, M_NOWAIT | M_ZERO); + ccb = xpt_alloc_ccb_nowait(); if (ccb == NULL) { - printf("sbp_cam_scan_target: malloc failed\n"); + printf("sbp_cam_scan_target: xpt_alloc_ccb_nowait() failed\n"); return; } SBP_UNLOCK(target->sbp); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367952 - head/sys/dev/tws
Author: trasz Date: Mon Nov 23 13:02:23 2020 New Revision: 367952 URL: https://svnweb.freebsd.org/changeset/base/367952 Log: Make tws(4) use xpt_alloc_ccb()/xpt_free_ccb() instead of malloc/free. Reviewed by: imp MFC after:2 weeks Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision:https://reviews.freebsd.org/D26841 Modified: head/sys/dev/tws/tws.c Modified: head/sys/dev/tws/tws.c == --- head/sys/dev/tws/tws.c Mon Nov 23 12:59:56 2020(r367951) +++ head/sys/dev/tws/tws.c Mon Nov 23 13:02:23 2020(r367952) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include MALLOC_DEFINE(M_TWS, "twsbuf", "buffers used by tws driver"); int tws_queue_depth = TWS_MAX_REQS; @@ -412,7 +413,7 @@ tws_detach(device_t dev) callout_drain(>stats_timer); free(sc->reqs, M_TWS); free(sc->sense_bufs, M_TWS); -free(sc->scan_ccb, M_TWS); +xpt_free_ccb(sc->scan_ccb); if (sc->ioctl_data_mem) bus_dmamem_free(sc->data_tag, sc->ioctl_data_mem, sc->ioctl_data_map); if (sc->data_tag) @@ -597,7 +598,7 @@ tws_init(struct tws_softc *sc) M_WAITOK | M_ZERO); sc->sense_bufs = malloc(sizeof(struct tws_sense) * tws_queue_depth, M_TWS, M_WAITOK | M_ZERO); -sc->scan_ccb = malloc(sizeof(union ccb), M_TWS, M_WAITOK | M_ZERO); +sc->scan_ccb = xpt_alloc_ccb(); if (bus_dmamem_alloc(sc->data_tag, (void **)>ioctl_data_mem, (BUS_DMA_NOWAIT | BUS_DMA_ZERO), >ioctl_data_map)) { device_printf(sc->tws_dev, "Cannot allocate ioctl data mem\n"); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367951 - head/sys/dev/hptmv
Author: trasz Date: Mon Nov 23 12:59:56 2020 New Revision: 367951 URL: https://svnweb.freebsd.org/changeset/base/367951 Log: Don't check return from xpt_alloc_ccb() for being NULL; since it's not the _nowait wariant, it cannot fail. Suggested by: mav MFC after:2 weeks Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Modified: head/sys/dev/hptmv/entry.c Modified: head/sys/dev/hptmv/entry.c == --- head/sys/dev/hptmv/entry.c Mon Nov 23 12:57:24 2020(r367950) +++ head/sys/dev/hptmv/entry.c Mon Nov 23 12:59:56 2020(r367951) @@ -2008,15 +2008,10 @@ hpt_attach(device_t dev) } - if ((ccb = xpt_alloc_ccb()) != NULL) - { - ccb->ccb_h.pinfo.priority = 1; - ccb->ccb_h.pinfo.index = CAM_UNQUEUED_INDEX; - } - else - { - return ENOMEM; - } + ccb = xpt_alloc_ccb(); + ccb->ccb_h.pinfo.priority = 1; + ccb->ccb_h.pinfo.index = CAM_UNQUEUED_INDEX; + /* * Create the device queue for our SIM(s). */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367950 - head/sys/dev/hptmv
Author: trasz Date: Mon Nov 23 12:57:24 2020 New Revision: 367950 URL: https://svnweb.freebsd.org/changeset/base/367950 Log: Make hptmv(4) use xpt_alloc_ccb/xpt_free_ccb instead of malloc/free. Reviewed by: imp, mav MFC after:2 weeks Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision:https://reviews.freebsd.org/D26842 Modified: head/sys/dev/hptmv/entry.c Modified: head/sys/dev/hptmv/entry.c == --- head/sys/dev/hptmv/entry.c Mon Nov 23 12:54:19 2020(r367949) +++ head/sys/dev/hptmv/entry.c Mon Nov 23 12:57:24 2020(r367950) @@ -2008,9 +2008,8 @@ hpt_attach(device_t dev) } - if((ccb = (union ccb *)malloc(sizeof(*ccb), M_DEVBUF, M_WAITOK)) != (union ccb*)NULL) + if ((ccb = xpt_alloc_ccb()) != NULL) { - bzero(ccb, sizeof(*ccb)); ccb->ccb_h.pinfo.priority = 1; ccb->ccb_h.pinfo.index = CAM_UNQUEUED_INDEX; } @@ -2065,7 +2064,7 @@ hpt_attach(device_t dev) ccb->csa.callback = hpt_async; ccb->csa.callback_arg = hpt_vsim; xpt_action((union ccb *)ccb); - free(ccb, M_DEVBUF); + xpt_free_ccb(ccb); if (device_get_unit(dev) == 0) { /* Start the work thread. XXX */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367949 - head/sys/dev/smartpqi
Author: trasz Date: Mon Nov 23 12:54:19 2020 New Revision: 367949 URL: https://svnweb.freebsd.org/changeset/base/367949 Log: smartpqi: don't bzero the new ccb; xpt_alloc_ccb_nowait() already does that. Reviewed by: imp MFC after:2 weeks Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision:https://reviews.freebsd.org/D26838 Modified: head/sys/dev/smartpqi/smartpqi_cam.c Modified: head/sys/dev/smartpqi/smartpqi_cam.c == --- head/sys/dev/smartpqi/smartpqi_cam.cMon Nov 23 12:50:38 2020 (r367948) +++ head/sys/dev/smartpqi/smartpqi_cam.cMon Nov 23 12:54:19 2020 (r367949) @@ -623,7 +623,6 @@ static void smartpqi_lun_rescan(struct pqisrc_softstat return; } - bzero(ccb, sizeof(union ccb)); xpt_setup_ccb(>ccb_h, path, 5); ccb->ccb_h.func_code = XPT_SCAN_LUN; ccb->ccb_h.cbfcnp = smartpqi_lunrescan_cb; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367948 - head/sys/dev/arcmsr
Author: trasz Date: Mon Nov 23 12:50:38 2020 New Revision: 367948 URL: https://svnweb.freebsd.org/changeset/base/367948 Log: arcmsr(4): don't bzero newly allocated ccb; xpt_alloc_ccb() already does that. Reviewed by: delphij, imp, ching2...@areca.com.tw Tested by:ching2...@areca.com.tw MFC after:2 weeks Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision:https://reviews.freebsd.org/D26840 Modified: head/sys/dev/arcmsr/arcmsr.c Modified: head/sys/dev/arcmsr/arcmsr.c == --- head/sys/dev/arcmsr/arcmsr.cMon Nov 23 12:47:23 2020 (r367947) +++ head/sys/dev/arcmsr/arcmsr.cMon Nov 23 12:50:38 2020 (r367948) @@ -1707,7 +1707,6 @@ static void arcmsr_rescan_lun(struct AdapterControlBlo return; } /* printf("arcmsr_rescan_lun: Rescan Target=%x, Lun=%x\n", target, lun); */ - bzero(ccb, sizeof(union ccb)); xpt_setup_ccb(>ccb_h, path, 5); ccb->ccb_h.func_code = XPT_SCAN_LUN; ccb->ccb_h.cbfcnp = arcmsr_rescanLun_cb; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367947 - head/sys/kern
Author: trasz Date: Mon Nov 23 12:47:23 2020 New Revision: 367947 URL: https://svnweb.freebsd.org/changeset/base/367947 Log: Remove the 'wantparent' variable, unused since r145004. Reviewed by: kib MFC after:2 weeks Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision:https://reviews.freebsd.org/D27193 Modified: head/sys/kern/vfs_lookup.c Modified: head/sys/kern/vfs_lookup.c == --- head/sys/kern/vfs_lookup.c Mon Nov 23 10:13:56 2020(r367946) +++ head/sys/kern/vfs_lookup.c Mon Nov 23 12:47:23 2020(r367947) @@ -1305,7 +1305,6 @@ int relookup(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp) { struct vnode *dp = NULL;/* the directory we are searching */ - int wantparent; /* 1 => wantparent or lockparent flag */ int rdonly; /* lookup read-only flag bit */ int error = 0; @@ -1314,8 +1313,8 @@ relookup(struct vnode *dvp, struct vnode **vpp, struct /* * Setup: break out flag bits into variables. */ - wantparent = cnp->cn_flags & (LOCKPARENT|WANTPARENT); - KASSERT(wantparent, ("relookup: parent not wanted.")); + KASSERT((cnp->cn_flags & (LOCKPARENT | WANTPARENT)) != 0, + ("relookup: parent not wanted")); rdonly = cnp->cn_flags & RDONLY; cnp->cn_flags &= ~ISSYMLINK; dp = dvp; @@ -1406,13 +1405,8 @@ relookup(struct vnode *dvp, struct vnode **vpp, struct /* * Set the parent lock/ref state to the requested state. */ - if ((cnp->cn_flags & LOCKPARENT) == 0 && dvp != dp) { - if (wantparent) - VOP_UNLOCK(dvp); - else - vput(dvp); - } else if (!wantparent) - vrele(dvp); + if ((cnp->cn_flags & LOCKPARENT) == 0 && dvp != dp) + VOP_UNLOCK(dvp); /* * Check for symbolic link */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367517 - in head/sys: compat/linux fs/fuse
Author: trasz Date: Mon Nov 9 08:53:15 2020 New Revision: 367517 URL: https://svnweb.freebsd.org/changeset/base/367517 Log: Make it possible to mount a fuse filesystem, such as squashfuse, from a Linux binary. Should come handy for AppImages. Reviewed by: asomers MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D26959 Modified: head/sys/compat/linux/linux_file.c head/sys/fs/fuse/fuse_device.c head/sys/fs/fuse/fuse_ipc.h head/sys/fs/fuse/fuse_vfsops.c Modified: head/sys/compat/linux/linux_file.c == --- head/sys/compat/linux/linux_file.c Mon Nov 9 05:20:02 2020 (r367516) +++ head/sys/compat/linux/linux_file.c Mon Nov 9 08:53:15 2020 (r367517) @@ -1181,13 +1181,15 @@ linux_pwritev(struct thread *td, struct linux_pwritev_ int linux_mount(struct thread *td, struct linux_mount_args *args) { - char fstypename[MFSNAMELEN]; - char *mntonname, *mntfromname; + struct mntarg *ma = NULL; + char *fstypename, *mntonname, *mntfromname, *data; int error, fsflags; + fstypename = malloc(MNAMELEN, M_TEMP, M_WAITOK); mntonname = malloc(MNAMELEN, M_TEMP, M_WAITOK); mntfromname = malloc(MNAMELEN, M_TEMP, M_WAITOK); - error = copyinstr(args->filesystemtype, fstypename, MFSNAMELEN - 1, + data = NULL; + error = copyinstr(args->filesystemtype, fstypename, MNAMELEN - 1, NULL); if (error != 0) goto out; @@ -1208,6 +1210,31 @@ linux_mount(struct thread *td, struct linux_mount_args strcpy(fstypename, "linprocfs"); } else if (strcmp(fstypename, "vfat") == 0) { strcpy(fstypename, "msdosfs"); + } else if (strcmp(fstypename, "fuse") == 0) { + char *fuse_options, *fuse_option, *fuse_name; + + if (strcmp(mntfromname, "fuse") == 0) + strcpy(mntfromname, "/dev/fuse"); + + strcpy(fstypename, "fusefs"); + data = malloc(MNAMELEN, M_TEMP, M_WAITOK); + error = copyinstr(args->data, data, MNAMELEN - 1, NULL); + if (error != 0) + goto out; + + fuse_options = data; + while ((fuse_option = strsep(_options, ",")) != NULL) { + fuse_name = strsep(_option, "="); + if (fuse_name == NULL || fuse_option == NULL) + goto out; + ma = mount_arg(ma, fuse_name, fuse_option, -1); + } + + /* +* The FUSE server uses Linux errno values instead of FreeBSD +* ones; add a flag to tell fuse(4) to do errno translation. +*/ + ma = mount_arg(ma, "linux_errnos", "1", -1); } fsflags = 0; @@ -1225,14 +1252,15 @@ linux_mount(struct thread *td, struct linux_mount_args if (args->rwflag & LINUX_MS_REMOUNT) fsflags |= MNT_UPDATE; - error = kernel_vmount(fsflags, - "fstype", fstypename, - "fspath", mntonname, - "from", mntfromname, - NULL); + ma = mount_arg(ma, "fstype", fstypename, -1); + ma = mount_arg(ma, "fspath", mntonname, -1); + ma = mount_arg(ma, "from", mntfromname, -1); + error = kernel_mount(ma, fsflags); out: + free(fstypename, M_TEMP); free(mntonname, M_TEMP); free(mntfromname, M_TEMP); + free(data, M_TEMP); return (error); } Modified: head/sys/fs/fuse/fuse_device.c == --- head/sys/fs/fuse/fuse_device.c Mon Nov 9 05:20:02 2020 (r367516) +++ head/sys/fs/fuse/fuse_device.c Mon Nov 9 08:53:15 2020 (r367517) @@ -89,6 +89,9 @@ __FBSDID("$FreeBSD$"); #include "fuse_internal.h" #include "fuse_ipc.h" +#include +#include + SDT_PROVIDER_DECLARE(fusefs); /* * Fuse trace probe: @@ -450,6 +453,15 @@ fuse_device_write(struct cdev *dev, struct uio *uio, i } if ((err = uiomove(, sizeof(struct fuse_out_header), uio)) != 0) return (err); + + if (data->linux_errnos != 0 && ohead.error != 0) { + err = -ohead.error; + if (err < 0 || err >= nitems(linux_to_bsd_errtbl)) + return (EINVAL); + + /* '-', because it will get flipped again below */ + ohead.error = -linux_to_bsd_errtbl[err]; + } /* * We check header information (which is redundant) and compare it Modified: head/sys/fs/fuse/fuse_ipc.h == --- head/sys/fs/fuse/fuse_ipc.h Mon Nov 9 05:20:02 2020(r367516) +++ head/sys/fs/fuse/fuse_ipc.h Mon Nov 9 08:53:15 2020
svn commit: r367488 - in head/sys: kern sys
Author: trasz Date: Sun Nov 8 15:54:59 2020 New Revision: 367488 URL: https://svnweb.freebsd.org/changeset/base/367488 Log: Move syscall_thread_{enter,exit}() into the slow path. This is only needed for syscalls from unloadable modules. Reviewed by: kib MFC after:2 weeks Sponsored by: EPSRC Differential Revision:https://reviews.freebsd.org/D26988 Modified: head/sys/kern/kern_syscalls.c head/sys/kern/subr_syscall.c head/sys/sys/sysent.h Modified: head/sys/kern/kern_syscalls.c == --- head/sys/kern/kern_syscalls.c Sun Nov 8 14:08:00 2020 (r367487) +++ head/sys/kern/kern_syscalls.c Sun Nov 8 15:54:59 2020 (r367488) @@ -80,10 +80,13 @@ syscall_thread_drain(struct sysent *se) } int -_syscall_thread_enter(struct thread *td, struct sysent *se) +syscall_thread_enter(struct thread *td, struct sysent *se) { u_int32_t cnt, oldcnt; + KASSERT((se->sy_thrcnt & SY_THR_STATIC) == 0, + ("%s: not a static syscall", __func__)); + do { oldcnt = se->sy_thrcnt; if ((oldcnt & (SY_THR_DRAINING | SY_THR_ABSENT)) != 0) @@ -94,9 +97,12 @@ _syscall_thread_enter(struct thread *td, struct sysent } void -_syscall_thread_exit(struct thread *td, struct sysent *se) +syscall_thread_exit(struct thread *td, struct sysent *se) { u_int32_t cnt, oldcnt; + + KASSERT((se->sy_thrcnt & SY_THR_STATIC) == 0, + ("%s: not a static syscall", __func__)); do { oldcnt = se->sy_thrcnt; Modified: head/sys/kern/subr_syscall.c == --- head/sys/kern/subr_syscall.cSun Nov 8 14:08:00 2020 (r367487) +++ head/sys/kern/subr_syscall.cSun Nov 8 15:54:59 2020 (r367488) @@ -61,6 +61,7 @@ syscallenter(struct thread *td) struct syscall_args *sa; struct sysent *se; int error, traced; + bool sy_thr_static; VM_CNT_INC(v_syscall); p = td->td_proc; @@ -128,12 +129,6 @@ syscallenter(struct thread *td) } #endif - error = syscall_thread_enter(td, se); - if (error != 0) { - td->td_errno = error; - goto retval; - } - /* * Fetch fast sigblock value at the time of syscall entry to * handle sleepqueue primitives which might call cursig(). @@ -145,8 +140,19 @@ syscallenter(struct thread *td) KASSERT((td->td_pflags & TDP_NERRNO) == 0, ("%s: TDP_NERRNO set", __func__)); + sy_thr_static = (se->sy_thrcnt & SY_THR_STATIC) != 0; + if (__predict_false(SYSTRACE_ENABLED() || - AUDIT_SYSCALL_ENTER(sa->code, td))) { + AUDIT_SYSCALL_ENTER(sa->code, td) || + !sy_thr_static)) { + if (!sy_thr_static) { + error = syscall_thread_enter(td, se); + if (error != 0) { + td->td_errno = error; + goto retval; + } + } + #ifdef KDTRACE_HOOKS /* Give the syscall:::entry DTrace probe a chance to fire. */ if (__predict_false(se->sy_entry != 0)) @@ -176,6 +182,9 @@ syscallenter(struct thread *td) (*systrace_probe_func)(sa, SYSTRACE_RETURN, error ? -1 : td->td_retval[0]); #endif + + if (!sy_thr_static) + syscall_thread_exit(td, se); } else { error = (se->sy_call)(td, sa->args); /* Save the latest error return value. */ @@ -184,7 +193,6 @@ syscallenter(struct thread *td) else td->td_errno = error; } - syscall_thread_exit(td, se); retval: KTR_STOP4(KTR_SYSC, "syscall", syscallname(p, sa->code), Modified: head/sys/sys/sysent.h == --- head/sys/sys/sysent.h Sun Nov 8 14:08:00 2020(r367487) +++ head/sys/sys/sysent.h Sun Nov 8 15:54:59 2020(r367488) @@ -294,26 +294,8 @@ struct nosys_args; intlkmnosys(struct thread *, struct nosys_args *); intlkmressys(struct thread *, struct nosys_args *); -int_syscall_thread_enter(struct thread *td, struct sysent *se); -void _syscall_thread_exit(struct thread *td, struct sysent *se); - -static inline int -syscall_thread_enter(struct thread *td, struct sysent *se) -{ - - if (__predict_true((se->sy_thrcnt & SY_THR_STATIC) != 0)) - return (0); - return (_syscall_thread_enter(td, se)); -} - -static inline void -syscall_thread_exit(struct thread *td, struct sysent *se) -{ - - if (__predict_true((se->sy_thrcnt & SY_THR_STATIC) != 0)) - return; - _syscall_thread_exit(td, se); -}
svn commit: r367445 - head/sys/kern
Author: trasz Date: Sat Nov 7 13:09:51 2020 New Revision: 367445 URL: https://svnweb.freebsd.org/changeset/base/367445 Log: Move TDB_USERWR check under 'if (traced)'. If we hadn't been traced in the first place when syscallenter() started executing, we can ignore TDB_USERWR. TDB_USERWR can get set, sure, but if it does, it's because the debugger raced with the syscall, and it cannot depend on winning that race. Reviewed by: kib MFC after:2 weeks Sponsored by: EPSRC Differential Revision:https://reviews.freebsd.org/D26585 Modified: head/sys/kern/subr_syscall.c Modified: head/sys/kern/subr_syscall.c == --- head/sys/kern/subr_syscall.cSat Nov 7 05:10:46 2020 (r367444) +++ head/sys/kern/subr_syscall.cSat Nov 7 13:09:51 2020 (r367445) @@ -97,21 +97,22 @@ syscallenter(struct thread *td) if (p->p_ptevents & PTRACE_SCE) ptracestop((td), SIGTRAP, NULL); PROC_UNLOCK(p); - } - if (__predict_false((td->td_dbgflags & TDB_USERWR) != 0)) { - /* -* Reread syscall number and arguments if debugger -* modified registers or memory. -*/ - error = (p->p_sysent->sv_fetch_syscall_args)(td); - se = sa->callp; + + if ((td->td_dbgflags & TDB_USERWR) != 0) { + /* +* Reread syscall number and arguments if debugger +* modified registers or memory. +*/ + error = (p->p_sysent->sv_fetch_syscall_args)(td); + se = sa->callp; #ifdef KTRACE - if (KTRPOINT(td, KTR_SYSCALL)) - ktrsyscall(sa->code, se->sy_narg, sa->args); + if (KTRPOINT(td, KTR_SYSCALL)) + ktrsyscall(sa->code, se->sy_narg, sa->args); #endif - if (error != 0) { - td->td_errno = error; - goto retval; + if (error != 0) { + td->td_errno = error; + goto retval; + } } } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367430 - head/sys/powerpc/include
Author: trasz Date: Fri Nov 6 19:27:27 2020 New Revision: 367430 URL: https://svnweb.freebsd.org/changeset/base/367430 Log: Make powerpc use MAXARGS (defined as 8) instead of hardcoding '10'. This brings its 'struct syscall_args' in sync with other architectures. Reviewed by: bdragon, jhibbits MFC after:2 weeks Sponsored by: EPSRC Differential Revision:https://reviews.freebsd.org/D26605 Modified: head/sys/powerpc/include/proc.h Modified: head/sys/powerpc/include/proc.h == --- head/sys/powerpc/include/proc.h Fri Nov 6 19:19:51 2020 (r367429) +++ head/sys/powerpc/include/proc.h Fri Nov 6 19:27:27 2020 (r367430) @@ -59,10 +59,11 @@ struct mdproc { #defineKINFO_PROC_SIZE 816 #endif +#defineMAXARGS 8 struct syscall_args { u_int code; struct sysent *callp; - register_t args[10]; + register_t args[MAXARGS]; }; #ifdef _KERNEL ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367429 - in head/sys/mips: include mips
Author: trasz Date: Fri Nov 6 19:19:51 2020 New Revision: 367429 URL: https://svnweb.freebsd.org/changeset/base/367429 Log: Remove 'struct trapframe' pointer from mips64's 'struct syscall_args'. While here, use MAXARGS. This brings its 'struct syscall_args' in sync with most other architectures. Reviewed by: arichardson, brooks MFC after:2 weeks Sponsored by: EPSRC Differential Revision:https://reviews.freebsd.org/D26619 Modified: head/sys/mips/include/proc.h head/sys/mips/mips/trap.c Modified: head/sys/mips/include/proc.h == --- head/sys/mips/include/proc.hFri Nov 6 19:04:20 2020 (r367428) +++ head/sys/mips/include/proc.hFri Nov 6 19:19:51 2020 (r367429) @@ -81,11 +81,11 @@ struct mdproc { size_t md_tls_tcb_offset; /* TCB offset */ }; +#defineMAXARGS 8 struct syscall_args { u_int code; struct sysent *callp; - register_t args[8]; - struct trapframe *trapframe; + register_t args[MAXARGS]; }; #ifdef __mips_n64 Modified: head/sys/mips/mips/trap.c == --- head/sys/mips/mips/trap.c Fri Nov 6 19:04:20 2020(r367428) +++ head/sys/mips/mips/trap.c Fri Nov 6 19:19:51 2020(r367429) @@ -349,9 +349,9 @@ cpu_fetch_syscall_args(struct thread *td) bzero(sa->args, sizeof(sa->args)); /* compute next PC after syscall instruction */ - td->td_pcb->pcb_tpc = sa->trapframe->pc; /* Remember if restart */ - if (DELAYBRANCH(sa->trapframe->cause)) /* Check BD bit */ - locr0->pc = MipsEmulateBranch(locr0, sa->trapframe->pc, 0, 0); + td->td_pcb->pcb_tpc = locr0->pc; /* Remember if restart */ + if (DELAYBRANCH(locr0->cause)) /* Check BD bit */ + locr0->pc = MipsEmulateBranch(locr0, locr0->pc, 0, 0); else locr0->pc += sizeof(int); sa->code = locr0->v0; @@ -781,7 +781,6 @@ dofault: case T_SYSCALL + T_USER: { - td->td_sa.trapframe = trapframe; syscallenter(td); #if !defined(SMP) && (defined(DDB) || defined(DEBUG)) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367394 - in head/sys/arm: arm include
Author: trasz Date: Thu Nov 5 18:10:03 2020 New Revision: 367394 URL: https://svnweb.freebsd.org/changeset/base/367394 Log: Remove the 'nap' field from ARM's 'struct syscall_args', to bring it in sync with (most) other architectures. No functional changes. Reviewed by: manu Tested by:mmel MFC after:2 weeks Sponsored by: EPSRC Differential Revision:https://reviews.freebsd.org/D26604 Modified: head/sys/arm/arm/syscall.c head/sys/arm/include/proc.h Modified: head/sys/arm/arm/syscall.c == --- head/sys/arm/arm/syscall.c Thu Nov 5 17:10:14 2020(r367393) +++ head/sys/arm/arm/syscall.c Thu Nov 5 18:10:03 2020(r367394) @@ -102,17 +102,19 @@ cpu_fetch_syscall_args(struct thread *td) struct proc *p; register_t *ap; struct syscall_args *sa; + u_int nap; int error; + nap = 4; sa = >td_sa; sa->code = td->td_frame->tf_r7; ap = >td_frame->tf_r0; if (sa->code == SYS_syscall) { sa->code = *ap++; - sa->nap--; + nap--; } else if (sa->code == SYS___syscall) { sa->code = ap[_QUAD_LOWWORD]; - sa->nap -= 2; + nap -= 2; ap += 2; } p = td->td_proc; @@ -121,11 +123,10 @@ cpu_fetch_syscall_args(struct thread *td) else sa->callp = >p_sysent->sv_table[sa->code]; error = 0; - memcpy(sa->args, ap, sa->nap * sizeof(register_t)); - if (sa->callp->sy_narg > sa->nap) { + memcpy(sa->args, ap, nap * sizeof(register_t)); + if (sa->callp->sy_narg > nap) { error = copyin((void *)td->td_frame->tf_usr_sp, sa->args + - sa->nap, (sa->callp->sy_narg - sa->nap) * - sizeof(register_t)); + nap, (sa->callp->sy_narg - nap) * sizeof(register_t)); } if (error == 0) { td->td_retval[0] = 0; @@ -140,7 +141,6 @@ static void syscall(struct thread *td, struct trapframe *frame) { - td->td_sa.nap = 4; syscallenter(td); syscallret(td); } Modified: head/sys/arm/include/proc.h == --- head/sys/arm/include/proc.h Thu Nov 5 17:10:14 2020(r367393) +++ head/sys/arm/include/proc.h Thu Nov 5 18:10:03 2020(r367394) @@ -82,7 +82,6 @@ struct syscall_args { u_int code; struct sysent *callp; register_t args[MAXARGS]; - u_int nap; } __aligned(8); #endif /* !_MACHINE_PROC_H_ */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367348 - head/sys/compat/linux
Author: trasz Date: Wed Nov 4 21:39:04 2020 New Revision: 367348 URL: https://svnweb.freebsd.org/changeset/base/367348 Log: Unbreak buildworld after r367339. MFC after:2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/compat/linux/linux_errno.h Modified: head/sys/compat/linux/linux_errno.h == --- head/sys/compat/linux/linux_errno.h Wed Nov 4 21:23:25 2020 (r367347) +++ head/sys/compat/linux/linux_errno.h Wed Nov 4 21:39:04 2020 (r367348) @@ -180,8 +180,6 @@ #defineLINUX_ERFKILL 132 #defineLINUX_EHWPOISON 133 -#ifdef _KERNEL #defineLINUX_ELAST LINUX_EHWPOISON -#endif #endif /* _LINUX_ERRNO_H_ */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367339 - head/sys/compat/linux
Author: trasz Date: Wed Nov 4 19:54:18 2020 New Revision: 367339 URL: https://svnweb.freebsd.org/changeset/base/367339 Log: Add linux_to_bsd_errtbl[], mapping Linux errnos to their BSD counterparts. This will be used by fuse(4). Reviewed by: asomers MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D26974 Modified: head/sys/compat/linux/linux_errno.c head/sys/compat/linux/linux_errno.h head/sys/compat/linux/linux_errno.inc Modified: head/sys/compat/linux/linux_errno.c == --- head/sys/compat/linux/linux_errno.c Wed Nov 4 18:23:59 2020 (r367338) +++ head/sys/compat/linux/linux_errno.c Wed Nov 4 19:54:18 2020 (r367339) @@ -31,5 +31,11 @@ linux_check_errtbl(void) KASSERT(linux_errtbl[i] != 0, ("%s: linux_errtbl[%d] == 0", __func__, i)); } + + for (i = 1; i < nitems(linux_to_bsd_errtbl); i++) { + KASSERT(linux_to_bsd_errtbl[i] != 0, + ("%s: linux_to_bsd_errtbl[%d] == 0", __func__, i)); + } + } #endif Modified: head/sys/compat/linux/linux_errno.h == --- head/sys/compat/linux/linux_errno.h Wed Nov 4 18:23:59 2020 (r367338) +++ head/sys/compat/linux/linux_errno.h Wed Nov 4 19:54:18 2020 (r367339) @@ -180,4 +180,8 @@ #defineLINUX_ERFKILL 132 #defineLINUX_EHWPOISON 133 +#ifdef _KERNEL +#defineLINUX_ELAST LINUX_EHWPOISON +#endif + #endif /* _LINUX_ERRNO_H_ */ Modified: head/sys/compat/linux/linux_errno.inc == --- head/sys/compat/linux/linux_errno.inc Wed Nov 4 18:23:59 2020 (r367338) +++ head/sys/compat/linux/linux_errno.inc Wed Nov 4 19:54:18 2020 (r367339) @@ -160,3 +160,170 @@ static const int linux_errtbl[ELAST + 1] = { _Static_assert(ELAST == 97, "missing errno entries in linux_errtbl"); + +static const int linux_to_bsd_errtbl[LINUX_ELAST + 1] = { + /* [0, 9] */ + [0] = 0, + [LINUX_EPERM] = EPERM, + [LINUX_ENOENT] = ENOENT, + [LINUX_ESRCH] = ESRCH, + [LINUX_EINTR] = EINTR, + [LINUX_EIO] = EIO, + [LINUX_ENXIO] = ENXIO, + [LINUX_E2BIG] = E2BIG, + [LINUX_ENOEXEC] = ENOENT, + [LINUX_EBADF] = EBADF, + + /* [10, 19] */ + [LINUX_ECHILD] = ECHILD, + [LINUX_EAGAIN] = EAGAIN, + [LINUX_ENOMEM] = ENOMEM, + [LINUX_EACCES] = EACCES, + [LINUX_EFAULT] = EFAULT, + [LINUX_ENOTBLK] = ENOTBLK, + [LINUX_EBUSY] = EBUSY, + [LINUX_EEXIST] = EEXIST, + [LINUX_EXDEV] = EXDEV, + [LINUX_ENODEV] = ENODEV, + + /* [20, 29] */ + [LINUX_ENOTDIR] = ENOTDIR, + [LINUX_EISDIR] = EISDIR, + [LINUX_EINVAL] = EINVAL, + [LINUX_ENFILE] = ENFILE, + [LINUX_EMFILE] = EMFILE, + [LINUX_ENOTTY] = ENOTTY, + [LINUX_ETXTBSY] = ETXTBSY, + [LINUX_EFBIG] = EFBIG, + [LINUX_ENOSPC] = ENOSPC, + [LINUX_ESPIPE] = ESPIPE, + + /* [30, 39] */ + [LINUX_EROFS] = EROFS, + [LINUX_EMLINK] = EMLINK, + [LINUX_EPIPE] = EPIPE, + [LINUX_EDOM] = EDOM, + [LINUX_ERANGE] = ERANGE, + [LINUX_EDEADLK] = EDEADLK, + [LINUX_ENAMETOOLONG] = ENAMETOOLONG, + [LINUX_ENOLCK] = ENOLCK, + [LINUX_ENOSYS] = ENOSYS, + [LINUX_ENOTEMPTY] = ENOTEMPTY, + + /* [40, 49] */ + [LINUX_ELOOP] = ELOOP, + [41] = EINVAL, + [LINUX_ENOMSG] = ENOMSG, + [LINUX_EIDRM] = EIDRM, + [LINUX_ECHRNG] = EINVAL,/* XXX */ + [LINUX_EL2NSYNC] = EINVAL, /* XXX */ + [LINUX_EL3HLT] = EINVAL,/* XXX */ + [LINUX_EL3RST] = EINVAL,/* XXX */ + [LINUX_ELNRNG] = EINVAL,/* XXX */ + [LINUX_EUNATCH] = EINVAL, /* XXX */ + + /* [50, 59] */ + [LINUX_ENOCSI] = EINVAL,/* XXX */ + [LINUX_EL2HLT] = EINVAL,/* XXX */ + [LINUX_EBADE] = EINVAL, /* XXX */ + [LINUX_EBADR] = EINVAL, /* XXX */ + [LINUX_EXFULL] = EINVAL,/* XXX */ + [LINUX_ENOANO] = EINVAL,/* XXX */ + [LINUX_EBADRQC] = EINVAL, /* XXX */ + [LINUX_EBADSLT] = EINVAL, /* XXX */ + [58] = EINVAL, + [LINUX_EBFONT] = EINVAL,/* XXX */ + + /* [60, 69] */ + [LINUX_ENOSTR] = EINVAL,/* XXX */ + [LINUX_ENODATA] = ENOATTR, /* XXX */ + [LINUX_ENOTIME] = EINVAL, /* XXX */ + [LINUX_ENOSR] = EINVAL, /* XXX */ + [LINUX_ENONET] = EINVAL,/* XXX */ + [LINUX_ENOPKG] = EINVAL,/* XXX */ + [LINUX_EREMOTE] = EREMOTE, + [LINUX_ENOLINK] = ENOLINK, + [LINUX_EADV] = EINVAL, /* XXX */ +
svn commit: r367301 - in head: lib/libsysdecode sys/compat/linux sys/modules/linux_common
Author: trasz Date: Tue Nov 3 19:12:33 2020 New Revision: 367301 URL: https://svnweb.freebsd.org/changeset/base/367301 Log: Make linux_errtbl[] static. MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D27004 Modified: head/lib/libsysdecode/errno.c head/sys/compat/linux/linux_emul.h head/sys/compat/linux/linux_errno.inc head/sys/modules/linux_common/Makefile Modified: head/lib/libsysdecode/errno.c == --- head/lib/libsysdecode/errno.c Tue Nov 3 18:13:42 2020 (r367300) +++ head/lib/libsysdecode/errno.c Tue Nov 3 19:12:33 2020 (r367301) @@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$"); #if defined(__aarch64__) || defined(__amd64__) || defined(__i386__) #include -static #include #endif Modified: head/sys/compat/linux/linux_emul.h == --- head/sys/compat/linux/linux_emul.h Tue Nov 3 18:13:42 2020 (r367300) +++ head/sys/compat/linux/linux_emul.h Tue Nov 3 19:12:33 2020 (r367301) @@ -80,6 +80,4 @@ struct linux_pemuldata { struct linux_pemuldata *pem_find(struct proc *); -extern const int linux_errtbl[]; - #endif /* !_LINUX_EMUL_H_ */ Modified: head/sys/compat/linux/linux_errno.inc == --- head/sys/compat/linux/linux_errno.inc Tue Nov 3 18:13:42 2020 (r367300) +++ head/sys/compat/linux/linux_errno.inc Tue Nov 3 19:12:33 2020 (r367301) @@ -38,7 +38,7 @@ * XXX: The "XXX" comments below should be replaced with rationale * for the errno value chosen. */ -const int linux_errtbl[ELAST + 1] = { +static const int linux_errtbl[ELAST + 1] = { /* [0, 9] */ [0] = -0, [EPERM] = -LINUX_EPERM, Modified: head/sys/modules/linux_common/Makefile == --- head/sys/modules/linux_common/Makefile Tue Nov 3 18:13:42 2020 (r367300) +++ head/sys/modules/linux_common/Makefile Tue Nov 3 19:12:33 2020 (r367301) @@ -9,7 +9,6 @@ SRCS= linux_common.c linux_mib.c linux_mmap.c linux_ut EXPORT_SYMS= EXPORT_SYMS+= linux_emul_path -EXPORT_SYMS+= linux_errtbl EXPORT_SYMS+= linux_ioctl_register_handler EXPORT_SYMS+= linux_ioctl_unregister_handler EXPORT_SYMS+= linux_get_osname ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367298 - head/sys/compat/linux
Author: trasz Date: Tue Nov 3 14:44:33 2020 New Revision: 367298 URL: https://svnweb.freebsd.org/changeset/base/367298 Log: Fix rookie mistake - it's nitems(), not sizeof(). Reported by: xtouqh_icloud.com MFC after:2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/compat/linux/linux_errno.c Modified: head/sys/compat/linux/linux_errno.c == --- head/sys/compat/linux/linux_errno.c Tue Nov 3 14:41:49 2020 (r367297) +++ head/sys/compat/linux/linux_errno.c Tue Nov 3 14:44:33 2020 (r367298) @@ -27,7 +27,7 @@ linux_check_errtbl(void) { int i; - for (i = 1; i < sizeof(linux_errtbl); i++) { + for (i = 1; i < nitems(linux_errtbl); i++) { KASSERT(linux_errtbl[i] != 0, ("%s: linux_errtbl[%d] == 0", __func__, i)); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367139 - head/sys/compat/linprocfs
Author: trasz Date: Thu Oct 29 15:44:44 2020 New Revision: 367139 URL: https://svnweb.freebsd.org/changeset/base/367139 Log: Make linprocfs(4) print a warning when there's not enough room to fill /proc/self/maps. Submitted by: dchagin (earlier version) Reviewed by: emaste (earlier version) MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D20576 Modified: head/sys/compat/linprocfs/linprocfs.c Modified: head/sys/compat/linprocfs/linprocfs.c == --- head/sys/compat/linprocfs/linprocfs.c Thu Oct 29 15:36:20 2020 (r367138) +++ head/sys/compat/linprocfs/linprocfs.c Thu Oct 29 15:44:44 2020 (r367139) @@ -1252,6 +1252,10 @@ linprocfs_doprocmaps(PFS_FILL_ARGS) *name ? " " : " ", name ); + if (error == -1) { + linux_msg(td, "cannot fill /proc/self/maps; " + "consider bumping PFS_MAXBUFSIZ"); + } if (freename) free(freename, M_TEMP); vm_map_lock_read(map); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367138 - head/sys/riscv/riscv
Author: trasz Date: Thu Oct 29 15:36:20 2020 New Revision: 367138 URL: https://svnweb.freebsd.org/changeset/base/367138 Log: Optimize set_syscall_retval for riscv by predicting the return value to be zero. Reviewed by: mhorne, kp MFC after:2 weeks Sponsored by: EPSRC Differential Revision:https://reviews.freebsd.org/D26990 Modified: head/sys/riscv/riscv/vm_machdep.c Modified: head/sys/riscv/riscv/vm_machdep.c == --- head/sys/riscv/riscv/vm_machdep.c Thu Oct 29 15:28:15 2020 (r367137) +++ head/sys/riscv/riscv/vm_machdep.c Thu Oct 29 15:36:20 2020 (r367138) @@ -132,12 +132,14 @@ cpu_set_syscall_retval(struct thread *td, int error) frame = td->td_frame; - switch (error) { - case 0: + if (__predict_true(error == 0)) { frame->tf_a[0] = td->td_retval[0]; frame->tf_a[1] = td->td_retval[1]; frame->tf_t[0] = 0; /* syscall succeeded */ - break; + return; + } + + switch (error) { case ERESTART: frame->tf_sepc -= 4;/* prev instruction */ break; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367137 - head/sys/fs/nullfs
Author: trasz Date: Thu Oct 29 15:28:15 2020 New Revision: 367137 URL: https://svnweb.freebsd.org/changeset/base/367137 Log: Make it possible to mount nullfs(5) using plain mount(8) instead of mount_nullfs(8). Obviously you'd need to force mount(8) to not call mount_nullfs(8) to make use of it. Reviewed by: kib MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D26934 Modified: head/sys/fs/nullfs/null_vfsops.c Modified: head/sys/fs/nullfs/null_vfsops.c == --- head/sys/fs/nullfs/null_vfsops.cThu Oct 29 14:44:09 2020 (r367136) +++ head/sys/fs/nullfs/null_vfsops.cThu Oct 29 15:28:15 2020 (r367137) @@ -104,7 +104,9 @@ nullfs_mount(struct mount *mp) /* * Get argument */ - error = vfs_getopt(mp->mnt_optnew, "target", (void **), ); + error = vfs_getopt(mp->mnt_optnew, "from", (void **), ); + if (error != 0) + error = vfs_getopt(mp->mnt_optnew, "target", (void **), ); if (error || target[len - 1] != '\0') return (EINVAL); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367135 - head/sys/compat/linux
Author: trasz Date: Thu Oct 29 14:42:51 2020 New Revision: 367135 URL: https://svnweb.freebsd.org/changeset/base/367135 Log: Fix typo. MFC after:2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/compat/linux/linux_errno.h Modified: head/sys/compat/linux/linux_errno.h == --- head/sys/compat/linux/linux_errno.h Thu Oct 29 14:42:02 2020 (r367134) +++ head/sys/compat/linux/linux_errno.h Thu Oct 29 14:42:51 2020 (r367135) @@ -88,7 +88,7 @@ #defineLINUX_EUNATCH 49 #defineLINUX_ENOCSI50 -#defineLINUX_L2HLT 51 +#defineLINUX_EL2HLT51 #defineLINUX_EBADE 52 #defineLINUX_EBADR 53 #defineLINUX_EXFULL54 ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367132 - in head: lib/libsysdecode sys/compat/linux
Author: trasz Date: Thu Oct 29 14:23:52 2020 New Revision: 367132 URL: https://svnweb.freebsd.org/changeset/base/367132 Log: Add defines for Linux errno values and use them to make linux_errtbl[] more readable. While here, add linux_check_errtbl() function to make sure we don't leave holes. No objections:emaste (earlier version) MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D26972 Added: head/sys/compat/linux/linux_errno.h (contents, props changed) Modified: head/lib/libsysdecode/errno.c head/sys/compat/linux/linux.h head/sys/compat/linux/linux_common.c head/sys/compat/linux/linux_errno.c head/sys/compat/linux/linux_errno.inc Modified: head/lib/libsysdecode/errno.c == --- head/lib/libsysdecode/errno.c Thu Oct 29 14:21:25 2020 (r367131) +++ head/lib/libsysdecode/errno.c Thu Oct 29 14:23:52 2020 (r367132) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #if defined(__aarch64__) || defined(__amd64__) || defined(__i386__) +#include static #include #endif Modified: head/sys/compat/linux/linux.h == --- head/sys/compat/linux/linux.h Thu Oct 29 14:21:25 2020 (r367131) +++ head/sys/compat/linux/linux.h Thu Oct 29 14:23:52 2020 (r367132) @@ -197,5 +197,6 @@ int linux_to_bsd_bits_(int value, struct bsd_to_linux_ #defineBITMAP_1t1_LINUX(_name) BITMAP_EASY_LINUX(_name, LINUX_##_name) int bsd_to_linux_errno(int error); +void linux_check_errtbl(void); #endif /* _LINUX_MI_H_ */ Modified: head/sys/compat/linux/linux_common.c == --- head/sys/compat/linux/linux_common.cThu Oct 29 14:21:25 2020 (r367131) +++ head/sys/compat/linux/linux_common.cThu Oct 29 14:23:52 2020 (r367132) @@ -67,6 +67,9 @@ linux_common_modevent(module_t mod, int type, void *da switch(type) { case MOD_LOAD: +#ifdef INVARIANTS + linux_check_errtbl(); +#endif linux_dev_shm_create(); linux_osd_jail_register(); linux_exit_tag = EVENTHANDLER_REGISTER(process_exit, Modified: head/sys/compat/linux/linux_errno.c == --- head/sys/compat/linux/linux_errno.c Thu Oct 29 14:21:25 2020 (r367131) +++ head/sys/compat/linux/linux_errno.c Thu Oct 29 14:23:52 2020 (r367132) @@ -8,6 +8,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include int @@ -19,3 +20,16 @@ bsd_to_linux_errno(int error) return (linux_errtbl[error]); } + +#ifdef INVARIANTS +void +linux_check_errtbl(void) +{ + int i; + + for (i = 1; i < sizeof(linux_errtbl); i++) { + KASSERT(linux_errtbl[i] != 0, + ("%s: linux_errtbl[%d] == 0", __func__, i)); + } +} +#endif Added: head/sys/compat/linux/linux_errno.h == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/compat/linux/linux_errno.h Thu Oct 29 14:23:52 2020 (r367132) @@ -0,0 +1,183 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2020 The FreeBSD Foundation + * + * This software was developed by Edward Tomasz Napierala under sponsorship + * from the FreeBSD Foundation. + * + * 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, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ +
svn commit: r367107 - head/sys/kern
Author: trasz Date: Wed Oct 28 14:43:38 2020 New Revision: 367107 URL: https://svnweb.freebsd.org/changeset/base/367107 Log: Add local variable to store the sysent pointer. Just a cleanup, no functional changes. Reviewed by: kib (earlier version) MFC after:2 weeks Sponsored by: EPSRC Differential Revision:https://reviews.freebsd.org/D26977 Modified: head/sys/kern/subr_syscall.c Modified: head/sys/kern/subr_syscall.c == --- head/sys/kern/subr_syscall.cWed Oct 28 14:16:08 2020 (r367106) +++ head/sys/kern/subr_syscall.cWed Oct 28 14:43:38 2020 (r367107) @@ -59,6 +59,7 @@ syscallenter(struct thread *td) { struct proc *p; struct syscall_args *sa; + struct sysent *se; int error, traced; VM_CNT_INC(v_syscall); @@ -77,9 +78,10 @@ syscallenter(struct thread *td) PROC_UNLOCK(p); } error = (p->p_sysent->sv_fetch_syscall_args)(td); + se = sa->callp; #ifdef KTRACE if (KTRPOINT(td, KTR_SYSCALL)) - ktrsyscall(sa->code, sa->callp->sy_narg, sa->args); + ktrsyscall(sa->code, se->sy_narg, sa->args); #endif KTR_START4(KTR_SYSC, "syscall", syscallname(p, sa->code), (uintptr_t)td, "pid:%d", td->td_proc->p_pid, "arg0:%p", sa->args[0], @@ -102,9 +104,10 @@ syscallenter(struct thread *td) * modified registers or memory. */ error = (p->p_sysent->sv_fetch_syscall_args)(td); + se = sa->callp; #ifdef KTRACE if (KTRPOINT(td, KTR_SYSCALL)) - ktrsyscall(sa->code, sa->callp->sy_narg, sa->args); + ktrsyscall(sa->code, se->sy_narg, sa->args); #endif if (error != 0) { td->td_errno = error; @@ -118,13 +121,13 @@ syscallenter(struct thread *td) * flagged with SYF_CAPENABLED. */ if (__predict_false(IN_CAPABILITY_MODE(td) && - !(sa->callp->sy_flags & SYF_CAPENABLED))) { + (se->sy_flags & SYF_CAPENABLED) == 0)) { td->td_errno = error = ECAPMODE; goto retval; } #endif - error = syscall_thread_enter(td, sa->callp); + error = syscall_thread_enter(td, se); if (error != 0) { td->td_errno = error; goto retval; @@ -145,10 +148,10 @@ syscallenter(struct thread *td) AUDIT_SYSCALL_ENTER(sa->code, td))) { #ifdef KDTRACE_HOOKS /* Give the syscall:::entry DTrace probe a chance to fire. */ - if (__predict_false(sa->callp->sy_entry != 0)) + if (__predict_false(se->sy_entry != 0)) (*systrace_probe_func)(sa, SYSTRACE_ENTRY, 0); #endif - error = (sa->callp->sy_call)(td, sa->args); + error = (se->sy_call)(td, sa->args); /* Save the latest error return value. */ if (__predict_false((td->td_pflags & TDP_NERRNO) != 0)) td->td_pflags &= ~TDP_NERRNO; @@ -168,19 +171,19 @@ syscallenter(struct thread *td) #ifdef KDTRACE_HOOKS /* Give the syscall:::return DTrace probe a chance to fire. */ - if (__predict_false(sa->callp->sy_return != 0)) + if (__predict_false(se->sy_return != 0)) (*systrace_probe_func)(sa, SYSTRACE_RETURN, error ? -1 : td->td_retval[0]); #endif } else { - error = (sa->callp->sy_call)(td, sa->args); + error = (se->sy_call)(td, sa->args); /* Save the latest error return value. */ if (__predict_false((td->td_pflags & TDP_NERRNO) != 0)) td->td_pflags &= ~TDP_NERRNO; else td->td_errno = error; } - syscall_thread_exit(td, sa->callp); + syscall_thread_exit(td, se); retval: KTR_STOP4(KTR_SYSC, "syscall", syscallname(p, sa->code), ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367106 - head/sys/compat/linux
Author: trasz Date: Wed Oct 28 14:16:08 2020 New Revision: 367106 URL: https://svnweb.freebsd.org/changeset/base/367106 Log: Make linux_errtbl a bit more readable by using named initializers. MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D26970 Modified: head/sys/compat/linux/linux_errno.inc Modified: head/sys/compat/linux/linux_errno.inc == --- head/sys/compat/linux/linux_errno.inc Wed Oct 28 13:46:11 2020 (r367105) +++ head/sys/compat/linux/linux_errno.inc Wed Oct 28 14:16:08 2020 (r367106) @@ -36,113 +36,123 @@ *include/uapi/asm-generic/errno.h */ const int linux_errtbl[ELAST + 1] = { - -0, - -1, - -2, - -3, - -4, - -5, - -6, - -7, - -8, - -9, + /* [0, 9] */ + [0] = -0, + [EPERM] = -1, + [ENOENT] = -2, + [ESRCH] = -3, + [EINTR] = -4, + [EIO] = -5, + [ENXIO] = -6, + [E2BIG] = -7, + [ENOEXEC] = -8, + [EBADF] = -9, - -10, - -35,/* EDEADLK */ - -12, - -13, - -14, - -15, - -16, - -17, - -18, - -19, + /* [10, 19] */ + [ECHILD] = -10, + [EDEADLK] = -35, + [ENOMEM] = -12, + [EACCES] = -13, + [EFAULT] = -14, + [ENOTBLK] = -15, + [EBUSY] = -16, + [EEXIST] = -17, + [EXDEV] = -18, + [ENODEV] = -19, - -20, - -21, - -22, - -23, - -24, - -25, - -26, - -27, - -28, - -29, + /* [20, 29] */ + [ENOTDIR] = -20, + [EISDIR] = -21, + [EINVAL] = -22, + [ENFILE] = -23, + [EMFILE] = -24, + [ENOTTY] = -25, + [ETXTBSY] = -26, + [EFBIG] = -27, + [ENOSPC] = -28, + [ESPIPE] = -29, - -30, - -31, - -32, - -33, - -34, - -11,/* EAGAIN */ - -115, - -114, - -88, - -89, + /* [30, 39] */ + [EROFS] = -30, + [EMLINK] = -31, + [EPIPE] = -32, + [EDOM] = -33, + [ERANGE] = -34, + [EAGAIN] = -11, + [EINPROGRESS] = -115, + [EALREADY] = -114, + [ENOTSOCK] = -88, + [EDESTADDRREQ] = -89, - -90, - -91, - -92, - -93, - -94, - -95, - -96, - -97, - -98, - -99, + /* [40, 49] */ + [EMSGSIZE] = -90, + [EPROTOTYPE] = -91, + [ENOPROTOOPT] = -92, + [EPROTONOSUPPORT] = -93, + [ESOCKTNOSUPPORT] = -94, + [EOPNOTSUPP] = -95, + [EPFNOSUPPORT] = -96, + [EAFNOSUPPORT] = -97, + [EADDRINUSE] = -98, + [EADDRNOTAVAIL] = -99, - -100, - -101, - -102, - -103, - -104, - -105, - -106, - -107, - -108, - -109, + /* [50, 59] */ + [ENETDOWN] = -100, + [ENETUNREACH] = -101, + [ENETRESET] = -102, + [ECONNABORTED] = -103, + [ECONNRESET] = -104, + [ENOBUFS] = -105, + [EISCONN] = -106, + [ENOTCONN] = -107, + [ESHUTDOWN] = -108, + [ETOOMANYREFS] = -109, - -110, - -111, - -40, - -36, - -112, - -113, - -39, - -11, - -87, - -122, + /* [60, 69] */ + [ETIMEDOUT] = -110, + [ECONNREFUSED] = -111, + [ELOOP] = -40, + [ENAMETOOLONG] = -36, + [EHOSTDOWN] = -112, + [EHOSTUNREACH] = -113, + [ENOTEMPTY] = -39, + [EPROCLIM] = -11, + [EUSERS] = -87, + [EDQUOT] = -122, - -116, - -66, - -6, /* EBADRPC -> ENXIO */ - -6, /* ERPCMISMATCH -> ENXIO */ - -6, /* EPROGUNAVAIL -> ENXIO */ - -6, /* EPROGMISMATCH -> ENXIO */ - -6, /* EPROCUNAVAIL -> ENXIO */ - -37, - -38, - -9, + /* [70, 79] */ + [ESTALE] = -116, + [EREMOTE] = -66, + [EBADRPC] = -6, /* EBADRPC -> ENXIO */ + [ERPCMISMATCH] = -6,/* ERPCMISMATCH -> ENXIO */ + [EPROGUNAVAIL] = -6,/* EPROGUNAVAIL -> ENXIO */ + [EPROGMISMATCH] = -6, /* EPROGMISMATCH -> ENXIO */ + [EPROCUNAVAIL] = -6,/* EPROCUNAVAIL -> ENXIO */ + [ENOLCK] = -37, + [ENOSYS] = -38, + [EFTYPE] = -9, - -6, /* EAUTH -> ENXIO */ - -6, /* ENEEDAUTH -> ENXIO */ - -43, - -42, - -75, - -125, - -84, - -61, - -22,/* EDOOFUS -> EINVAL */ - -74, + /* [80, 89] */ + [EAUTH] = -6, /* EAUTH -> ENXIO */ + [ENEEDAUTH] = -6, /* ENEEDAUTH -> ENXIO */ + [EIDRM] = -43, + [ENOMSG] = -42, + [EOVERFLOW] = -75, + [ECANCELED] = -125, + [EILSEQ] = -84, + [ENOATTR] = -61, + [EDOOFUS] = -22,/* EDOOFUS -> EINVAL
svn commit: r367105 - in head: lib/geom/mountver lib/libc/posix1e lib/libc/sys sbin/mdconfig/tests share/man/man4 share/man/man5 share/man/man7 sys/amd64/linux sys/cam/ctl sys/cddl/compat/opensolar...
Author: trasz Date: Wed Oct 28 13:46:11 2020 New Revision: 367105 URL: https://svnweb.freebsd.org/changeset/base/367105 Log: Drop "All rights reserved" from all my stuff. This includes Foundation copyrights, approved by emaste@. It does not include files which carry other people's copyrights; if you're one of those people, feel free to make similar change. Reviewed by: emaste, imp, gbe (manpages) Differential Revision:https://reviews.freebsd.org/D26980 Modified: head/lib/geom/mountver/geom_mountver.c head/lib/geom/mountver/gmountver.8 head/lib/libc/posix1e/acl_add_flag_np.3 head/lib/libc/posix1e/acl_branding.c head/lib/libc/posix1e/acl_clear_flags_np.3 head/lib/libc/posix1e/acl_compat.c head/lib/libc/posix1e/acl_delete_flag_np.3 head/lib/libc/posix1e/acl_flag.c head/lib/libc/posix1e/acl_from_text_nfs4.c head/lib/libc/posix1e/acl_get_brand_np.3 head/lib/libc/posix1e/acl_get_entry_type_np.3 head/lib/libc/posix1e/acl_get_flag_np.3 head/lib/libc/posix1e/acl_get_flagset_np.3 head/lib/libc/posix1e/acl_is_trivial_np.3 head/lib/libc/posix1e/acl_set_entry_type_np.3 head/lib/libc/posix1e/acl_set_flagset_np.3 head/lib/libc/posix1e/acl_strip_np.3 head/lib/libc/posix1e/acl_support_nfs4.c head/lib/libc/posix1e/acl_to_text_nfs4.c head/lib/libc/sys/getloginclass.2 head/sbin/mdconfig/tests/mdconfig_test.sh head/share/man/man4/cfumass.4 head/share/man/man4/iscsi.4 head/share/man/man4/rctl.4 head/share/man/man5/autofs.5 head/share/man/man7/development.7 head/sys/amd64/linux/linux_ptrace.c head/sys/cam/ctl/ctl_frontend_iscsi.c head/sys/cam/ctl/ctl_frontend_iscsi.h head/sys/cddl/compat/opensolaris/kern/opensolaris_acl.c head/sys/contrib/openzfs/module/os/freebsd/spl/spl_acl.c head/sys/dev/iscsi/icl.c head/sys/dev/iscsi/icl.h head/sys/dev/iscsi/icl_conn_if.m head/sys/dev/iscsi/icl_soft.c head/sys/dev/iscsi/icl_soft_proxy.c head/sys/dev/iscsi/icl_wrappers.h head/sys/dev/iscsi/iscsi.c head/sys/dev/iscsi/iscsi.h head/sys/dev/iscsi/iscsi_ioctl.h head/sys/dev/iscsi/iscsi_proto.h head/sys/dev/usb/storage/cfumass.c head/sys/fs/autofs/autofs.c head/sys/fs/autofs/autofs.h head/sys/fs/autofs/autofs_ioctl.h head/sys/fs/autofs/autofs_vfsops.c head/sys/fs/autofs/autofs_vnops.c head/sys/kern/kern_loginclass.c head/sys/kern/kern_racct.c head/sys/kern/kern_rctl.c head/sys/kern/subr_acl_nfs4.c head/sys/sys/loginclass.h head/sys/sys/racct.h head/sys/sys/rctl.h head/sys/ufs/ffs/ffs_suspend.c head/tests/sys/acl/00.sh head/tests/sys/acl/01.sh head/tests/sys/acl/02.sh head/tests/sys/acl/03.sh head/tests/sys/acl/04.sh head/tests/sys/acl/aclfuzzer.sh head/tests/sys/acl/mktrivial.sh head/tests/sys/acl/tools-crossfs.test head/tests/sys/acl/tools-nfs4-psarc.test head/tests/sys/acl/tools-nfs4-trivial.test head/tests/sys/acl/tools-nfs4.test head/tests/sys/acl/tools-posix.test head/tools/regression/iscsi/iscsi-test.sh head/tools/tools/fetchbench/fetchbench head/usr.bin/iscsictl/iscsictl.8 head/usr.bin/iscsictl/iscsictl.c head/usr.bin/iscsictl/iscsictl.h head/usr.bin/iscsictl/parse.y head/usr.bin/iscsictl/token.l head/usr.bin/rctl/rctl.8 head/usr.bin/rctl/rctl.c head/usr.sbin/autofs/auto_master.5 head/usr.sbin/autofs/automount.8 head/usr.sbin/autofs/automount.c head/usr.sbin/autofs/automountd.8 head/usr.sbin/autofs/automountd.c head/usr.sbin/autofs/autounmountd.8 head/usr.sbin/autofs/autounmountd.c head/usr.sbin/autofs/common.c head/usr.sbin/autofs/common.h head/usr.sbin/autofs/defined.c head/usr.sbin/autofs/log.c head/usr.sbin/autofs/token.l head/usr.sbin/ctld/chap.c head/usr.sbin/ctld/ctld.8 head/usr.sbin/ctld/ctld.c head/usr.sbin/ctld/ctld.h head/usr.sbin/ctld/discovery.c head/usr.sbin/ctld/keys.c head/usr.sbin/ctld/log.c head/usr.sbin/ctld/login.c head/usr.sbin/ctld/parse.y head/usr.sbin/ctld/pdu.c head/usr.sbin/ctld/token.l head/usr.sbin/fstyp/fstyp.8 head/usr.sbin/fstyp/fstyp.c head/usr.sbin/fstyp/fstyp.h head/usr.sbin/iscsid/chap.c head/usr.sbin/iscsid/discovery.c head/usr.sbin/iscsid/iscsid.8 head/usr.sbin/iscsid/iscsid.c head/usr.sbin/iscsid/iscsid.h head/usr.sbin/iscsid/keys.c head/usr.sbin/iscsid/log.c head/usr.sbin/iscsid/login.c head/usr.sbin/iscsid/pdu.c head/usr.sbin/uefisign/child.c head/usr.sbin/uefisign/magic.h head/usr.sbin/uefisign/pe.c head/usr.sbin/uefisign/uefisign.8 head/usr.sbin/uefisign/uefisign.c head/usr.sbin/uefisign/uefisign.h Modified: head/lib/geom/mountver/geom_mountver.c == --- head/lib/geom/mountver/geom_mountver.c Wed Oct 28 13:30:24 2020 (r367104) +++ head/lib/geom/mountver/geom_mountver.c Wed Oct 28 13:46:11 2020 (r367105) @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2010 Edward Tomasz Napierala - * All right
svn commit: r367079 - in head/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux
Author: trasz Date: Tue Oct 27 12:49:40 2020 New Revision: 367079 URL: https://svnweb.freebsd.org/changeset/base/367079 Log: Fix misnomer - linux_to_bsd_errno() does the exact opposite. Reported by: arichardson MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D26965 Modified: head/sys/amd64/linux/linux_sysvec.c head/sys/amd64/linux32/linux32_sysvec.c head/sys/arm64/linux/linux_sysvec.c head/sys/compat/linux/linux.h head/sys/compat/linux/linux_errno.c head/sys/compat/linux/linux_socket.c head/sys/i386/linux/linux_sysvec.c Modified: head/sys/amd64/linux/linux_sysvec.c == --- head/sys/amd64/linux/linux_sysvec.c Tue Oct 27 12:44:49 2020 (r367078) +++ head/sys/amd64/linux/linux_sysvec.c Tue Oct 27 12:49:40 2020 (r367079) @@ -231,7 +231,7 @@ linux_set_syscall_retval(struct thread *td, int error) break; default: - frame->tf_rax = linux_to_bsd_errno(error); + frame->tf_rax = bsd_to_linux_errno(error); frame->tf_r10 = frame->tf_rcx; break; } Modified: head/sys/amd64/linux32/linux32_sysvec.c == --- head/sys/amd64/linux32/linux32_sysvec.c Tue Oct 27 12:44:49 2020 (r367078) +++ head/sys/amd64/linux32/linux32_sysvec.c Tue Oct 27 12:49:40 2020 (r367079) @@ -678,7 +678,7 @@ linux32_set_syscall_retval(struct thread *td, int erro if (__predict_false(error != 0)) { if (error != ERESTART && error != EJUSTRETURN) - frame->tf_rax = linux_to_bsd_errno(error); + frame->tf_rax = bsd_to_linux_errno(error); } } Modified: head/sys/arm64/linux/linux_sysvec.c == --- head/sys/arm64/linux/linux_sysvec.c Tue Oct 27 12:44:49 2020 (r367078) +++ head/sys/arm64/linux/linux_sysvec.c Tue Oct 27 12:49:40 2020 (r367079) @@ -142,10 +142,8 @@ linux_set_syscall_retval(struct thread *td, int error) cpu_set_syscall_retval(td, error); if (__predict_false(error != 0)) { - if (error != ERESTART && error != EJUSTRETURN) { - td->td_frame->tf_x[0] = - linux_to_bsd_errno(error); - } + if (error != ERESTART && error != EJUSTRETURN) + td->td_frame->tf_x[0] = bsd_to_linux_errno(error); } } Modified: head/sys/compat/linux/linux.h == --- head/sys/compat/linux/linux.h Tue Oct 27 12:44:49 2020 (r367078) +++ head/sys/compat/linux/linux.h Tue Oct 27 12:49:40 2020 (r367079) @@ -196,6 +196,6 @@ int linux_to_bsd_bits_(int value, struct bsd_to_linux_ } #defineBITMAP_1t1_LINUX(_name) BITMAP_EASY_LINUX(_name, LINUX_##_name) -int linux_to_bsd_errno(int error); +int bsd_to_linux_errno(int error); #endif /* _LINUX_MI_H_ */ Modified: head/sys/compat/linux/linux_errno.c == --- head/sys/compat/linux/linux_errno.c Tue Oct 27 12:44:49 2020 (r367078) +++ head/sys/compat/linux/linux_errno.c Tue Oct 27 12:49:40 2020 (r367079) @@ -11,7 +11,7 @@ __FBSDID("$FreeBSD$"); #include int -linux_to_bsd_errno(int error) +bsd_to_linux_errno(int error) { KASSERT(error >= 0 && error <= ELAST, Modified: head/sys/compat/linux/linux_socket.c == --- head/sys/compat/linux/linux_socket.cTue Oct 27 12:44:49 2020 (r367078) +++ head/sys/compat/linux/linux_socket.cTue Oct 27 12:49:40 2020 (r367079) @@ -1559,7 +1559,7 @@ linux_getsockopt(struct thread *td, struct linux_getso name, , UIO_SYSSPACE, ); if (error != 0) return (error); - newval = -linux_to_bsd_errno(newval); + newval = -bsd_to_linux_errno(newval); return (copyout(, PTRIN(args->optval), len)); /* NOTREACHED */ default: Modified: head/sys/i386/linux/linux_sysvec.c == --- head/sys/i386/linux/linux_sysvec.c Tue Oct 27 12:44:49 2020 (r367078) +++ head/sys/i386/linux/linux_sysvec.c Tue Oct 27 12:49:40 2020 (r367079) @@ -800,7 +800,7 @@ linux_set_syscall_retval(struct thread *td, int error) if (__predict_false(error != 0)) { if (error != ERESTART && error != EJUSTRETURN) - frame->tf_eax =
Re: svn commit: r367038 - head/sbin/mount_nullfs
On 1025T0717, Cy Schubert wrote: > In message om> > , Oliver Pinter writes: > > On Sunday, October 25, 2020, Edward Tomasz Napierala > > wrote: > > > > > Author: trasz > > > Date: Sun Oct 25 14:09:00 2020 > > > New Revision: 367038 > > > URL: https://svnweb.freebsd.org/changeset/base/367038 > > > > > > Log: > > > Remove the check that prevents creating "loops" from mount_nullfs(8). > > > > > > > > The simple question is: why? > > I was about to ask that myself. > > The why is usually more important than the how. Two reasons. First, from what I can tell this is an artificial limitation which serves no purpose. I thought it was to prevent some kind of deadlock between vnodes, so I asked kib@, and he mentioned removing that very limitation from the kernel code; thus, it looks to me like a historical leftover. Second, I've stumbled upon this when trying to nullfs-mount '/' on '/compat/ubuntu/bsd/', which would be useful for autochroot functionality, when (or if) it becomes a thing. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367038 - head/sbin/mount_nullfs
Author: trasz Date: Sun Oct 25 14:09:00 2020 New Revision: 367038 URL: https://svnweb.freebsd.org/changeset/base/367038 Log: Remove the check that prevents creating "loops" from mount_nullfs(8). Reviewed by: kib MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D26921 Modified: head/sbin/mount_nullfs/mount_nullfs.c Modified: head/sbin/mount_nullfs/mount_nullfs.c == --- head/sbin/mount_nullfs/mount_nullfs.c Sun Oct 25 10:08:46 2020 (r367037) +++ head/sbin/mount_nullfs/mount_nullfs.c Sun Oct 25 14:09:00 2020 (r367038) @@ -59,7 +59,6 @@ static const char rcsid[] = #include "mntopts.h" -intsubdir(const char *, const char *); static voidusage(void) __dead2; int @@ -104,10 +103,6 @@ main(int argc, char *argv[]) if (checkpath(argv[1], source) != 0) err(EX_USAGE, "%s", source); - if (subdir(target, source) || subdir(source, target)) - errx(EX_USAGE, "%s (%s) and %s are not distinct paths", - argv[0], target, argv[1]); - build_iovec(, , "fstype", nullfs, (size_t)-1); build_iovec(, , "fspath", source, (size_t)-1); build_iovec(, , "target", target, (size_t)-1); @@ -119,21 +114,6 @@ main(int argc, char *argv[]) err(1, "%s", source); } exit(0); -} - -int -subdir(const char *p, const char *dir) -{ - int l; - - l = strlen(dir); - if (l <= 1) - return (1); - - if ((strncmp(p, dir, l) == 0) && (p[l] == '/' || p[l] == '\0')) - return (1); - - return (0); } static void ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367001 - head/sys/compat/linux
Author: trasz Date: Sat Oct 24 14:25:38 2020 New Revision: 367001 URL: https://svnweb.freebsd.org/changeset/base/367001 Log: Tweak linux(4) socket(2) debug messages. MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D26900 Modified: head/sys/compat/linux/linux.h head/sys/compat/linux/linux_socket.c Modified: head/sys/compat/linux/linux.h == --- head/sys/compat/linux/linux.h Sat Oct 24 14:23:44 2020 (r367000) +++ head/sys/compat/linux/linux.h Sat Oct 24 14:25:38 2020 (r367001) @@ -58,6 +58,10 @@ struct l_sockaddr { #defineLINUX_AF_IPX4 #defineLINUX_AF_APPLETALK 5 #defineLINUX_AF_INET6 10 +#defineLINUX_AF_NETLINK16 + +#defineLINUX_NETLINK_ROUTE 0 +#defineLINUX_NETLINK_UEVENT15 /* * net device flags Modified: head/sys/compat/linux/linux_socket.c == --- head/sys/compat/linux/linux_socket.cSat Oct 24 14:23:44 2020 (r367000) +++ head/sys/compat/linux/linux_socket.cSat Oct 24 14:25:38 2020 (r367001) @@ -514,6 +514,20 @@ linux_socket(struct thread *td, struct linux_socket_ar return (retval_socket); domain = linux_to_bsd_domain(args->domain); if (domain == -1) { + if (args->domain == LINUX_AF_NETLINK && + args->protocol == LINUX_NETLINK_ROUTE) { + linux_msg(curthread, + "unsupported socket(AF_NETLINK, %d, NETLINK_ROUTE)", type); + return (EAFNOSUPPORT); + } + + if (args->domain == LINUX_AF_NETLINK && + args->protocol == LINUX_NETLINK_UEVENT) { + linux_msg(curthread, + "unsupported socket(AF_NETLINK, %d, NETLINK_UEVENT)", type); + return (EAFNOSUPPORT); + } + linux_msg(curthread, "unsupported socket domain %d, type %d, protocol %d", args->domain, args->type & LINUX_SOCK_TYPE_MASK, args->protocol); return (EAFNOSUPPORT); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367000 - head/sys/compat/linux
Author: trasz Date: Sat Oct 24 14:23:44 2020 New Revision: 367000 URL: https://svnweb.freebsd.org/changeset/base/367000 Log: Further improve prctl(2) debug. MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D26916 Modified: head/sys/compat/linux/linux_misc.c head/sys/compat/linux/linux_misc.h Modified: head/sys/compat/linux/linux_misc.c == --- head/sys/compat/linux/linux_misc.c Sat Oct 24 13:31:40 2020 (r366999) +++ head/sys/compat/linux/linux_misc.c Sat Oct 24 14:23:44 2020 (r367000) @@ -1949,6 +1949,10 @@ linux_prctl(struct thread *td, struct linux_prctl_args (void *)(register_t)args->arg2, sizeof(pdeath_signal))); break; + case LINUX_PR_SET_DUMPABLE: + linux_msg(td, "unsupported prctl PR_SET_DUMPABLE"); + error = EINVAL; + break; case LINUX_PR_GET_KEEPCAPS: /* * Indicate that we always clear the effective and @@ -2006,6 +2010,14 @@ linux_prctl(struct thread *td, struct linux_prctl_args /* * Same as returned by Linux without CONFIG_SECCOMP enabled. */ + error = EINVAL; + break; + case LINUX_PR_SET_NO_NEW_PRIVS: + linux_msg(td, "unsupported prctl PR_SET_NO_NEW_PRIVS"); + error = EINVAL; + break; + case LINUX_PR_SET_PTRACER: + linux_msg(td, "unsupported prctl PR_SET_PTRACER"); error = EINVAL; break; default: Modified: head/sys/compat/linux/linux_misc.h == --- head/sys/compat/linux/linux_misc.h Sat Oct 24 13:31:40 2020 (r366999) +++ head/sys/compat/linux/linux_misc.h Sat Oct 24 14:23:44 2020 (r367000) @@ -50,12 +50,15 @@ * Second arg is a ptr to return the * signal. */ +#defineLINUX_PR_SET_DUMPABLE 4 #defineLINUX_PR_GET_KEEPCAPS 7 /* Get drop capabilities on setuid */ #defineLINUX_PR_SET_KEEPCAPS 8 /* Set drop capabilities on setuid */ #defineLINUX_PR_SET_NAME 15 /* Set process name. */ #defineLINUX_PR_GET_NAME 16 /* Get process name. */ #defineLINUX_PR_GET_SECCOMP21 #defineLINUX_PR_SET_SECCOMP22 +#defineLINUX_PR_SET_NO_NEW_PRIVS 38 +#defineLINUX_PR_SET_PTRACER1499557217 #defineLINUX_MAX_COMM_LEN 16 /* Maximum length of the process name. */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366967 - head/sys/compat/linux
Author: trasz Date: Fri Oct 23 12:00:30 2020 New Revision: 366967 URL: https://svnweb.freebsd.org/changeset/base/366967 Log: Improve prctl(2) debug. MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D26899 Modified: head/sys/compat/linux/linux_misc.c head/sys/compat/linux/linux_misc.h Modified: head/sys/compat/linux/linux_misc.c == --- head/sys/compat/linux/linux_misc.c Fri Oct 23 11:57:55 2020 (r366966) +++ head/sys/compat/linux/linux_misc.c Fri Oct 23 12:00:30 2020 (r366967) @@ -2001,7 +2001,15 @@ linux_prctl(struct thread *td, struct linux_prctl_args error = copyout(comm, (void *)(register_t)args->arg2, strlen(comm) + 1); break; + case LINUX_PR_GET_SECCOMP: + case LINUX_PR_SET_SECCOMP: + /* +* Same as returned by Linux without CONFIG_SECCOMP enabled. +*/ + error = EINVAL; + break; default: + linux_msg(td, "unsupported prctl option %d", args->option); error = EINVAL; break; } Modified: head/sys/compat/linux/linux_misc.h == --- head/sys/compat/linux/linux_misc.h Fri Oct 23 11:57:55 2020 (r366966) +++ head/sys/compat/linux/linux_misc.h Fri Oct 23 12:00:30 2020 (r366967) @@ -54,6 +54,8 @@ #defineLINUX_PR_SET_KEEPCAPS 8 /* Set drop capabilities on setuid */ #defineLINUX_PR_SET_NAME 15 /* Set process name. */ #defineLINUX_PR_GET_NAME 16 /* Get process name. */ +#defineLINUX_PR_GET_SECCOMP21 +#defineLINUX_PR_SET_SECCOMP22 #defineLINUX_MAX_COMM_LEN 16 /* Maximum length of the process name. */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366966 - head/sys/compat/linprocfs
Author: trasz Date: Fri Oct 23 11:57:55 2020 New Revision: 366966 URL: https://svnweb.freebsd.org/changeset/base/366966 Log: Add /proc/sys/kernel/ngroups_max to linprocfs(4). The id(1) command seems to use it - it works fine without it, but still. MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D26898 Modified: head/sys/compat/linprocfs/linprocfs.c Modified: head/sys/compat/linprocfs/linprocfs.c == --- head/sys/compat/linprocfs/linprocfs.c Fri Oct 23 10:48:14 2020 (r366965) +++ head/sys/compat/linprocfs/linprocfs.c Fri Oct 23 11:57:55 2020 (r366966) @@ -1453,6 +1453,19 @@ linprocfs_domsgmnb(PFS_FILL_ARGS) } /* + * Filler function for proc/sys/kernel/ngroups_max + * + * Note that in Linux it defaults to 65536, not 1023. + */ +static int +linprocfs_dongroups_max(PFS_FILL_ARGS) +{ + + sbuf_printf(sb, "%d\n", ngroups_max); + return (0); +} + +/* * Filler function for proc/sys/kernel/pid_max */ static int @@ -1921,6 +1934,8 @@ linprocfs_init(PFS_INIT_ARGS) pfs_create_file(dir, "msgmni", _domsgmni, NULL, NULL, NULL, PFS_RD); pfs_create_file(dir, "msgmnb", _domsgmnb, + NULL, NULL, NULL, PFS_RD); + pfs_create_file(dir, "ngroups_max", _dongroups_max, NULL, NULL, NULL, PFS_RD); pfs_create_file(dir, "pid_max", _dopid_max, NULL, NULL, NULL, PFS_RD); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366915 - head/sys/compat/linux
Author: trasz Date: Wed Oct 21 18:45:48 2020 New Revision: 366915 URL: https://svnweb.freebsd.org/changeset/base/366915 Log: Make linux(4) warn about unsupported socket(2) types. MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D25680 Modified: head/sys/compat/linux/linux_socket.c Modified: head/sys/compat/linux/linux_socket.c == --- head/sys/compat/linux/linux_socket.cWed Oct 21 17:11:57 2020 (r366914) +++ head/sys/compat/linux/linux_socket.cWed Oct 21 18:45:48 2020 (r366915) @@ -513,8 +513,11 @@ linux_socket(struct thread *td, struct linux_socket_ar if (retval_socket != 0) return (retval_socket); domain = linux_to_bsd_domain(args->domain); - if (domain == -1) + if (domain == -1) { + linux_msg(curthread, "unsupported socket domain %d, type %d, protocol %d", + args->domain, args->type & LINUX_SOCK_TYPE_MASK, args->protocol); return (EAFNOSUPPORT); + } retval_socket = kern_socket(td, domain, type, args->protocol); if (retval_socket) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366900 - head/sys/compat/linprocfs
Author: trasz Date: Tue Oct 20 17:24:29 2020 New Revision: 366900 URL: https://svnweb.freebsd.org/changeset/base/366900 Log: Fix linprocfs(4) /proc/self/mem semantics to more closely match Linux. Steam's Anti-Cheat might depend on it. PR: 248223 Analyzed by: Alex S Reviewed by: kib MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D26816 Modified: head/sys/compat/linprocfs/linprocfs.c Modified: head/sys/compat/linprocfs/linprocfs.c == --- head/sys/compat/linprocfs/linprocfs.c Tue Oct 20 17:19:10 2020 (r366899) +++ head/sys/compat/linprocfs/linprocfs.c Tue Oct 20 17:24:29 2020 (r366900) @@ -1276,6 +1276,27 @@ linprocfs_doprocmaps(PFS_FILL_ARGS) } /* + * Filler function for proc/pid/mem + */ +static int +linprocfs_doprocmem(PFS_FILL_ARGS) +{ + ssize_t resid; + int error; + + resid = uio->uio_resid; + error = procfs_doprocmem(PFS_FILL_ARGNAMES); + + if (uio->uio_rw == UIO_READ && resid != uio->uio_resid) + return (0); + + if (error == EFAULT) + error = EIO; + + return (error); +} + +/* * Criteria for interface name translation */ #define IFP_IS_ETH(ifp) (ifp->if_type == IFT_ETHER) @@ -1853,7 +1874,7 @@ linprocfs_init(PFS_INIT_ARGS) NULL, _notsystem, NULL, 0); pfs_create_file(dir, "maps", _doprocmaps, NULL, NULL, NULL, PFS_RD); - pfs_create_file(dir, "mem", _doprocmem, + pfs_create_file(dir, "mem", _doprocmem, procfs_attr_rw, _candebug, NULL, PFS_RDWR | PFS_RAW); pfs_create_file(dir, "mounts", _domtab, NULL, NULL, NULL, PFS_RD); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366899 - head/sys/compat/linux
Author: trasz Date: Tue Oct 20 17:19:10 2020 New Revision: 366899 URL: https://svnweb.freebsd.org/changeset/base/366899 Log: Fix potential race condition in linux stat(2). Reviewed by: kib MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D25618 Modified: head/sys/compat/linux/linux_stats.c head/sys/compat/linux/linux_util.c head/sys/compat/linux/linux_util.h Modified: head/sys/compat/linux/linux_stats.c == --- head/sys/compat/linux/linux_stats.c Tue Oct 20 17:00:43 2020 (r366898) +++ head/sys/compat/linux/linux_stats.c Tue Oct 20 17:19:10 2020 (r366899) @@ -80,11 +80,8 @@ translate_vnhook_major_minor(struct vnode *vp, struct if (rootdevmp != NULL && vp->v_mount->mnt_vfc == rootdevmp->mnt_vfc) sb->st_dev = rootdevmp->mnt_stat.f_fsid.val[0]; - if (vp->v_type == VCHR && vp->v_rdev != NULL && - linux_driver_get_major_minor(devtoname(vp->v_rdev), - , ) == 0) { + if (linux_vn_get_major_minor(vp, , ) == 0) sb->st_rdev = (major << 8 | minor); - } } static int @@ -140,9 +137,7 @@ translate_fd_major_minor(struct thread *td, int fd, st if (mp != NULL && mp->mnt_vfc == rootdevmp->mnt_vfc) buf->st_dev = rootdevmp->mnt_stat.f_fsid.val[0]; } - if (vp != NULL && vp->v_rdev != NULL && - linux_driver_get_major_minor(devtoname(vp->v_rdev), -, ) == 0) { + if (linux_vn_get_major_minor(vp, , ) == 0) { buf->st_rdev = (major << 8 | minor); } else if (fp->f_type == DTYPE_PTS) { struct tty *tp = fp->f_data; Modified: head/sys/compat/linux/linux_util.c == --- head/sys/compat/linux/linux_util.c Tue Oct 20 17:00:43 2020 (r366898) +++ head/sys/compat/linux/linux_util.c Tue Oct 20 17:19:10 2020 (r366899) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -193,6 +194,24 @@ linux_driver_get_major_minor(const char *node, int *ma } return (1); +} + +int +linux_vn_get_major_minor(const struct vnode *vp, int *major, int *minor) +{ + int error; + + if (vp->v_type != VCHR) + return (ENOTBLK); + dev_lock(); + if (vp->v_rdev == NULL) { + dev_unlock(); + return (ENXIO); + } + error = linux_driver_get_major_minor(devtoname(vp->v_rdev), + major, minor); + dev_unlock(); + return (error); } char * Modified: head/sys/compat/linux/linux_util.h == --- head/sys/compat/linux/linux_util.h Tue Oct 20 17:00:43 2020 (r366898) +++ head/sys/compat/linux/linux_util.h Tue Oct 20 17:19:10 2020 (r366899) @@ -123,6 +123,7 @@ int linux_device_register_handler(struct linux_device_ intlinux_device_unregister_handler(struct linux_device_handler *h); char *linux_driver_get_name_dev(device_t dev); intlinux_driver_get_major_minor(const char *node, int *major, int *minor); +intlinux_vn_get_major_minor(const struct vnode *vn, int *major, int *minor); char *linux_get_char_devices(void); void linux_free_get_char_devices(char *string); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366855 - in head/sys/geom: . uzip
Author: trasz Date: Mon Oct 19 20:26:37 2020 New Revision: 366855 URL: https://svnweb.freebsd.org/changeset/base/366855 Log: Fix fallout from r366811. PR: 250442 Reported by: lwhsu Reviewed by: mav MFC after:2 weeks Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision:https://reviews.freebsd.org/D26855 Modified: head/sys/geom/geom_dev.c head/sys/geom/uzip/g_uzip.c Modified: head/sys/geom/geom_dev.c == --- head/sys/geom/geom_dev.cMon Oct 19 20:08:50 2020(r366854) +++ head/sys/geom/geom_dev.cMon Oct 19 20:26:37 2020(r366855) @@ -346,9 +346,15 @@ g_dev_taste(struct g_class *mp, struct g_provider *pp, cp->private = sc; cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE; error = g_attach(cp, pp); - KASSERT(error == 0 || error == ENXIO, - ("g_dev_taste(%s) failed to g_attach, err=%d", pp->name, error)); - + if (error != 0) { + printf("%s: g_dev_taste(%s) failed to g_attach, error=%d\n", + __func__, pp->name, error); + g_destroy_consumer(cp); + g_destroy_geom(gp); + mtx_destroy(>sc_mtx); + g_free(sc); + return (NULL); + } make_dev_args_init(); args.mda_flags = MAKEDEV_CHECKNAME | MAKEDEV_WAITOK; args.mda_devsw = _dev_cdevsw; Modified: head/sys/geom/uzip/g_uzip.c == --- head/sys/geom/uzip/g_uzip.c Mon Oct 19 20:08:50 2020(r366854) +++ head/sys/geom/uzip/g_uzip.c Mon Oct 19 20:26:37 2020(r366855) @@ -707,11 +707,11 @@ g_uzip_taste(struct g_class *mp, struct g_provider *pp gp = g_new_geomf(mp, GUZ_DEV_NAME("%s"), pp->name); cp = g_new_consumer(gp); error = g_attach(cp, pp); - if (error == 0) - error = g_access(cp, 1, 0, 0); - if (error) { + if (error != 0) + goto e0; + error = g_access(cp, 1, 0, 0); + if (error) goto e1; - } g_topology_unlock(); /* @@ -942,6 +942,7 @@ e2: g_access(cp, -1, 0, 0); e1: g_detach(cp); +e0: g_destroy_consumer(cp); g_destroy_geom(gp); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366812 - head/sys/dev/iscsi
Author: trasz Date: Sun Oct 18 16:30:49 2020 New Revision: 366812 URL: https://svnweb.freebsd.org/changeset/base/366812 Log: If the SIM freezes the queue at exactly the wrong moment, after another thread has started to send in a CCB and already checked the queue wasn't frozen, we would end up with iscsi_action() being called despite the queue is now frozen. Add a check to make sure this doesn't happen . Perhaps this should be fixed at the CAM level instead, but given how the send queue and SIM are governed by two separate mutexes, it is somewhat hard to do. Reviewed by: imp, mav MFC after:2 weeks Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision:https://reviews.freebsd.org/D26750 Modified: head/sys/dev/iscsi/iscsi.c Modified: head/sys/dev/iscsi/iscsi.c == --- head/sys/dev/iscsi/iscsi.c Sun Oct 18 16:24:08 2020(r366811) +++ head/sys/dev/iscsi/iscsi.c Sun Oct 18 16:30:49 2020(r366812) @@ -367,8 +367,8 @@ iscsi_session_cleanup(struct iscsi_session *is, bool d xpt_async(AC_LOST_DEVICE, is->is_path, NULL); if (is->is_simq_frozen) { - xpt_release_simq(is->is_sim, 1); is->is_simq_frozen = false; + xpt_release_simq(is->is_sim, 1); } xpt_free_path(is->is_path); @@ -1479,8 +1479,8 @@ iscsi_ioctl_daemon_handoff(struct iscsi_softc *sc, KASSERT(is->is_simq_frozen, ("reconnect without frozen simq")); ISCSI_SESSION_LOCK(is); ISCSI_SESSION_DEBUG(is, "releasing"); - xpt_release_simq(is->is_sim, 1); is->is_simq_frozen = false; + xpt_release_simq(is->is_sim, 1); ISCSI_SESSION_UNLOCK(is); } else { @@ -2351,6 +2351,17 @@ iscsi_action(struct cam_sim *sim, union ccb *ccb) if (is->is_terminating || (is->is_connected == false && fail_on_disconnection)) { ccb->ccb_h.status = CAM_DEV_NOT_THERE; + xpt_done(ccb); + return; + } + + /* +* Make sure CAM doesn't sneak in a CCB just after freezing the queue. +*/ + if (is->is_simq_frozen == true) { + ccb->ccb_h.status &= ~(CAM_SIM_QUEUED | CAM_STATUS_MASK); + ccb->ccb_h.status |= CAM_REQUEUE_REQ; + /* Don't freeze the devq - the SIM queue is already frozen. */ xpt_done(ccb); return; } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366811 - in head: share/man/man9 sys/geom sys/geom/bde sys/geom/cache sys/geom/concat sys/geom/journal sys/geom/label sys/geom/linux_lvm sys/geom/mirror sys/geom/mountver sys/geom/mult...
Author: trasz Date: Sun Oct 18 16:24:08 2020 New Revision: 366811 URL: https://svnweb.freebsd.org/changeset/base/366811 Log: Make g_attach() return ENXIO for orphaned providers; update various classes to add missing error checking. Reviewed by: imp MFC after:2 weeks Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision:https://reviews.freebsd.org/D26658 Modified: head/share/man/man9/g_attach.9 head/sys/geom/bde/g_bde.c head/sys/geom/cache/g_cache.c head/sys/geom/concat/g_concat.c head/sys/geom/geom_dev.c head/sys/geom/geom_subr.c head/sys/geom/geom_vfs.c head/sys/geom/journal/g_journal.c head/sys/geom/label/g_label.c head/sys/geom/linux_lvm/g_linux_lvm.c head/sys/geom/mirror/g_mirror.c head/sys/geom/mirror/g_mirror_ctl.c head/sys/geom/mountver/g_mountver.c head/sys/geom/multipath/g_multipath.c head/sys/geom/raid/g_raid.c head/sys/geom/raid3/g_raid3.c head/sys/geom/shsec/g_shsec.c head/sys/geom/stripe/g_stripe.c head/sys/geom/virstor/g_virstor.c Modified: head/share/man/man9/g_attach.9 == --- head/share/man/man9/g_attach.9 Sun Oct 18 16:16:22 2020 (r366810) +++ head/share/man/man9/g_attach.9 Sun Oct 18 16:24:08 2020 (r366811) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 16, 2004 +.Dd October 10, 2020 .Dt G_ATTACH 9 .Os .Sh NAME @@ -122,6 +122,8 @@ Possible errors: .Bl -tag -width Er .It Bq Er ELOOP The operation creates a topology loop. +.It Bq Er ENXIO +Provider got orphaned. .El .Sh SEE ALSO .Xr geom 4 , Modified: head/sys/geom/bde/g_bde.c == --- head/sys/geom/bde/g_bde.c Sun Oct 18 16:16:22 2020(r366810) +++ head/sys/geom/bde/g_bde.c Sun Oct 18 16:24:08 2020(r366811) @@ -131,7 +131,13 @@ g_bde_create_geom(struct gctl_req *req, struct g_class gp = g_new_geomf(mp, "%s.bde", pp->name); cp = g_new_consumer(gp); - g_attach(cp, pp); + error = g_attach(cp, pp); + if (error != 0) { + g_destroy_consumer(cp); + g_destroy_geom(gp); + gctl_error(req, "could not attach consumer"); + return; + } error = g_access(cp, 1, 1, 1); if (error) { g_detach(cp); Modified: head/sys/geom/cache/g_cache.c == --- head/sys/geom/cache/g_cache.c Sun Oct 18 16:16:22 2020 (r366810) +++ head/sys/geom/cache/g_cache.c Sun Oct 18 16:24:08 2020 (r366811) @@ -673,9 +673,11 @@ g_cache_taste(struct g_class *mp, struct g_provider *p gp->orphan = g_cache_orphan; gp->access = g_cache_access; cp = g_new_consumer(gp); - g_attach(cp, pp); - error = g_cache_read_metadata(cp, ); - g_detach(cp); + error = g_attach(cp, pp); + if (error == 0) { + error = g_cache_read_metadata(cp, ); + g_detach(cp); + } g_destroy_consumer(cp); g_destroy_geom(gp); if (error != 0) Modified: head/sys/geom/concat/g_concat.c == --- head/sys/geom/concat/g_concat.c Sun Oct 18 16:16:22 2020 (r366810) +++ head/sys/geom/concat/g_concat.c Sun Oct 18 16:24:08 2020 (r366811) @@ -718,9 +718,11 @@ g_concat_taste(struct g_class *mp, struct g_provider * gp->access = g_concat_access; gp->orphan = g_concat_orphan; cp = g_new_consumer(gp); - g_attach(cp, pp); - error = g_concat_read_metadata(cp, ); - g_detach(cp); + error = g_attach(cp, pp); + if (error == 0) { + error = g_concat_read_metadata(cp, ); + g_detach(cp); + } g_destroy_consumer(cp); g_destroy_geom(gp); if (error != 0) Modified: head/sys/geom/geom_dev.c == --- head/sys/geom/geom_dev.cSun Oct 18 16:16:22 2020(r366810) +++ head/sys/geom/geom_dev.cSun Oct 18 16:24:08 2020(r366811) @@ -346,7 +346,7 @@ g_dev_taste(struct g_class *mp, struct g_provider *pp, cp->private = sc; cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE; error = g_attach(cp, pp); - KASSERT(error == 0, + KASSERT(error == 0 || error == ENXIO, ("g_dev_taste(%s) failed to g_attach, err=%d", pp->name, error)); make_dev_args_init(); Modified: head/sys/geom/geom_subr.c == --- head/sys/geom/geom_subr.c Sun Oct 18 16:16:22 2020(r366810) +++ head/sys/geom/geom_subr.c Sun Oct 18 16:24:08 2020(r366811) @@ -896,6 +896,8 @@ g_attach(struct g_consumer *cp, struct g_provider
svn commit: r366810 - head/sys/amd64/linux
Author: trasz Date: Sun Oct 18 16:16:22 2020 New Revision: 366810 URL: https://svnweb.freebsd.org/changeset/base/366810 Log: Stop calling set_syscall_retval() from linux_set_syscall_retval(). The former clobbers some registers that shouldn't be touched. Reviewed by: kib (earlier version) MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D26406 Modified: head/sys/amd64/linux/linux_sysvec.c Modified: head/sys/amd64/linux/linux_sysvec.c == --- head/sys/amd64/linux/linux_sysvec.c Sun Oct 18 15:58:16 2020 (r366809) +++ head/sys/amd64/linux/linux_sysvec.c Sun Oct 18 16:16:22 2020 (r366810) @@ -206,24 +206,45 @@ linux_fetch_syscall_args(struct thread *td) static void linux_set_syscall_retval(struct thread *td, int error) { - struct trapframe *frame = td->td_frame; + struct trapframe *frame; - /* -* On Linux only %rcx and %r11 values are not preserved across -* the syscall. So, do not clobber %rdx and %r10. -*/ - td->td_retval[1] = frame->tf_rdx; - if (error != EJUSTRETURN) - frame->tf_r10 = frame->tf_rcx; + frame = td->td_frame; - cpu_set_syscall_retval(td, error); + switch (error) { + case 0: + frame->tf_rax = td->td_retval[0]; + frame->tf_r10 = frame->tf_rcx; + break; - if (__predict_false(error != 0)) { - if (error != ERESTART && error != EJUSTRETURN) - frame->tf_rax = linux_to_bsd_errno(error); + case ERESTART: + /* +* Reconstruct pc, we know that 'syscall' is 2 bytes, +* lcall $X,y is 7 bytes, int 0x80 is 2 bytes. +* We saved this in tf_err. +* +*/ + frame->tf_rip -= frame->tf_err; + frame->tf_r10 = frame->tf_rcx; + break; + + case EJUSTRETURN: + break; + + default: + frame->tf_rax = linux_to_bsd_errno(error); + frame->tf_r10 = frame->tf_rcx; + break; } -/* Restore all registers. */ + /* +* Differently from FreeBSD native ABI, on Linux only %rcx +* and %r11 values are not preserved across the syscall. +* Require full context restore to get all registers except +* those two restored at return to usermode. +* +* XXX: Would be great to be able to avoid PCB_FULL_IRET +* for the error == 0 case. +*/ set_pcb_flags(td->td_pcb, PCB_FULL_IRET); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366809 - head/sys/compat/linux
Author: trasz Date: Sun Oct 18 15:58:16 2020 New Revision: 366809 URL: https://svnweb.freebsd.org/changeset/base/366809 Log: Add compat.linux.dummy_rlimits, and disable by default. Turns out the dummy rlimits fix prlimit(1), but break su(8) (login-1:4.5-1ubuntu2) - although not sudo(8), for some reason. MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D26814 Modified: head/sys/compat/linux/linux_mib.c head/sys/compat/linux/linux_mib.h head/sys/compat/linux/linux_misc.c Modified: head/sys/compat/linux/linux_mib.c == --- head/sys/compat/linux/linux_mib.c Sun Oct 18 15:56:47 2020 (r366808) +++ head/sys/compat/linux/linux_mib.c Sun Oct 18 15:58:16 2020 (r366809) @@ -77,6 +77,11 @@ SYSCTL_INT(_compat_linux, OID_AUTO, default_stacksize, _default_stacksize, 0, "Default soft stack size resource limit, or -1 for unlimited"); +int linux_dummy_rlimits = 0; +SYSCTL_INT(_compat_linux, OID_AUTO, dummy_rlimits, CTLFLAG_RWTUN, +_dummy_rlimits, 0, +"Return dummy values for unsupported Linux-specific rlimits"); + int linux_ignore_ip_recverr = 1; SYSCTL_INT(_compat_linux, OID_AUTO, ignore_ip_recverr, CTLFLAG_RWTUN, _ignore_ip_recverr, 0, "Ignore enabling IP_RECVERR"); Modified: head/sys/compat/linux/linux_mib.h == --- head/sys/compat/linux/linux_mib.h Sun Oct 18 15:56:47 2020 (r366808) +++ head/sys/compat/linux/linux_mib.h Sun Oct 18 15:58:16 2020 (r366809) @@ -65,6 +65,7 @@ int linux_kernver(struct thread *td); extern int linux_debug; extern int linux_default_openfiles; extern int linux_default_stacksize; +extern int linux_dummy_rlimits; extern int linux_ignore_ip_recverr; extern int linux_preserve_vstatus; extern bool linux_map_sched_prio; Modified: head/sys/compat/linux/linux_misc.c == --- head/sys/compat/linux/linux_misc.c Sun Oct 18 15:56:47 2020 (r366808) +++ head/sys/compat/linux/linux_misc.c Sun Oct 18 15:58:16 2020 (r366809) @@ -1377,6 +1377,9 @@ static bool linux_get_dummy_limit(l_uint resource, struct rlimit *rlim) { + if (linux_dummy_rlimits == 0) + return (false); + switch (resource) { case LINUX_RLIMIT_LOCKS: case LINUX_RLIMIT_SIGPENDING: ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366808 - head/sys/amd64/linux
Author: trasz Date: Sun Oct 18 15:56:47 2020 New Revision: 366808 URL: https://svnweb.freebsd.org/changeset/base/366808 Log: Slightly tweak linux ptrace(2) debug message; no functional changes. MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D26815 Modified: head/sys/amd64/linux/linux_ptrace.c Modified: head/sys/amd64/linux/linux_ptrace.c == --- head/sys/amd64/linux/linux_ptrace.c Sun Oct 18 12:03:36 2020 (r366807) +++ head/sys/amd64/linux/linux_ptrace.c Sun Oct 18 15:56:47 2020 (r366808) @@ -71,6 +71,7 @@ __FBSDID("$FreeBSD$"); #defineLINUX_PTRACE_GETSIGINFO 0x4202 #defineLINUX_PTRACE_GETREGSET 0x4204 #defineLINUX_PTRACE_SEIZE 0x4206 +#defineLINUX_PTRACE_GET_SYSCALL_INFO 0x420e #defineLINUX_PTRACE_EVENT_EXIT 6 @@ -557,6 +558,14 @@ linux_ptrace_seize(struct thread *td, pid_t pid, l_ulo return (EINVAL); } +static int +linux_ptrace_get_syscall_info(struct thread *td, pid_t pid, l_ulong addr, l_ulong data) +{ + + linux_msg(td, "PTRACE_GET_SYSCALL_INFO not implemented; returning EINVAL"); + return (EINVAL); +} + int linux_ptrace(struct thread *td, struct linux_ptrace_args *uap) { @@ -641,6 +650,9 @@ linux_ptrace(struct thread *td, struct linux_ptrace_ar break; case LINUX_PTRACE_SEIZE: error = linux_ptrace_seize(td, pid, uap->addr, uap->data); + break; + case LINUX_PTRACE_GET_SYSCALL_INFO: + error = linux_ptrace_get_syscall_info(td, pid, uap->addr, uap->data); break; default: linux_msg(td, "ptrace(%ld, ...) not implemented; " ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366756 - head/sys/compat/linux
Author: trasz Date: Fri Oct 16 11:23:30 2020 New Revision: 366756 URL: https://svnweb.freebsd.org/changeset/base/366756 Log: Set default stack size for Linux apps to 8MB. This matches Linux' defaults, makes core files smaller, and fixes applications which use pthread_join(3) in a wrong way, namely Steam. This is based on a patch submitted by Jason Yang, which I've reworked to set the limit instead of only changing the value reported (which is enough to fix the bug for Linux pthreads, but could be confusing). PR: 248225 Submitted by: Jason_YH_Yang at wistron.com (earlier version) Analyzed by: Alex S Reviewed by: emaste MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D26778 Modified: head/sys/compat/linux/linux_emul.c head/sys/compat/linux/linux_mib.c head/sys/compat/linux/linux_mib.h Modified: head/sys/compat/linux/linux_emul.c == --- head/sys/compat/linux/linux_emul.c Fri Oct 16 11:22:29 2020 (r366755) +++ head/sys/compat/linux/linux_emul.c Fri Oct 16 11:23:30 2020 (r366756) @@ -115,6 +115,29 @@ linux_set_default_openfiles(struct thread *td, struct KASSERT(error == 0, ("kern_proc_setrlimit failed")); } +/* + * The default stack size limit in Linux is 8MB. + */ +static void +linux_set_default_stacksize(struct thread *td, struct proc *p) +{ + struct rlimit rlim; + int error; + + if (linux_default_stacksize < 0) + return; + + PROC_LOCK(p); + lim_rlimit_proc(p, RLIMIT_STACK, ); + PROC_UNLOCK(p); + if (rlim.rlim_cur != rlim.rlim_max || + rlim.rlim_cur <= linux_default_stacksize) + return; + rlim.rlim_cur = linux_default_stacksize; + error = kern_proc_setrlimit(td, p, RLIMIT_STACK, ); + KASSERT(error == 0, ("kern_proc_setrlimit failed")); +} + void linux_proc_init(struct thread *td, struct thread *newtd, int flags) { @@ -145,6 +168,7 @@ linux_proc_init(struct thread *td, struct thread *newt newtd->td_emuldata = em; linux_set_default_openfiles(td, p); + linux_set_default_stacksize(td, p); } else { p = td->td_proc; Modified: head/sys/compat/linux/linux_mib.c == --- head/sys/compat/linux/linux_mib.c Fri Oct 16 11:22:29 2020 (r366755) +++ head/sys/compat/linux/linux_mib.c Fri Oct 16 11:23:30 2020 (r366756) @@ -72,6 +72,11 @@ SYSCTL_INT(_compat_linux, OID_AUTO, default_openfiles, _default_openfiles, 0, "Default soft openfiles resource limit, or -1 for unlimited"); +int linux_default_stacksize = 8 * 1024 * 1024; +SYSCTL_INT(_compat_linux, OID_AUTO, default_stacksize, CTLFLAG_RWTUN, +_default_stacksize, 0, +"Default soft stack size resource limit, or -1 for unlimited"); + int linux_ignore_ip_recverr = 1; SYSCTL_INT(_compat_linux, OID_AUTO, ignore_ip_recverr, CTLFLAG_RWTUN, _ignore_ip_recverr, 0, "Ignore enabling IP_RECVERR"); Modified: head/sys/compat/linux/linux_mib.h == --- head/sys/compat/linux/linux_mib.h Fri Oct 16 11:22:29 2020 (r366755) +++ head/sys/compat/linux/linux_mib.h Fri Oct 16 11:23:30 2020 (r366756) @@ -64,6 +64,7 @@ int linux_kernver(struct thread *td); extern int linux_debug; extern int linux_default_openfiles; +extern int linux_default_stacksize; extern int linux_ignore_ip_recverr; extern int linux_preserve_vstatus; extern bool linux_map_sched_prio; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366749 - head/sys/compat/linux
Author: trasz Date: Fri Oct 16 10:10:09 2020 New Revision: 366749 URL: https://svnweb.freebsd.org/changeset/base/366749 Log: Make linux getrlimit(2) and prlimit(2) return something reasonable for linux-specific limits. Fixes prlimit (util-linux-2.31.1-0.4ubuntu3.7). Reviewed by: emaste MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D26777 Modified: head/sys/compat/linux/linux_misc.c head/sys/compat/linux/linux_misc.h Modified: head/sys/compat/linux/linux_misc.c == --- head/sys/compat/linux/linux_misc.c Fri Oct 16 09:58:10 2020 (r366748) +++ head/sys/compat/linux/linux_misc.c Fri Oct 16 10:10:09 2020 (r366749) @@ -1373,6 +1373,28 @@ linux_getgroups(struct thread *td, struct linux_getgro return (0); } +static bool +linux_get_dummy_limit(l_uint resource, struct rlimit *rlim) +{ + + switch (resource) { + case LINUX_RLIMIT_LOCKS: + case LINUX_RLIMIT_SIGPENDING: + case LINUX_RLIMIT_MSGQUEUE: + case LINUX_RLIMIT_RTTIME: + rlim->rlim_cur = LINUX_RLIM_INFINITY; + rlim->rlim_max = LINUX_RLIM_INFINITY; + return (true); + case LINUX_RLIMIT_NICE: + case LINUX_RLIMIT_RTPRIO: + rlim->rlim_cur = 0; + rlim->rlim_max = 0; + return (true); + default: + return (false); + } +} + int linux_setrlimit(struct thread *td, struct linux_setrlimit_args *args) { @@ -1405,6 +1427,12 @@ linux_old_getrlimit(struct thread *td, struct linux_ol struct rlimit bsd_rlim; u_int which; + if (linux_get_dummy_limit(args->resource, _rlim)) { + rlim.rlim_cur = bsd_rlim.rlim_cur; + rlim.rlim_max = bsd_rlim.rlim_max; + return (copyout(, args->rlim, sizeof(rlim))); + } + if (args->resource >= LINUX_RLIM_NLIMITS) return (EINVAL); @@ -1440,6 +1468,12 @@ linux_getrlimit(struct thread *td, struct linux_getrli struct rlimit bsd_rlim; u_int which; + if (linux_get_dummy_limit(args->resource, _rlim)) { + rlim.rlim_cur = bsd_rlim.rlim_cur; + rlim.rlim_max = bsd_rlim.rlim_max; + return (copyout(, args->rlim, sizeof(rlim))); + } + if (args->resource >= LINUX_RLIM_NLIMITS) return (EINVAL); @@ -2137,6 +2171,14 @@ linux_prlimit64(struct thread *td, struct linux_prlimi u_int which; int flags; int error; + + if (args->new == NULL && args->old != NULL) { + if (linux_get_dummy_limit(args->resource, )) { + lrlim.rlim_cur = rlim.rlim_cur; + lrlim.rlim_max = rlim.rlim_max; + return (copyout(, args->old, sizeof(lrlim))); + } + } if (args->resource >= LINUX_RLIM_NLIMITS) return (EINVAL); Modified: head/sys/compat/linux/linux_misc.h == --- head/sys/compat/linux/linux_misc.h Fri Oct 16 09:58:10 2020 (r366748) +++ head/sys/compat/linux/linux_misc.h Fri Oct 16 10:10:09 2020 (r366749) @@ -137,12 +137,12 @@ extern int stclohz; #defineLINUX_P_PID 1 #defineLINUX_P_PGID2 -#defineLINUX_RLIMIT_LOCKS RLIM_NLIMITS + 1 -#defineLINUX_RLIMIT_SIGPENDING RLIM_NLIMITS + 2 -#defineLINUX_RLIMIT_MSGQUEUE RLIM_NLIMITS + 3 -#defineLINUX_RLIMIT_NICE RLIM_NLIMITS + 4 -#defineLINUX_RLIMIT_RTPRIO RLIM_NLIMITS + 5 -#defineLINUX_RLIMIT_RTTIME RLIM_NLIMITS + 6 +#defineLINUX_RLIMIT_LOCKS 10 +#defineLINUX_RLIMIT_SIGPENDING 11 +#defineLINUX_RLIMIT_MSGQUEUE 12 +#defineLINUX_RLIMIT_NICE 13 +#defineLINUX_RLIMIT_RTPRIO 14 +#defineLINUX_RLIMIT_RTTIME 15 #defineLINUX_RLIM_INFINITY (~0UL) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366748 - head/sys/fs/pseudofs
Author: trasz Date: Fri Oct 16 09:58:10 2020 New Revision: 366748 URL: https://svnweb.freebsd.org/changeset/base/366748 Log: Bump pseudofs size limit from 128kB to 1MB. The old limit could result in process' memory maps being truncated. PR: 237883 Submitted by: dchagin MFC after:2 weeks Differential Revision:https://reviews.freebsd.org/D20575 Modified: head/sys/fs/pseudofs/pseudofs_vnops.c Modified: head/sys/fs/pseudofs/pseudofs_vnops.c == --- head/sys/fs/pseudofs/pseudofs_vnops.c Fri Oct 16 08:56:20 2020 (r366747) +++ head/sys/fs/pseudofs/pseudofs_vnops.c Fri Oct 16 09:58:10 2020 (r366748) @@ -68,6 +68,8 @@ __FBSDID("$FreeBSD$"); KASSERT((pn)->pn_type == pfstype_symlink, \ ("%s(): VLNK vnode refers to non-link pfs_node", __func__)) +#definePFS_MAXBUFSIZ 1024 * 1024 + /* * Returns the fileno, adjusted for target pid */ @@ -677,8 +679,8 @@ pfs_read(struct vop_read_args *va) goto ret; } buflen = uio->uio_offset + uio->uio_resid; - if (buflen > MAXPHYS) - buflen = MAXPHYS; + if (buflen > PFS_MAXBUFSIZ) + buflen = PFS_MAXBUFSIZ; sb = sbuf_new(sb, NULL, buflen + 1, 0); if (sb == NULL) { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366722 - head/sys/compat/linprocfs
Author: trasz Date: Thu Oct 15 12:48:30 2020 New Revision: 366722 URL: https://svnweb.freebsd.org/changeset/base/366722 Log: With some popular multiplayer games (such as Counter-Strike: Global Offensive) the Linux Steam client likes to occasionally scan the game process memory, presumably as part anti-cheat measures. Turns out the client also expects each inode entry to be followed by a space character, otherwise the parsing code crashes. PR: 248216 Submitted by: Alex S MFC after:2 weeks Modified: head/sys/compat/linprocfs/linprocfs.c Modified: head/sys/compat/linprocfs/linprocfs.c == --- head/sys/compat/linprocfs/linprocfs.c Thu Oct 15 11:44:28 2020 (r366721) +++ head/sys/compat/linprocfs/linprocfs.c Thu Oct 15 12:48:30 2020 (r366722) @@ -1249,7 +1249,7 @@ linprocfs_doprocmaps(PFS_FILL_ARGS) 0, 0, (u_long)ino, - *name ? " " : "", + *name ? " " : " ", name ); if (freename) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366534 - head/sys/riscv/riscv
Author: trasz Date: Thu Oct 8 11:04:32 2020 New Revision: 366534 URL: https://svnweb.freebsd.org/changeset/base/366534 Log: Remove yet another useless assignment, adding a KASSERT just in case. Reviewed by: kp Sponsored by: DARPA Differential Revision:https://reviews.freebsd.org/D26698 Modified: head/sys/riscv/riscv/trap.c Modified: head/sys/riscv/riscv/trap.c == --- head/sys/riscv/riscv/trap.c Thu Oct 8 10:59:49 2020(r366533) +++ head/sys/riscv/riscv/trap.c Thu Oct 8 11:04:32 2020(r366534) @@ -158,15 +158,12 @@ dump_regs(struct trapframe *frame) } static void -ecall_handler(struct trapframe *frame) +ecall_handler(void) { struct thread *td; td = curthread; - KASSERT(td->td_frame == frame, - ("%s: td_frame %p != frame %p", __func__, td->td_frame, frame)); - syscallenter(td); syscallret(td); } @@ -324,9 +321,11 @@ do_trap_user(struct trapframe *frame) struct pcb *pcb; td = curthread; - td->td_frame = frame; pcb = td->td_pcb; + KASSERT(td->td_frame == frame, + ("%s: td_frame %p != frame %p", __func__, td->td_frame, frame)); + /* Ensure we came from usermode, interrupts disabled */ KASSERT((csr_read(sstatus) & (SSTATUS_SPP | SSTATUS_SIE)) == 0, ("Came from U mode with interrupts enabled")); @@ -357,7 +356,7 @@ do_trap_user(struct trapframe *frame) break; case EXCP_USER_ECALL: frame->tf_sepc += 4;/* Next instruction */ - ecall_handler(frame); + ecall_handler(); break; case EXCP_ILLEGAL_INSTRUCTION: #ifdef FPE ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366515 - head/sys/riscv/riscv
Author: trasz Date: Wed Oct 7 12:11:11 2020 New Revision: 366515 URL: https://svnweb.freebsd.org/changeset/base/366515 Log: Don't use critical section when calling intr_irq_handler() - that function enters critical section by itself anyway. Reviewed by: kp Sponsored by: DARPA Differential Revision:https://reviews.freebsd.org/D26694 Modified: head/sys/riscv/riscv/intr_machdep.c Modified: head/sys/riscv/riscv/intr_machdep.c == --- head/sys/riscv/riscv/intr_machdep.c Wed Oct 7 10:58:56 2020 (r366514) +++ head/sys/riscv/riscv/intr_machdep.c Wed Oct 7 12:11:11 2020 (r366515) @@ -158,8 +158,6 @@ riscv_cpu_intr(struct trapframe *frame) struct intr_irqsrc *isrc; int active_irq; - critical_enter(); - KASSERT(frame->tf_scause & EXCP_INTR, ("riscv_cpu_intr: wrong frame passed")); @@ -169,18 +167,16 @@ riscv_cpu_intr(struct trapframe *frame) case IRQ_SOFTWARE_USER: case IRQ_SOFTWARE_SUPERVISOR: case IRQ_TIMER_SUPERVISOR: + critical_enter(); isrc = [active_irq].isrc; if (intr_isrc_dispatch(isrc, frame) != 0) printf("stray interrupt %d\n", active_irq); + critical_exit(); break; case IRQ_EXTERNAL_SUPERVISOR: intr_irq_handler(frame); break; - default: - break; } - - critical_exit(); } #ifdef SMP ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366456 - head/sys/arm64/arm64
Author: trasz Date: Mon Oct 5 18:46:14 2020 New Revision: 366456 URL: https://svnweb.freebsd.org/changeset/base/366456 Log: Tweak arm64's cpu_fetch_syscall_args(). This should make it possible for the compiler to inline the memcpy(). Reviewed by: andrew Sponsored by: DARPA Differential Revision:https://reviews.freebsd.org/D26629 Modified: head/sys/arm64/arm64/trap.c Modified: head/sys/arm64/arm64/trap.c == --- head/sys/arm64/arm64/trap.c Mon Oct 5 18:45:32 2020(r366455) +++ head/sys/arm64/arm64/trap.c Mon Oct 5 18:46:14 2020(r366456) @@ -123,30 +123,31 @@ int cpu_fetch_syscall_args(struct thread *td) { struct proc *p; - register_t *ap; + register_t *ap, *dst_ap; struct syscall_args *sa; - int nap; - nap = MAXARGS; p = td->td_proc; - ap = td->td_frame->tf_x; sa = >td_sa; + ap = td->td_frame->tf_x; + dst_ap = >args[0]; sa->code = td->td_frame->tf_x[8]; - if (sa->code == SYS_syscall || sa->code == SYS___syscall) { + if (__predict_false(sa->code == SYS_syscall || sa->code == SYS___syscall)) { sa->code = *ap++; - nap--; + } else { + *dst_ap++ = *ap++; } - if (sa->code >= p->p_sysent->sv_size) + if (__predict_false(sa->code >= p->p_sysent->sv_size)) sa->callp = >p_sysent->sv_table[0]; else sa->callp = >p_sysent->sv_table[sa->code]; - memcpy(sa->args, ap, nap * sizeof(register_t)); - if (sa->callp->sy_narg > nap) - panic("ARM64TODO: Could we have more than %d args?", MAXARGS); + KASSERT(sa->callp->sy_narg <= nitems(sa->args), + ("Syscall %d takes too many arguments", sa->code)); + + memcpy(dst_ap, ap, (MAXARGS - 1) * sizeof(register_t)); td->td_retval[0] = 0; td->td_retval[1] = 0; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366454 - head/sys/riscv/riscv
Author: trasz Date: Mon Oct 5 18:41:35 2020 New Revision: 366454 URL: https://svnweb.freebsd.org/changeset/base/366454 Log: Drop useless assignment, and add a KASSERT to make sure it really was useless. Reviewed by: nick, jhb Sponsored by: DARPA Differential Revision:https://reviews.freebsd.org/D26649 Modified: head/sys/riscv/riscv/trap.c Modified: head/sys/riscv/riscv/trap.c == --- head/sys/riscv/riscv/trap.c Mon Oct 5 18:17:50 2020(r366453) +++ head/sys/riscv/riscv/trap.c Mon Oct 5 18:41:35 2020(r366454) @@ -163,7 +163,9 @@ svc_handler(struct trapframe *frame) struct thread *td; td = curthread; - td->td_frame = frame; + + KASSERT(td->td_frame == frame, + ("%s: td_frame %p != frame %p", __func__, td->td_frame, frame)); syscallenter(td); syscallret(td); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366392 - head/sys/riscv/riscv
Author: trasz Date: Sat Oct 3 13:01:07 2020 New Revision: 366392 URL: https://svnweb.freebsd.org/changeset/base/366392 Log: Optimize riscv's cpu_fetch_syscall_args(), making it possible for the compiler to inline the memcpy. Reviewed by: arichardson, mhorne MFC after:2 weeks Sponsored by: DARPA Differential Revision:https://reviews.freebsd.org/D26528 Modified: head/sys/riscv/riscv/trap.c Modified: head/sys/riscv/riscv/trap.c == --- head/sys/riscv/riscv/trap.c Sat Oct 3 12:03:08 2020(r366391) +++ head/sys/riscv/riscv/trap.c Sat Oct 3 13:01:07 2020(r366392) @@ -96,30 +96,31 @@ int cpu_fetch_syscall_args(struct thread *td) { struct proc *p; - register_t *ap; + register_t *ap, *dst_ap; struct syscall_args *sa; - int nap; - nap = NARGREG; p = td->td_proc; sa = >td_sa; ap = >td_frame->tf_a[0]; + dst_ap = >args[0]; sa->code = td->td_frame->tf_t[0]; - if (sa->code == SYS_syscall || sa->code == SYS___syscall) { + if (__predict_false(sa->code == SYS_syscall || sa->code == SYS___syscall)) { sa->code = *ap++; - nap--; + } else { + *dst_ap++ = *ap++; } - if (sa->code >= p->p_sysent->sv_size) + if (__predict_false(sa->code >= p->p_sysent->sv_size)) sa->callp = >p_sysent->sv_table[0]; else sa->callp = >p_sysent->sv_table[sa->code]; - memcpy(sa->args, ap, nap * sizeof(register_t)); - if (sa->callp->sy_narg > nap) - panic("TODO: Could we have more then %d args?", NARGREG); + KASSERT(sa->callp->sy_narg <= nitems(sa->args), + ("Syscall %d takes too many arguments", sa->code)); + + memcpy(dst_ap, ap, (NARGREG - 1) * sizeof(register_t)); td->td_retval[0] = 0; td->td_retval[1] = 0; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366391 - head/sys/kern
Author: trasz Date: Sat Oct 3 12:03:08 2020 New Revision: 366391 URL: https://svnweb.freebsd.org/changeset/base/366391 Log: Move KTRUSERRET() from userret() to ast(). It's a really long detour - it writes ktrace entries to the filesystem - so the overhead of ast() won't make any difference. Reviewed by: kib Sponsored by: DARPA Differential Revision:https://reviews.freebsd.org/D26404 Modified: head/sys/kern/kern_ktrace.c head/sys/kern/subr_trap.c Modified: head/sys/kern/kern_ktrace.c == --- head/sys/kern/kern_ktrace.c Sat Oct 3 10:47:17 2020(r366390) +++ head/sys/kern/kern_ktrace.c Sat Oct 3 12:03:08 2020(r366391) @@ -347,6 +347,9 @@ ktr_enqueuerequest(struct thread *td, struct ktr_reque mtx_lock(_mtx); STAILQ_INSERT_TAIL(>td_proc->p_ktr, req, ktr_list); mtx_unlock(_mtx); + thread_lock(td); + td->td_flags |= TDF_ASTPENDING; + thread_unlock(td); } /* Modified: head/sys/kern/subr_trap.c == --- head/sys/kern/subr_trap.c Sat Oct 3 10:47:17 2020(r366390) +++ head/sys/kern/subr_trap.c Sat Oct 3 12:03:08 2020(r366391) @@ -130,9 +130,6 @@ userret(struct thread *td, struct trapframe *frame) PROC_UNLOCK(p); } #endif -#ifdef KTRACE - KTRUSERRET(td); -#endif /* * Charge system time if profiling. @@ -340,6 +337,10 @@ ast(struct trapframe *framep) */ if (td->td_pflags & TDP_SIGFASTPENDING) sigfastblock_setpend(td, false); + +#ifdef KTRACE + KTRUSERRET(td); +#endif /* * We need to check to see if we have to exit or wait due to a ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366337 - head/usr.sbin/ctld
Author: trasz Date: Thu Oct 1 18:56:44 2020 New Revision: 366337 URL: https://svnweb.freebsd.org/changeset/base/366337 Log: Don't ignore the return value from gethostname(3). It probably cannot happen, but it silences Coverity. Reviewed by: mav MFC after:2 weeks Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision:https://reviews.freebsd.org/D26606 Modified: head/usr.sbin/ctld/ctld.c Modified: head/usr.sbin/ctld/ctld.c == --- head/usr.sbin/ctld/ctld.c Thu Oct 1 18:45:31 2020(r366336) +++ head/usr.sbin/ctld/ctld.c Thu Oct 1 18:56:44 2020(r366337) @@ -931,7 +931,7 @@ void isns_register(struct isns *isns, struct isns *oldisns) { struct conf *conf = isns->i_conf; - int s; + int error, s; char hostname[256]; if (TAILQ_EMPTY(>conf_targets) || @@ -943,8 +943,10 @@ isns_register(struct isns *isns, struct isns *oldisns) set_timeout(0, false); return; } - gethostname(hostname, sizeof(hostname)); - + error = gethostname(hostname, sizeof(hostname)); + if (error != 0) + log_err(1, "gethostname"); + if (oldisns == NULL || TAILQ_EMPTY(>i_conf->conf_targets)) oldisns = isns; isns_do_deregister(oldisns, s, hostname); @@ -957,7 +959,7 @@ void isns_check(struct isns *isns) { struct conf *conf = isns->i_conf; - int s, res; + int error, s, res; char hostname[256]; if (TAILQ_EMPTY(>conf_targets) || @@ -969,8 +971,10 @@ isns_check(struct isns *isns) set_timeout(0, false); return; } - gethostname(hostname, sizeof(hostname)); - + error = gethostname(hostname, sizeof(hostname)); + if (error != 0) + log_err(1, "gethostname"); + res = isns_do_check(isns, s, hostname); if (res < 0) { isns_do_deregister(isns, s, hostname); @@ -984,7 +988,7 @@ void isns_deregister(struct isns *isns) { struct conf *conf = isns->i_conf; - int s; + int error, s; char hostname[256]; if (TAILQ_EMPTY(>conf_targets) || @@ -994,8 +998,10 @@ isns_deregister(struct isns *isns) s = isns_do_connect(isns); if (s < 0) return; - gethostname(hostname, sizeof(hostname)); - + error = gethostname(hostname, sizeof(hostname)); + if (error != 0) + log_err(1, "gethostname"); + isns_do_deregister(isns, s, hostname); close(s); set_timeout(0, false); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366336 - head/sys/kern
Author: trasz Date: Thu Oct 1 18:45:31 2020 New Revision: 366336 URL: https://svnweb.freebsd.org/changeset/base/366336 Log: Only clear TDP_NERRNO when needed, ie when it's previously been set. Reviewed by: kib Tested by:pho Sponsored by: DARPA Differential Revision:https://reviews.freebsd.org/D26612 Modified: head/sys/kern/subr_syscall.c Modified: head/sys/kern/subr_syscall.c == --- head/sys/kern/subr_syscall.cThu Oct 1 18:17:56 2020 (r366335) +++ head/sys/kern/subr_syscall.cThu Oct 1 18:45:31 2020 (r366336) @@ -138,7 +138,8 @@ syscallenter(struct thread *td) (void)sigfastblock_fetch(td); /* Let system calls set td_errno directly. */ - td->td_pflags &= ~TDP_NERRNO; + KASSERT((td->td_pflags & TDP_NERRNO) == 0, + ("%s: TDP_NERRNO set", __func__)); if (__predict_false(SYSTRACE_ENABLED() || AUDIT_SYSCALL_ENTER(sa->code, td))) { @@ -149,7 +150,9 @@ syscallenter(struct thread *td) #endif error = (sa->callp->sy_call)(td, sa->args); /* Save the latest error return value. */ - if (__predict_false((td->td_pflags & TDP_NERRNO) == 0)) + if (__predict_false((td->td_pflags & TDP_NERRNO) != 0)) + td->td_pflags &= ~TDP_NERRNO; + else td->td_errno = error; AUDIT_SYSCALL_EXIT(error, td); #ifdef KDTRACE_HOOKS @@ -161,7 +164,9 @@ syscallenter(struct thread *td) } else { error = (sa->callp->sy_call)(td, sa->args); /* Save the latest error return value. */ - if (__predict_false((td->td_pflags & TDP_NERRNO) == 0)) + if (__predict_false((td->td_pflags & TDP_NERRNO) != 0)) + td->td_pflags &= ~TDP_NERRNO; + else td->td_errno = error; } syscall_thread_exit(td, sa->callp); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366251 - head/sys/conf
Author: trasz Date: Tue Sep 29 11:48:22 2020 New Revision: 366251 URL: https://svnweb.freebsd.org/changeset/base/366251 Log: Build debug kernels with -O2. LLVM 11 changed the meaning of '-O' from '-O2' to '-O1', which resulted in debug kernels (with 'makeoptions DEBUG=-g') being built with inlining disabled, causing severe performance hit. The -O2 was already being used for building amd64, powerpc, and powerpcspe. Discussed with: jrtc27, arichardson, bdragon, jhibbits Sponsored by: DARPA Differential Revision:https://reviews.freebsd.org/D26471 Modified: head/sys/conf/kern.pre.mk Modified: head/sys/conf/kern.pre.mk == --- head/sys/conf/kern.pre.mk Tue Sep 29 11:18:48 2020(r366250) +++ head/sys/conf/kern.pre.mk Tue Sep 29 11:48:22 2020(r366251) @@ -51,25 +51,14 @@ OBJCOPY?= objcopy SIZE?= size .if defined(DEBUG) -.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpcspe" -# Work around clang 11 miscompile on 32 bit powerpc. -_MINUS_O= -O2 -.else -_MINUS_O= -O -.endif CTFFLAGS+= -g -.else -_MINUS_O= -O2 .endif -.if ${MACHINE_CPUARCH} == "amd64" -.if ${COMPILER_TYPE} == "clang" -COPTFLAGS?=-O2 -pipe +.if ${MACHINE_CPUARCH} == "amd64" && ${COMPILER_TYPE} != "clang" +_COPTFLAGS_EXTRA=-frename-registers .else -COPTFLAGS?=-O2 -frename-registers -pipe +_COPTFLAGS_EXTRA= .endif -.else -COPTFLAGS?=${_MINUS_O} -pipe -.endif +COPTFLAGS?=-O2 -pipe ${_COPTFLAGS_EXTRA} .if !empty(COPTFLAGS:M-O[23s]) && empty(COPTFLAGS:M-fno-strict-aliasing) COPTFLAGS+= -fno-strict-aliasing .endif ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366250 - head/sys/kern
Author: trasz Date: Tue Sep 29 11:18:48 2020 New Revision: 366250 URL: https://svnweb.freebsd.org/changeset/base/366250 Log: Use the 'traced' variable instead of comparing p->p_flag again. Reviewed by: kib Sponsored by: DARPA Differential Revision:https://reviews.freebsd.org/D26577 Modified: head/sys/kern/subr_syscall.c Modified: head/sys/kern/subr_syscall.c == --- head/sys/kern/subr_syscall.cTue Sep 29 10:07:46 2020 (r366249) +++ head/sys/kern/subr_syscall.cTue Sep 29 11:18:48 2020 (r366250) @@ -90,7 +90,7 @@ syscallenter(struct thread *td) goto retval; } - if (__predict_false((p->p_flag & P_TRACED) != 0)) { + if (__predict_false(traced)) { PROC_LOCK(p); if (p->p_ptevents & PTRACE_SCE) ptracestop((td), SIGTRAP, NULL); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366205 - in head/sys: amd64/amd64 amd64/cloudabi32 amd64/cloudabi64 amd64/ia32 amd64/include amd64/linux amd64/linux32 arm/arm arm/cloudabi32 arm/include arm64/arm64 arm64/cloudabi32 a...
Author: trasz Date: Sun Sep 27 18:47:06 2020 New Revision: 366205 URL: https://svnweb.freebsd.org/changeset/base/366205 Log: Get rid of sa->narg. It serves no purpose; use sa->callp->sy_narg instead. Reviewed by: kib Sponsored by: DARPA Differential Revision:https://reviews.freebsd.org/D26458 Modified: head/sys/amd64/amd64/trap.c head/sys/amd64/cloudabi32/cloudabi32_sysvec.c head/sys/amd64/cloudabi64/cloudabi64_sysvec.c head/sys/amd64/ia32/ia32_syscall.c head/sys/amd64/include/proc.h head/sys/amd64/linux/linux_sysvec.c head/sys/amd64/linux32/linux32_sysvec.c head/sys/arm/arm/syscall.c head/sys/arm/cloudabi32/cloudabi32_sysvec.c head/sys/arm/include/proc.h head/sys/arm64/arm64/elf32_machdep.c head/sys/arm64/arm64/trap.c head/sys/arm64/cloudabi32/cloudabi32_sysvec.c head/sys/arm64/cloudabi64/cloudabi64_sysvec.c head/sys/arm64/include/proc.h head/sys/arm64/linux/linux_sysvec.c head/sys/i386/cloudabi32/cloudabi32_sysvec.c head/sys/i386/i386/trap.c head/sys/i386/include/proc.h head/sys/i386/linux/linux_sysvec.c head/sys/kern/kern_thread.c head/sys/kern/subr_syscall.c head/sys/kern/sys_process.c head/sys/mips/include/proc.h head/sys/mips/mips/trap.c head/sys/powerpc/include/proc.h head/sys/powerpc/powerpc/trap.c head/sys/riscv/include/proc.h head/sys/riscv/riscv/trap.c Modified: head/sys/amd64/amd64/trap.c == --- head/sys/amd64/amd64/trap.c Sun Sep 27 18:39:15 2020(r366204) +++ head/sys/amd64/amd64/trap.c Sun Sep 27 18:47:06 2020(r366205) @@ -999,15 +999,15 @@ cpu_fetch_syscall_args_fallback(struct thread *td, str else sa->callp = >p_sysent->sv_table[sa->code]; - sa->narg = sa->callp->sy_narg; - KASSERT(sa->narg <= nitems(sa->args), ("Too many syscall arguments!")); + KASSERT(sa->callp->sy_narg <= nitems(sa->args), + ("Too many syscall arguments!")); argp = >tf_rdi; argp += reg; memcpy(sa->args, argp, sizeof(sa->args[0]) * NARGREGS); - if (sa->narg > regcnt) { + if (sa->callp->sy_narg > regcnt) { params = (caddr_t)frame->tf_rsp + sizeof(register_t); error = copyin(params, >args[regcnt], - (sa->narg - regcnt) * sizeof(sa->args[0])); + (sa->callp->sy_narg - regcnt) * sizeof(sa->args[0])); if (__predict_false(error != 0)) return (error); } @@ -1037,10 +1037,10 @@ cpu_fetch_syscall_args(struct thread *td) return (cpu_fetch_syscall_args_fallback(td, sa)); sa->callp = >p_sysent->sv_table[sa->code]; - sa->narg = sa->callp->sy_narg; - KASSERT(sa->narg <= nitems(sa->args), ("Too many syscall arguments!")); + KASSERT(sa->callp->sy_narg <= nitems(sa->args), + ("Too many syscall arguments!")); - if (__predict_false(sa->narg > NARGREGS)) + if (__predict_false(sa->callp->sy_narg > NARGREGS)) return (cpu_fetch_syscall_args_fallback(td, sa)); memcpy(sa->args, >tf_rdi, sizeof(sa->args[0]) * NARGREGS); Modified: head/sys/amd64/cloudabi32/cloudabi32_sysvec.c == --- head/sys/amd64/cloudabi32/cloudabi32_sysvec.c Sun Sep 27 18:39:15 2020(r366204) +++ head/sys/amd64/cloudabi32/cloudabi32_sysvec.c Sun Sep 27 18:47:06 2020(r366205) @@ -104,7 +104,6 @@ cloudabi32_fetch_syscall_args(struct thread *td) if (sa->code >= CLOUDABI32_SYS_MAXSYSCALL) return (ENOSYS); sa->callp = _sysent[sa->code]; - sa->narg = sa->callp->sy_narg; /* * Fetch system call arguments. @@ -117,7 +116,7 @@ cloudabi32_fetch_syscall_args(struct thread *td) * implementation used by 64-bit processes. */ error = copyin((void *)frame->tf_rcx, sa->args, - sa->narg * sizeof(sa->args[0])); + sa->callp->sy_narg * sizeof(sa->args[0])); if (error != 0) return (error); Modified: head/sys/amd64/cloudabi64/cloudabi64_sysvec.c == --- head/sys/amd64/cloudabi64/cloudabi64_sysvec.c Sun Sep 27 18:39:15 2020(r366204) +++ head/sys/amd64/cloudabi64/cloudabi64_sysvec.c Sun Sep 27 18:47:06 2020(r366205) @@ -101,7 +101,6 @@ cloudabi64_fetch_syscall_args(struct thread *td) if (sa->code >= CLOUDABI64_SYS_MAXSYSCALL) return (ENOSYS); sa->callp = _sysent[sa->code]; - sa->narg = sa->callp->sy_narg; /* Fetch system call arguments. */ sa->args[0] = frame->tf_rdi; Modified: head/sys/amd64/ia32/ia32_syscall.c == --- head/sys/amd64/ia32/ia32_syscall.c Sun Sep 27 18:39:15
svn commit: r366201 - head/sys/sys
Author: trasz Date: Sun Sep 27 18:14:01 2020 New Revision: 366201 URL: https://svnweb.freebsd.org/changeset/base/366201 Log: Shrink struct sysent from 48 to 32 bytes (on LP64; on ILP32 its probably from 32 to 28) by shrinking some entries and reordering them. Reviewed by: kib Sponsored by: DARPA Differential Revision:https://reviews.freebsd.org/D26508 Modified: head/sys/sys/sysent.h Modified: head/sys/sys/sysent.h == --- head/sys/sys/sysent.h Sun Sep 27 16:15:03 2020(r366200) +++ head/sys/sys/sysent.h Sun Sep 27 18:14:01 2020(r366201) @@ -65,14 +65,14 @@ extern bool systrace_enabled; #endif /* _KERNEL */ struct sysent {/* system call table */ - int sy_narg;/* number of arguments */ sy_call_t *sy_call; /* implementing function */ - au_event_t sy_auevent; /* audit event associated with syscall */ systrace_args_func_t sy_systrace_args_func; /* optional argument conversion function. */ + u_int8_t sy_narg; /* number of arguments */ + u_int8_t sy_flags; /* General flags for system calls. */ + au_event_t sy_auevent; /* audit event associated with syscall */ u_int32_t sy_entry; /* DTrace entry ID for systrace. */ u_int32_t sy_return;/* DTrace return ID for systrace. */ - u_int32_t sy_flags; /* General flags for system calls. */ u_int32_t sy_thrcnt; }; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366147 - in head/sys: amd64/linux amd64/linux32 arm/linux arm64/linux compat/cloudabi32 compat/cloudabi64 compat/freebsd32 i386/linux kern sys
Author: trasz Date: Fri Sep 25 10:05:38 2020 New Revision: 366147 URL: https://svnweb.freebsd.org/changeset/base/366147 Log: Regen after r366145. Sponsored by: DARPA Modified: head/sys/amd64/linux/linux_proto.h head/sys/amd64/linux/linux_sysent.c head/sys/amd64/linux32/linux32_proto.h head/sys/amd64/linux32/linux32_sysent.c head/sys/arm/linux/linux_proto.h head/sys/arm/linux/linux_sysent.c head/sys/arm64/linux/linux_proto.h head/sys/arm64/linux/linux_sysent.c head/sys/compat/cloudabi32/cloudabi32_proto.h head/sys/compat/cloudabi32/cloudabi32_sysent.c head/sys/compat/cloudabi64/cloudabi64_proto.h head/sys/compat/cloudabi64/cloudabi64_sysent.c head/sys/compat/freebsd32/freebsd32_proto.h head/sys/compat/freebsd32/freebsd32_sysent.c head/sys/i386/linux/linux_proto.h head/sys/i386/linux/linux_sysent.c head/sys/kern/init_sysent.c head/sys/sys/sysproto.h Modified: head/sys/amd64/linux/linux_proto.h == --- head/sys/amd64/linux/linux_proto.h Fri Sep 25 09:56:50 2020 (r366146) +++ head/sys/amd64/linux/linux_proto.h Fri Sep 25 10:05:38 2020 (r366147) @@ -1615,35 +1615,41 @@ int linux_io_uring_register(struct thread *, struct li #endif /* COMPAT_43 */ + #ifdef COMPAT_FREEBSD4 #definenosys linux_nosys #endif /* COMPAT_FREEBSD4 */ + #ifdef COMPAT_FREEBSD6 #definenosys linux_nosys #endif /* COMPAT_FREEBSD6 */ + #ifdef COMPAT_FREEBSD7 #definenosys linux_nosys #endif /* COMPAT_FREEBSD7 */ + #ifdef COMPAT_FREEBSD10 #definenosys linux_nosys #endif /* COMPAT_FREEBSD10 */ + #ifdef COMPAT_FREEBSD11 #definenosys linux_nosys #endif /* COMPAT_FREEBSD11 */ + #ifdef COMPAT_FREEBSD12 Modified: head/sys/amd64/linux/linux_sysent.c == --- head/sys/amd64/linux/linux_sysent.c Fri Sep 25 09:56:50 2020 (r366146) +++ head/sys/amd64/linux/linux_sysent.c Fri Sep 25 10:05:38 2020 (r366147) @@ -17,433 +17,433 @@ /* The casts are bogus but will do for now. */ struct sysent linux_sysent[] = { #definenosys linux_nosys - { AS(read_args), (sy_call_t *)sys_read, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 0 = read */ - { AS(write_args), (sy_call_t *)sys_write, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 1 = write */ - { AS(linux_open_args), (sy_call_t *)linux_open, AUE_OPEN_RWTC, NULL, 0, 0, 0, SY_THR_STATIC }, /* 2 = linux_open */ - { AS(close_args), (sy_call_t *)sys_close, AUE_CLOSE, NULL, 0, 0, 0, SY_THR_STATIC },/* 3 = close */ - { AS(linux_newstat_args), (sy_call_t *)linux_newstat, AUE_STAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 4 = linux_newstat */ - { AS(linux_newfstat_args), (sy_call_t *)linux_newfstat, AUE_FSTAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 5 = linux_newfstat */ - { AS(linux_newlstat_args), (sy_call_t *)linux_newlstat, AUE_LSTAT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 6 = linux_newlstat */ - { AS(poll_args), (sy_call_t *)sys_poll, AUE_POLL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 7 = poll */ - { AS(linux_lseek_args), (sy_call_t *)linux_lseek, AUE_LSEEK, NULL, 0, 0, 0, SY_THR_STATIC },/* 8 = linux_lseek */ - { AS(linux_mmap2_args), (sy_call_t *)linux_mmap2, AUE_MMAP, NULL, 0, 0, 0, SY_THR_STATIC }, /* 9 = linux_mmap2 */ - { AS(linux_mprotect_args), (sy_call_t *)linux_mprotect, AUE_MPROTECT, NULL, 0, 0, 0, SY_THR_STATIC }, /* 10 = linux_mprotect */ - { AS(munmap_args), (sy_call_t *)sys_munmap, AUE_MUNMAP, NULL, 0, 0, 0, SY_THR_STATIC }, /* 11 = munmap */ - { AS(linux_brk_args), (sy_call_t *)linux_brk, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 12 = linux_brk */ - { AS(linux_rt_sigaction_args), (sy_call_t *)linux_rt_sigaction, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 13 = linux_rt_sigaction */ - { AS(linux_rt_sigprocmask_args), (sy_call_t *)linux_rt_sigprocmask, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 14 = linux_rt_sigprocmask */ - { AS(linux_rt_sigreturn_args), (sy_call_t *)linux_rt_sigreturn, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 15 = linux_rt_sigreturn */ - { AS(linux_ioctl_args), (sy_call_t *)linux_ioctl, AUE_IOCTL, NULL, 0, 0, 0, SY_THR_STATIC },/* 16 = linux_ioctl */ - { AS(linux_pread_args), (sy_call_t *)linux_pread, AUE_PREAD, NULL, 0, 0, 0, SY_THR_STATIC },/* 17 = linux_pread */ - { AS(linux_pwrite_args), (sy_call_t *)linux_pwrite, AUE_PWRITE, NULL, 0, 0, 0, SY_THR_STATIC }, /* 18 = linux_pwrite */ - { AS(readv_args), (sy_call_t *)sys_readv, AUE_READV, NULL, 0, 0, 0, SY_THR_STATIC },/* 19 = readv */ - { AS(writev_args), (sy_call_t *)sys_writev, AUE_WRITEV, NULL, 0, 0, 0, SY_THR_STATIC }, /* 20 = writev */ - { AS(linux_access_args), (sy_call_t *)linux_access,
svn commit: r366145 - head/sys/tools
Author: trasz Date: Fri Sep 25 09:34:00 2020 New Revision: 366145 URL: https://svnweb.freebsd.org/changeset/base/366145 Log: Make makesyscalls.lua initialize 'struct sysent' entries using c99 designated initializers. This makes it easier to modify 'struct sysent' layout. Reviewed by: kevans Sponsored by: DARPA Differential Revision:https://reviews.freebsd.org/D26530 Modified: head/sys/tools/makesyscalls.lua Modified: head/sys/tools/makesyscalls.lua == --- head/sys/tools/makesyscalls.lua Fri Sep 25 07:55:08 2020 (r366144) +++ head/sys/tools/makesyscalls.lua Fri Sep 25 09:34:00 2020 (r366145) @@ -740,12 +740,14 @@ local function handle_noncompat(sysnum, thr_flag, flag config['syscallprefix'], funcalias, auditev)) end - write_line("sysent", string.format("\t{ %s, (sy_call_t *)", argssize)) + write_line("sysent", + string.format("\t{ .sy_narg = %s, .sy_call = (sy_call_t *)", argssize)) local column = 8 + 2 + #argssize + 15 if flags & known_flags["NOSTD"] ~= 0 then write_line("sysent", string.format( - "lkmressys, AUE_NULL, NULL, 0, 0, %s, SY_THR_ABSENT },", + "lkmressys, .sy_auevent = AUE_NULL, " .. + ".sy_flags = %s, .sy_thrcnt = SY_THR_ABSENT },", sysflags)) column = column + #"lkmressys" + #"AUE_NULL" + 3 else @@ -754,12 +756,12 @@ local function handle_noncompat(sysnum, thr_flag, flag funcname:find("^linux") or funcname:find("^cloudabi") then write_line("sysent", string.format( - "%s, %s, NULL, 0, 0, %s, %s },", + "%s, .sy_auevent = %s, .sy_flags = %s, .sy_thrcnt = %s },", funcname, auditev, sysflags, thr_flag)) column = column + #funcname + #auditev + #sysflags + 3 else write_line("sysent", string.format( - "sys_%s, %s, NULL, 0, 0, %s, %s },", + "sys_%s, .sy_auevent = %s, .sy_flags = %s, .sy_thrcnt = %s },", funcname, auditev, sysflags, thr_flag)) column = column + #funcname + #auditev + #sysflags + 7 end @@ -781,7 +783,8 @@ end local function handle_obsol(sysnum, funcname, comment) write_line("sysent", - "\t{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },") + "\t{ .sy_narg = 0, .sy_call = (sy_call_t *)nosys, " .. + ".sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT },") align_sysent_comment(34) write_line("sysent", string.format("/* %d = obsolete %s */\n", @@ -849,13 +852,15 @@ local function handle_compat(sysnum, thr_flag, flags, if flags & known_flags['NOSTD'] ~= 0 then write_line("sysent", string.format( - "\t{ %s, (sy_call_t *)%s, %s, NULL, 0, 0, 0, SY_THR_ABSENT },", + "\t{ .sy_narg = %s, .sy_call = (sy_call_t *)%s, " .. + ".sy_auevent = %s, .sy_flags = 0, " .. + ".sy_thrcnt = SY_THR_ABSENT },", "0", "lkmressys", "AUE_NULL")) align_sysent_comment(8 + 2 + #"0" + 15 + #"lkmressys" + #"AUE_NULL" + 3) else write_line("sysent", string.format( - "\t{ %s(%s,%s), %s, NULL, 0, 0, %s, %s },", + "\t{ %s(%s,%s), .sy_auevent = %s, .sy_flags = %s, .sy_thrcnt = %s },", wrap, argssize, funcname, auditev, sysflags, thr_flag)) align_sysent_comment(8 + 9 + #argssize + 1 + #funcname + #auditev + #sysflags + 4) @@ -889,7 +894,9 @@ local function handle_unimpl(sysnum, sysstart, sysend, sysnum = sysstart while sysnum <= sysend do write_line("sysent", string.format( - "\t{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT },\t\t\t/* %d = %s */\n", + "\t{ .sy_narg = 0, .sy_call = (sy_call_t *)nosys, " .. + ".sy_auevent = AUE_NULL, .sy_flags = 0, " .. + ".sy_thrcnt = SY_THR_ABSENT },\t\t\t/* %d = %s */\n", sysnum, comment)) write_line("sysnames", string.format( "\t\"#%d\",\t\t\t/* %d = %s */\n", @@ -1302,9 +1309,9 @@ for _, v in pairs(compat_options) do write_line("sysinc", string.format([[ #ifdef %s -#define %s(n, name) n, (sy_call_t *)__CONCAT(%s,name) +#define %s(n, name) .sy_narg = n, .sy_call = (sy_call_t *)__CONCAT(%s,name) #else -#define %s(n, name) 0, (sy_call_t *)nosys +#define %s(n, name) .sy_narg = 0, .sy_call = (sy_call_t *)nosys
svn commit: r365834 - head/sys/compat/linux
Author: trasz Date: Thu Sep 17 12:14:24 2020 New Revision: 365834 URL: https://svnweb.freebsd.org/changeset/base/365834 Log: Reduce code duplication by introducing linux_copyout_sockaddr() helper function. No functional changes. Reviewed by: emaste MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D25804 Modified: head/sys/compat/linux/linux_socket.c Modified: head/sys/compat/linux/linux_socket.c == --- head/sys/compat/linux/linux_socket.cThu Sep 17 11:44:45 2020 (r365833) +++ head/sys/compat/linux/linux_socket.cThu Sep 17 12:14:24 2020 (r365834) @@ -394,6 +394,22 @@ linux_set_socket_flags(int lflags, int *flags) } static int +linux_copyout_sockaddr(const struct sockaddr *sa, void *uaddr, size_t len) +{ + struct l_sockaddr *lsa; + int error; + + error = bsd_to_linux_sockaddr(sa, , len); + if (error != 0) + return (error); + + error = copyout(lsa, uaddr, len); + free(lsa, M_SONAME); + + return (error); +} + +static int linux_sendit(struct thread *td, int s, struct msghdr *mp, int flags, struct mbuf *control, enum uio_seg segflg) { @@ -609,7 +625,6 @@ static int linux_accept_common(struct thread *td, int s, l_uintptr_t addr, l_uintptr_t namelen, int flags) { - struct l_sockaddr *lsa; struct sockaddr *sa; struct file *fp, *fp1; int bflags, len; @@ -665,10 +680,7 @@ linux_accept_common(struct thread *td, int s, l_uintpt } if (len != 0) { - error = bsd_to_linux_sockaddr(sa, , len); - if (error == 0) - error = copyout(lsa, PTRIN(addr), len); - free(lsa, M_SONAME); + error = linux_copyout_sockaddr(sa, PTRIN(addr), len); /* * XXX: We should also copyout the len, shouldn't we? @@ -704,7 +716,6 @@ linux_accept4(struct thread *td, struct linux_accept4_ int linux_getsockname(struct thread *td, struct linux_getsockname_args *args) { - struct l_sockaddr *lsa; struct sockaddr *sa; int len, error; @@ -716,13 +727,8 @@ linux_getsockname(struct thread *td, struct linux_gets if (error != 0) return (error); - if (len != 0) { - error = bsd_to_linux_sockaddr(sa, , len); - if (error == 0) - error = copyout(lsa, PTRIN(args->addr), - len); - free(lsa, M_SONAME); - } + if (len != 0) + error = linux_copyout_sockaddr(sa, PTRIN(args->addr), len); free(sa, M_SONAME); if (error == 0) @@ -733,7 +739,6 @@ linux_getsockname(struct thread *td, struct linux_gets int linux_getpeername(struct thread *td, struct linux_getpeername_args *args) { - struct l_sockaddr *lsa; struct sockaddr *sa; int len, error; @@ -747,13 +752,8 @@ linux_getpeername(struct thread *td, struct linux_getp if (error != 0) return (error); - if (len != 0) { - error = bsd_to_linux_sockaddr(sa, , len); - if (error == 0) - error = copyout(lsa, PTRIN(args->addr), - len); - free(lsa, M_SONAME); - } + if (len != 0) + error = linux_copyout_sockaddr(sa, PTRIN(args->addr), len); free(sa, M_SONAME); if (error == 0) @@ -895,7 +895,6 @@ linux_sendto(struct thread *td, struct linux_sendto_ar int linux_recvfrom(struct thread *td, struct linux_recvfrom_args *args) { - struct l_sockaddr *lsa; struct sockaddr *sa; struct msghdr msg; struct iovec aiov; @@ -927,13 +926,8 @@ linux_recvfrom(struct thread *td, struct linux_recvfro if (error != 0) goto out; - if (PTRIN(args->from) != NULL) { - error = bsd_to_linux_sockaddr(sa, , msg.msg_namelen); - if (error == 0) - error = copyout(lsa, PTRIN(args->from), - msg.msg_namelen); - free(lsa, M_SONAME); - } + if (PTRIN(args->from) != NULL) + error = linux_copyout_sockaddr(sa, PTRIN(args->from), msg.msg_namelen); if (error == 0 && PTRIN(args->fromlen) != NULL) error = copyout(_namelen, PTRIN(args->fromlen), @@ -1170,7 +1164,6 @@ 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; @@ -1216,11 +1209,8 @@ linux_recvmsg_common(struct thread *td, l_int s, struc */ if (msg->msg_name != NULL && msg->msg_namelen > 0) {
svn commit: r365833 - head/sys/compat/linux
Author: trasz Date: Thu Sep 17 11:44:45 2020 New Revision: 365833 URL: https://svnweb.freebsd.org/changeset/base/365833 Log: Add support for SOUND_MIXER_WRITE_MONITOR ioctl. Fixes alsamixer(1) on my x220. Reviewed by: emaste MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D25806 Modified: head/sys/compat/linux/linux_ioctl.c head/sys/compat/linux/linux_ioctl.h Modified: head/sys/compat/linux/linux_ioctl.c == --- head/sys/compat/linux/linux_ioctl.c Thu Sep 17 11:39:33 2020 (r365832) +++ head/sys/compat/linux/linux_ioctl.c Thu Sep 17 11:44:45 2020 (r365833) @@ -1794,6 +1794,10 @@ linux_ioctl_sound(struct thread *td, struct linux_ioct args->cmd = SETDIR(SOUND_MIXER_WRITE_LINE3); return (sys_ioctl(td, (struct ioctl_args *)args)); + case LINUX_SOUND_MIXER_WRITE_MONITOR: + args->cmd = SETDIR(SOUND_MIXER_WRITE_MONITOR); + return (sys_ioctl(td, (struct ioctl_args *)args)); + case LINUX_SOUND_MIXER_INFO: { /* Key on encoded length */ switch ((args->cmd >> 16) & 0x1fff) { Modified: head/sys/compat/linux/linux_ioctl.h == --- head/sys/compat/linux/linux_ioctl.h Thu Sep 17 11:39:33 2020 (r365832) +++ head/sys/compat/linux/linux_ioctl.h Thu Sep 17 11:44:45 2020 (r365833) @@ -278,6 +278,7 @@ #defineLINUX_SOUND_MIXER_WRITE_LINE1 0x4d0E #defineLINUX_SOUND_MIXER_WRITE_LINE2 0x4d0F #defineLINUX_SOUND_MIXER_WRITE_LINE3 0x4d10 +#defineLINUX_SOUND_MIXER_WRITE_MONITOR 0x4d18 #defineLINUX_SOUND_MIXER_INFO 0x4d65 #defineLINUX_OSS_GETVERSION0x4d76 #defineLINUX_SOUND_MIXER_READ_STEREODEVS 0x4dfb ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r365832 - in head/sys: amd64/amd64 amd64/linux amd64/linux32 arm/arm arm64/arm64 arm64/linux compat/ia32 compat/linux i386/i386 i386/linux kern mips/mips powerpc/powerpc riscv/riscv sys
Author: trasz Date: Thu Sep 17 11:39:33 2020 New Revision: 365832 URL: https://svnweb.freebsd.org/changeset/base/365832 Log: Get rid of sv_errtbl and SV_ABI_ERRNO(). Reviewed by: kib Sponsored by: DARPA Differential Revision:https://reviews.freebsd.org/D26388 Modified: head/sys/amd64/amd64/elf_machdep.c head/sys/amd64/linux/linux_sysvec.c head/sys/amd64/linux32/linux32_sysvec.c head/sys/arm/arm/elf_machdep.c head/sys/arm64/arm64/elf32_machdep.c head/sys/arm64/arm64/elf_machdep.c head/sys/arm64/linux/linux_sysvec.c head/sys/compat/ia32/ia32_sysvec.c head/sys/compat/linux/linux.h head/sys/compat/linux/linux_errno.c head/sys/compat/linux/linux_socket.c head/sys/i386/i386/elf_machdep.c head/sys/i386/linux/linux_sysvec.c head/sys/kern/imgact_aout.c head/sys/kern/init_main.c head/sys/mips/mips/elf_machdep.c head/sys/mips/mips/freebsd32_machdep.c head/sys/powerpc/powerpc/elf32_machdep.c head/sys/powerpc/powerpc/elf64_machdep.c head/sys/riscv/riscv/elf_machdep.c head/sys/sys/sysent.h Modified: head/sys/amd64/amd64/elf_machdep.c == --- head/sys/amd64/amd64/elf_machdep.c Thu Sep 17 07:13:41 2020 (r365831) +++ head/sys/amd64/amd64/elf_machdep.c Thu Sep 17 11:39:33 2020 (r365832) @@ -52,8 +52,6 @@ __FBSDID("$FreeBSD$"); struct sysentvec elf64_freebsd_sysvec_la48 = { .sv_size= SYS_MAXSYSCALL, .sv_table = sysent, - .sv_errsize = 0, - .sv_errtbl = NULL, .sv_transtrap = NULL, .sv_fixup = __elfN(freebsd_fixup), .sv_sendsig = sendsig, @@ -89,8 +87,6 @@ struct sysentvec elf64_freebsd_sysvec_la48 = { struct sysentvec elf64_freebsd_sysvec_la57 = { .sv_size= SYS_MAXSYSCALL, .sv_table = sysent, - .sv_errsize = 0, - .sv_errtbl = NULL, .sv_transtrap = NULL, .sv_fixup = __elfN(freebsd_fixup), .sv_sendsig = sendsig, Modified: head/sys/amd64/linux/linux_sysvec.c == --- head/sys/amd64/linux/linux_sysvec.c Thu Sep 17 07:13:41 2020 (r365831) +++ head/sys/amd64/linux/linux_sysvec.c Thu Sep 17 11:39:33 2020 (r365832) @@ -221,7 +221,7 @@ linux_set_syscall_retval(struct thread *td, int error) if (__predict_false(error != 0)) { if (error != ERESTART && error != EJUSTRETURN) - frame->tf_rax = SV_ABI_ERRNO(td->td_proc, error); + frame->tf_rax = linux_to_bsd_errno(error); } /* Restore all registers. */ @@ -732,8 +732,6 @@ linux_vsyscall(struct thread *td) struct sysentvec elf_linux_sysvec = { .sv_size= LINUX_SYS_MAXSYSCALL, .sv_table = linux_sysent, - .sv_errsize = ELAST + 1, - .sv_errtbl = linux_errtbl, .sv_transtrap = linux_translate_traps, .sv_fixup = linux_fixup_elf, .sv_sendsig = linux_rt_sendsig, Modified: head/sys/amd64/linux32/linux32_sysvec.c == --- head/sys/amd64/linux32/linux32_sysvec.c Thu Sep 17 07:13:41 2020 (r365831) +++ head/sys/amd64/linux32/linux32_sysvec.c Thu Sep 17 11:39:33 2020 (r365832) @@ -679,7 +679,7 @@ linux32_set_syscall_retval(struct thread *td, int erro if (__predict_false(error != 0)) { if (error != ERESTART && error != EJUSTRETURN) - frame->tf_rax = SV_ABI_ERRNO(td->td_proc, error); + frame->tf_rax = linux_to_bsd_errno(error); } } @@ -898,8 +898,6 @@ linux32_fixlimit(struct rlimit *rl, int which) struct sysentvec elf_linux_sysvec = { .sv_size= LINUX32_SYS_MAXSYSCALL, .sv_table = linux32_sysent, - .sv_errsize = ELAST + 1, - .sv_errtbl = linux_errtbl, .sv_transtrap = linux_translate_traps, .sv_fixup = linux_fixup_elf, .sv_sendsig = linux_sendsig, Modified: head/sys/arm/arm/elf_machdep.c == --- head/sys/arm/arm/elf_machdep.c Thu Sep 17 07:13:41 2020 (r365831) +++ head/sys/arm/arm/elf_machdep.c Thu Sep 17 11:39:33 2020 (r365832) @@ -65,8 +65,6 @@ u_long elf_hwcap2; struct sysentvec elf32_freebsd_sysvec = { .sv_size= SYS_MAXSYSCALL, .sv_table = sysent, - .sv_errsize = 0, - .sv_errtbl = NULL, .sv_transtrap = NULL, .sv_fixup = __elfN(freebsd_fixup), .sv_sendsig = sendsig, Modified: head/sys/arm64/arm64/elf32_machdep.c == --- head/sys/arm64/arm64/elf32_machdep.cThu Sep 17 07:13:41 2020
svn commit: r365755 - in head/sys: amd64/amd64 amd64/linux amd64/linux32 arm/arm arm64/arm64 arm64/linux i386/i386 i386/linux powerpc/powerpc
Author: trasz Date: Tue Sep 15 16:41:21 2020 New Revision: 365755 URL: https://svnweb.freebsd.org/changeset/base/365755 Log: Move SV_ABI_ERRNO translation into linux-specific code, to simplify the syscall path and declutter it a bit. No functional changes intended. Reviewed by: kib (earlier version) MFC after:2 weeks Sponsored by: DARPA Differential Revision:https://reviews.freebsd.org/D26378 Modified: head/sys/amd64/amd64/vm_machdep.c head/sys/amd64/linux/linux_sysvec.c head/sys/amd64/linux32/linux32_sysvec.c head/sys/arm/arm/vm_machdep.c head/sys/arm64/arm64/vm_machdep.c head/sys/arm64/linux/linux_sysvec.c head/sys/i386/i386/vm_machdep.c head/sys/i386/linux/linux_sysvec.c head/sys/powerpc/powerpc/exec_machdep.c Modified: head/sys/amd64/amd64/vm_machdep.c == --- head/sys/amd64/amd64/vm_machdep.c Tue Sep 15 16:38:44 2020 (r365754) +++ head/sys/amd64/amd64/vm_machdep.c Tue Sep 15 16:41:21 2020 (r365755) @@ -543,7 +543,7 @@ cpu_set_syscall_retval(struct thread *td, int error) break; default: - frame->tf_rax = SV_ABI_ERRNO(td->td_proc, error); + frame->tf_rax = error; frame->tf_rflags |= PSL_C; break; } Modified: head/sys/amd64/linux/linux_sysvec.c == --- head/sys/amd64/linux/linux_sysvec.c Tue Sep 15 16:38:44 2020 (r365754) +++ head/sys/amd64/linux/linux_sysvec.c Tue Sep 15 16:41:21 2020 (r365755) @@ -219,6 +219,11 @@ linux_set_syscall_retval(struct thread *td, int error) cpu_set_syscall_retval(td, error); + if (__predict_false(error != 0)) { + if (error != ERESTART && error != EJUSTRETURN) + frame->tf_rax = SV_ABI_ERRNO(td->td_proc, error); + } + /* Restore all registers. */ set_pcb_flags(td->td_pcb, PCB_FULL_IRET); } Modified: head/sys/amd64/linux32/linux32_sysvec.c == --- head/sys/amd64/linux32/linux32_sysvec.c Tue Sep 15 16:38:44 2020 (r365754) +++ head/sys/amd64/linux32/linux32_sysvec.c Tue Sep 15 16:41:21 2020 (r365755) @@ -112,6 +112,7 @@ static void linux32_fixlimit(struct rlimit *rl, int wh static boollinux32_trans_osrel(const Elf_Note *note, int32_t *osrel); static voidlinux_vdso_install(void *param); static voidlinux_vdso_deinstall(void *param); +static voidlinux32_set_syscall_retval(struct thread *td, int error); #define LINUX_T_UNKNOWN 255 static int _bsd_to_linux_trapcode[] = { @@ -669,6 +670,19 @@ linux32_fetch_syscall_args(struct thread *td) return (0); } +static void +linux32_set_syscall_retval(struct thread *td, int error) +{ + struct trapframe *frame = td->td_frame; + + cpu_set_syscall_retval(td, error); + + if (__predict_false(error != 0)) { + if (error != ERESTART && error != EJUSTRETURN) + frame->tf_rax = SV_ABI_ERRNO(td->td_proc, error); + } +} + /* * Clear registers on exec * XXX copied from ia32_signal.c. @@ -906,7 +920,7 @@ struct sysentvec elf_linux_sysvec = { .sv_fixlimit= linux32_fixlimit, .sv_maxssiz = _maxssiz, .sv_flags = SV_ABI_LINUX | SV_ILP32 | SV_IA32 | SV_SHP, - .sv_set_syscall_retval = cpu_set_syscall_retval, + .sv_set_syscall_retval = linux32_set_syscall_retval, .sv_fetch_syscall_args = linux32_fetch_syscall_args, .sv_syscallnames = NULL, .sv_shared_page_base = LINUX32_SHAREDPAGE, Modified: head/sys/arm/arm/vm_machdep.c == --- head/sys/arm/arm/vm_machdep.c Tue Sep 15 16:38:44 2020 (r365754) +++ head/sys/arm/arm/vm_machdep.c Tue Sep 15 16:41:21 2020 (r365755) @@ -219,7 +219,7 @@ cpu_set_syscall_retval(struct thread *td, int error) /* nothing to do */ break; default: - frame->tf_r0 = SV_ABI_ERRNO(td->td_proc, error); + frame->tf_r0 = error; frame->tf_spsr |= PSR_C;/* carry bit */ break; } Modified: head/sys/arm64/arm64/vm_machdep.c == --- head/sys/arm64/arm64/vm_machdep.c Tue Sep 15 16:38:44 2020 (r365754) +++ head/sys/arm64/arm64/vm_machdep.c Tue Sep 15 16:41:21 2020 (r365755) @@ -153,7 +153,7 @@ cpu_set_syscall_retval(struct thread *td, int error) break; default: frame->tf_spsr |= PSR_C;/* carry bit */ - frame->tf_x[0] = SV_ABI_ERRNO(td->td_proc, error); + frame->tf_x[0] = error; break; }
svn commit: r365713 - in head: lib/libbe/tests sbin/bectl/tests
Author: trasz Date: Mon Sep 14 10:35:39 2020 New Revision: 365713 URL: https://svnweb.freebsd.org/changeset/base/365713 Log: Skip armv7 bectl tests on CI; they deadlock (""KSTACK_PAGES is 2"). PR: 249229 Sponsored by: DARPA Modified: head/lib/libbe/tests/be_create.sh head/sbin/bectl/tests/bectl_test.sh Modified: head/lib/libbe/tests/be_create.sh == --- head/lib/libbe/tests/be_create.sh Mon Sep 14 10:17:07 2020 (r365712) +++ head/lib/libbe/tests/be_create.sh Mon Sep 14 10:35:39 2020 (r365713) @@ -93,6 +93,11 @@ libbe_create_body() atf_skip "https://bugs.freebsd.org/249055; fi + if [ "$(atf_config_get ci false)" = "true" ] && \ + [ "$(uname -p)" = "armv7" ]; then + atf_skip "https://bugs.freebsd.org/249229; + fi + cwd=$(atf_get_srcdir) zpool=$(make_zpool_name) disk=${cwd}/disk.img Modified: head/sbin/bectl/tests/bectl_test.sh == --- head/sbin/bectl/tests/bectl_test.sh Mon Sep 14 10:17:07 2020 (r365712) +++ head/sbin/bectl/tests/bectl_test.sh Mon Sep 14 10:35:39 2020 (r365713) @@ -98,6 +98,11 @@ bectl_create_body() atf_skip "https://bugs.freebsd.org/249055; fi + if [ "$(atf_config_get ci false)" = "true" ] && \ + [ "$(uname -p)" = "armv7" ]; then + atf_skip "https://bugs.freebsd.org/249229; + fi + cwd=$(realpath .) zpool=$(make_zpool_name) disk=${cwd}/disk.img @@ -153,6 +158,11 @@ bectl_destroy_body() atf_skip "https://bugs.freebsd.org/249055; fi + if [ "$(atf_config_get ci false)" = "true" ] && \ + [ "$(uname -p)" = "armv7" ]; then + atf_skip "https://bugs.freebsd.org/249229; + fi + cwd=$(realpath .) zpool=$(make_zpool_name) disk=${cwd}/disk.img @@ -238,6 +248,11 @@ bectl_export_import_body() atf_skip "https://bugs.freebsd.org/249055; fi + if [ "$(atf_config_get ci false)" = "true" ] && \ + [ "$(uname -p)" = "armv7" ]; then + atf_skip "https://bugs.freebsd.org/249229; + fi + cwd=$(realpath .) zpool=$(make_zpool_name) disk=${cwd}/disk.img @@ -271,6 +286,11 @@ bectl_list_body() atf_skip "https://bugs.freebsd.org/249055; fi + if [ "$(atf_config_get ci false)" = "true" ] && \ + [ "$(uname -p)" = "armv7" ]; then + atf_skip "https://bugs.freebsd.org/249229; + fi + cwd=$(realpath .) zpool=$(make_zpool_name) disk=${cwd}/disk.img @@ -311,6 +331,11 @@ bectl_mount_body() atf_skip "https://bugs.freebsd.org/249055; fi + if [ "$(atf_config_get ci false)" = "true" ] && \ + [ "$(uname -p)" = "armv7" ]; then + atf_skip "https://bugs.freebsd.org/249229; + fi + cwd=$(realpath .) zpool=$(make_zpool_name) disk=${cwd}/disk.img @@ -350,6 +375,11 @@ bectl_rename_body() atf_skip "https://bugs.freebsd.org/249055; fi + if [ "$(atf_config_get ci false)" = "true" ] && \ + [ "$(uname -p)" = "armv7" ]; then + atf_skip "https://bugs.freebsd.org/249229; + fi + cwd=$(realpath .) zpool=$(make_zpool_name) disk=${cwd}/disk.img @@ -382,6 +412,11 @@ bectl_jail_body() atf_skip "https://bugs.freebsd.org/249055; fi + if [ "$(atf_config_get ci false)" = "true" ] && \ + [ "$(uname -p)" = "armv7" ]; then + atf_skip "https://bugs.freebsd.org/249229; + fi + cwd=$(realpath .) zpool=$(make_zpool_name) disk=${cwd}/disk.img @@ -455,6 +490,11 @@ bectl_jail_cleanup() if [ "$(atf_config_get ci false)" = "true" ] && \ [ "$(uname -p)" = "i386" ]; then atf_skip "https://bugs.freebsd.org/249055; + fi + + if [ "$(atf_config_get ci false)" = "true" ] && \ + [ "$(uname -p)" = "armv7" ]; then + atf_skip "https://bugs.freebsd.org/249229; fi zpool=$(get_zpool_name) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r365712 - head/sys/kern
Author: trasz Date: Mon Sep 14 10:17:07 2020 New Revision: 365712 URL: https://svnweb.freebsd.org/changeset/base/365712 Log: Move td_softdep_cleanup() from userret() to ast(); it's infrequent at best. The schedule_cleanup() function already sets TDF_ASTPENDING. Reviewed by: kib, mckusick Tested by:pho MFC after:2 weeks Sponsored by: DARPA Differential Revision:https://reviews.freebsd.org/D26375 Modified: head/sys/kern/subr_trap.c Modified: head/sys/kern/subr_trap.c == --- head/sys/kern/subr_trap.c Mon Sep 14 10:14:03 2020(r365711) +++ head/sys/kern/subr_trap.c Mon Sep 14 10:17:07 2020(r365712) @@ -134,9 +134,6 @@ userret(struct thread *td, struct trapframe *frame) KTRUSERRET(td); #endif - td_softdep_cleanup(td); - MPASS(td->td_su == NULL); - /* * Charge system time if profiling. */ @@ -188,8 +185,6 @@ userret(struct thread *td, struct trapframe *frame) ("userret: Returning with preallocated vnode")); KASSERT((td->td_flags & (TDF_SBDRY | TDF_SEINTR | TDF_SERESTART)) == 0, ("userret: Returning with stop signals deferred")); - KASSERT(td->td_su == NULL, - ("userret: Returning with SU cleanup request not handled")); KASSERT(td->td_vslock_sz == 0, ("userret: Returning with vslock-wired space")); #ifdef VIMAGE @@ -278,6 +273,9 @@ ast(struct trapframe *framep) ktrcsw(0, 1, __func__); #endif } + + td_softdep_cleanup(td); + MPASS(td->td_su == NULL); /* * If this thread tickled GEOM, we need to wait for the giggling to ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r365711 - in head/sys: geom kern
Author: trasz Date: Mon Sep 14 10:14:03 2020 New Revision: 365711 URL: https://svnweb.freebsd.org/changeset/base/365711 Log: Move TDP_GEOM check from userret() to ast(); this code path is quite infrequent. Reviewed by: kib No objections:mav Tested by:pho MFC after:2 weeks Sponsored by: DARPA Differential Revision:https://reviews.freebsd.org/D26374 Modified: head/sys/geom/geom_event.c head/sys/kern/subr_trap.c Modified: head/sys/geom/geom_event.c == --- head/sys/geom/geom_event.c Mon Sep 14 09:44:24 2020(r365710) +++ head/sys/geom/geom_event.c Mon Sep 14 10:14:03 2020(r365711) @@ -374,6 +374,9 @@ g_post_event_x(g_event_t *func, void *arg, int flag, i if (epp != NULL) *epp = ep; curthread->td_pflags |= TDP_GEOM; + thread_lock(curthread); + curthread->td_flags |= TDF_ASTPENDING; + thread_unlock(curthread); return (0); } Modified: head/sys/kern/subr_trap.c == --- head/sys/kern/subr_trap.c Mon Sep 14 09:44:24 2020(r365710) +++ head/sys/kern/subr_trap.c Mon Sep 14 10:14:03 2020(r365711) @@ -138,13 +138,6 @@ userret(struct thread *td, struct trapframe *frame) MPASS(td->td_su == NULL); /* -* If this thread tickled GEOM, we need to wait for the giggling to -* stop before we return to userland -*/ - if (__predict_false(td->td_pflags & TDP_GEOM)) - g_waitidle(); - - /* * Charge system time if profiling. */ if (__predict_false(p->p_flag & P_PROFIL)) @@ -285,6 +278,13 @@ ast(struct trapframe *framep) ktrcsw(0, 1, __func__); #endif } + + /* +* If this thread tickled GEOM, we need to wait for the giggling to +* stop before we return to userland +*/ + if (__predict_false(td->td_pflags & TDP_GEOM)) + g_waitidle(); #ifdef DIAGNOSTIC if (p->p_numthreads == 1 && (flags & TDF_NEEDSIGCHK) == 0) { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r365710 - head/sys/kern
Author: trasz Date: Mon Sep 14 09:44:24 2020 New Revision: 365710 URL: https://svnweb.freebsd.org/changeset/base/365710 Log: Move racct/rctl throttling from userret() to ast(). There's no reason for it to sit in the syscall fast path. Reviewed by: kib MFC after:2 weeks Sponsored by: DARPA Differential Revision:https://reviews.freebsd.org/D26368 Modified: head/sys/kern/kern_racct.c head/sys/kern/subr_trap.c Modified: head/sys/kern/kern_racct.c == --- head/sys/kern/kern_racct.c Mon Sep 14 08:59:16 2020(r365709) +++ head/sys/kern/kern_racct.c Mon Sep 14 09:44:24 2020(r365710) @@ -1146,6 +1146,8 @@ racct_proc_throttle(struct proc *p, int timeout) FOREACH_THREAD_IN_PROC(p, td) { thread_lock(td); + td->td_flags |= TDF_ASTPENDING; + switch (td->td_state) { case TDS_RUNQ: /* Modified: head/sys/kern/subr_trap.c == --- head/sys/kern/subr_trap.c Mon Sep 14 08:59:16 2020(r365709) +++ head/sys/kern/subr_trap.c Mon Sep 14 09:44:24 2020(r365710) @@ -206,10 +206,6 @@ userret(struct thread *td, struct trapframe *frame) __func__, td, p->p_pid, td->td_name, curvnet, (td->td_vnet_lpush != NULL) ? td->td_vnet_lpush : "N/A")); #endif -#ifdef RACCT - if (__predict_false(racct_enable && p->p_throttled != 0)) - racct_proc_throttled(p); -#endif } /* @@ -361,6 +357,11 @@ ast(struct trapframe *framep) td->td_pflags &= ~TDP_OLDMASK; kern_sigprocmask(td, SIG_SETMASK, >td_oldsigmask, NULL, 0); } + +#ifdef RACCT + if (__predict_false(racct_enable && p->p_throttled != 0)) + racct_proc_throttled(p); +#endif userret(td, framep); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r365042 - head/usr.sbin/ctld
Author: trasz Date: Tue Sep 1 14:58:57 2020 New Revision: 365042 URL: https://svnweb.freebsd.org/changeset/base/365042 Log: Make sure not to pass NULL to strtoul(3). The values come from the kernel, but let's try to be on the safe side. Reviewed by: mav MFC after:2 weeks Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision:https://reviews.freebsd.org/D26246 Modified: head/usr.sbin/ctld/kernel.c Modified: head/usr.sbin/ctld/kernel.c == --- head/usr.sbin/ctld/kernel.c Tue Sep 1 14:52:39 2020(r365041) +++ head/usr.sbin/ctld/kernel.c Tue Sep 1 14:58:57 2020(r365042) @@ -238,10 +238,16 @@ cctl_end_element(void *user_data, const char *name) cur_lun->backend_type = str; str = NULL; } else if (strcmp(name, "lun_type") == 0) { + if (str == NULL) + log_errx(1, "%s: %s missing its argument", __func__, name); cur_lun->device_type = strtoull(str, NULL, 0); } else if (strcmp(name, "size") == 0) { + if (str == NULL) + log_errx(1, "%s: %s missing its argument", __func__, name); cur_lun->size_blocks = strtoull(str, NULL, 0); } else if (strcmp(name, "blocksize") == 0) { + if (str == NULL) + log_errx(1, "%s: %s missing its argument", __func__, name); cur_lun->blocksize = strtoul(str, NULL, 0); } else if (strcmp(name, "serial_number") == 0) { cur_lun->serial_number = str; @@ -357,15 +363,23 @@ cctl_end_pelement(void *user_data, const char *name) cur_port->port_name = str; str = NULL; } else if (strcmp(name, "physical_port") == 0) { + if (str == NULL) + log_errx(1, "%s: %s missing its argument", __func__, name); cur_port->pp = strtoul(str, NULL, 0); } else if (strcmp(name, "virtual_port") == 0) { + if (str == NULL) + log_errx(1, "%s: %s missing its argument", __func__, name); cur_port->vp = strtoul(str, NULL, 0); } else if (strcmp(name, "cfiscsi_target") == 0) { cur_port->cfiscsi_target = str; str = NULL; } else if (strcmp(name, "cfiscsi_state") == 0) { + if (str == NULL) + log_errx(1, "%s: %s missing its argument", __func__, name); cur_port->cfiscsi_state = strtoul(str, NULL, 0); } else if (strcmp(name, "cfiscsi_portal_group_tag") == 0) { + if (str == NULL) + log_errx(1, "%s: %s missing its argument", __func__, name); cur_port->cfiscsi_portal_group_tag = strtoul(str, NULL, 0); } else if (strcmp(name, "ctld_portal_group_name") == 0) { cur_port->ctld_portal_group_name = str; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r365040 - head/usr.sbin/iscsid
Author: trasz Date: Tue Sep 1 14:52:35 2020 New Revision: 365040 URL: https://svnweb.freebsd.org/changeset/base/365040 Log: Fix string overflow that could occur during redirection due to passing the wrong length to strlcpy(3). It looks like it could overflow into the next field, isc_user, which is properly long to accomodate for it; I don't think it could cause any harm other than breaking the connection. Reviewed by: mav MFC after:2 weeks Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision:https://reviews.freebsd.org/D26247 Modified: head/usr.sbin/iscsid/login.c Modified: head/usr.sbin/iscsid/login.c == --- head/usr.sbin/iscsid/login.cTue Sep 1 14:50:43 2020 (r365039) +++ head/usr.sbin/iscsid/login.cTue Sep 1 14:52:35 2020 (r365040) @@ -170,7 +170,7 @@ kernel_modify(const struct connection *conn, const cha ism.ism_session_id = conn->conn_session_id; memcpy(_conf, >conn_conf, sizeof(ism.ism_conf)); strlcpy(ism.ism_conf.isc_target_addr, target_address, - sizeof(ism.ism_conf.isc_target)); + sizeof(ism.ism_conf.isc_target_addr)); error = ioctl(conn->conn_iscsi_fd, ISCSISMODIFY, ); if (error != 0) { log_err(1, "failed to redirect to %s: ISCSISMODIFY", ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363322 - head/sys/compat/linux
Author: trasz Date: Sun Jul 19 12:25:03 2020 New Revision: 363322 URL: https://svnweb.freebsd.org/changeset/base/363322 Log: Make linux(4) support the BLKPBSZGET ioctl. Oracle uses it. MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D25694 Modified: head/sys/compat/linux/linux_ioctl.c head/sys/compat/linux/linux_ioctl.h Modified: head/sys/compat/linux/linux_ioctl.c == --- head/sys/compat/linux/linux_ioctl.c Sun Jul 19 12:22:32 2020 (r363321) +++ head/sys/compat/linux/linux_ioctl.c Sun Jul 19 12:25:03 2020 (r363322) @@ -285,9 +285,9 @@ linux_ioctl_disk(struct thread *td, struct linux_ioctl { struct file *fp; int error; - u_int sectorsize; + u_int sectorsize, psectorsize; uint64_t blksize64; - off_t mediasize; + off_t mediasize, stripesize; error = fget(td, args->fd, _ioctl_rights, ); if (error != 0) @@ -327,6 +327,27 @@ linux_ioctl_disk(struct thread *td, struct linux_ioctl return (copyout(, (void *)args->arg, sizeof(sectorsize))); break; + case LINUX_BLKPBSZGET: + error = fo_ioctl(fp, DIOCGSTRIPESIZE, + (caddr_t), td->td_ucred, td); + if (error != 0) { + fdrop(fp, td); + return (error); + } + if (stripesize > 0 && stripesize <= 4096) { + psectorsize = stripesize; + } else { + error = fo_ioctl(fp, DIOCGSECTORSIZE, + (caddr_t), td->td_ucred, td); + if (error != 0) { + fdrop(fp, td); + return (error); + } + psectorsize = sectorsize; + } + fdrop(fp, td); + return (copyout(, (void *)args->arg, + sizeof(psectorsize))); } fdrop(fp, td); return (ENOIOCTL); Modified: head/sys/compat/linux/linux_ioctl.h == --- head/sys/compat/linux/linux_ioctl.h Sun Jul 19 12:22:32 2020 (r363321) +++ head/sys/compat/linux/linux_ioctl.h Sun Jul 19 12:25:03 2020 (r363322) @@ -58,9 +58,10 @@ #defineLINUX_BLKSECTGET0x1267 #defineLINUX_BLKSSZGET 0x1268 #defineLINUX_BLKGETSIZE64 0x1272 +#defineLINUX_BLKPBSZGET0x127b #define LINUX_IOCTL_DISK_MINLINUX_BLKROSET -#define LINUX_IOCTL_DISK_MAXLINUX_BLKGETSIZE64 +#define LINUX_IOCTL_DISK_MAXLINUX_BLKPBSZGET /* * hdio ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r353283 - in head: lib lib/libstats share/man/man3 share/mk sys/amd64/conf sys/conf sys/kern sys/sys tools/build/options
On 0714T0838, Kyle Evans wrote: > On Mon, Oct 7, 2019 at 2:05 PM Edward Tomasz Napierala > wrote: [..] > > Added: head/lib/libstats/Makefile > > == > > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > > +++ head/lib/libstats/Makefile Mon Oct 7 19:05:05 2019(r353283) > > @@ -0,0 +1,14 @@ > > +# $FreeBSD$ > > + > > +LIB= stats > > +SHLIBDIR?= /lib > > +SHLIB_MAJOR= 0 > > +SRCS= subr_stats.c > > + > > +# To debug, comment WITHOUT_ASSERT_DEBUG= and uncomment CFLAGS:= > > +WITHOUT_ASSERT_DEBUG= > > +#CFLAGS:=${CFLAGS:C/-O[0-9]/-O0 -g3/} -DDIAGNOSTIC > > + > > Hi, > > What exactly is going on here? mjg pointed this out when we were > looking at some runtime assertion related stuff. This looks like it's > imposing an opinion of how it should be built and circumvent the > normal way of doing things. Ideally, this would something more like > with the following patch to just make sure that the CFLAGS > manipulations properly happen when ASSERT_DEBUG is flipped on, and > interested parties that don't want the assertions should turn > ASSERT_DEBUG off. If there's a really really solid reason for libstats > having its own knob, that should be considered as a formal knob rather > than the ad-hockery that appears above. I'm not sure that the > following patch is entirely correct, though; -DDIAGNOSTIC seems to be > needed for assertions, but the -O$n replacement with -O0 -g3 looks > like it should perhaps be split out to a different knob or.. > something. The main chunk of stats(3) source is shared between libstats(3) and the kernel. Thus, DIAGNOSTICS means the same thing: it's not the usual assertions, but an additional debugging mechanism that's supposed to be off by default. Except that we don't have a global knob to turn "userland DIAGNOSTICS" on, so libstats(3) uses its own. We probably shouldn't be overriding WITHOUT_ASSERT_DEBUG, though. [..] ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363321 - head/share/man/man9
Author: trasz Date: Sun Jul 19 12:22:32 2020 New Revision: 363321 URL: https://svnweb.freebsd.org/changeset/base/363321 Log: Add missing bitset(9) MLINKS. MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D25713 Modified: head/share/man/man9/Makefile Modified: head/share/man/man9/Makefile == --- head/share/man/man9/MakefileSun Jul 19 10:53:15 2020 (r363320) +++ head/share/man/man9/MakefileSun Jul 19 12:22:32 2020 (r363321) @@ -607,13 +607,19 @@ MLINKS+=bitset.9 BITSET_DEFINE.9 \ bitset.9 BIT_EMPTY.9 \ bitset.9 BIT_ISFULLSET.9 \ bitset.9 BIT_FFS.9 \ + bitset.9 BIT_FLS.9 \ bitset.9 BIT_COUNT.9 \ bitset.9 BIT_SUBSET.9 \ bitset.9 BIT_OVERLAP.9 \ bitset.9 BIT_CMP.9 \ bitset.9 BIT_OR.9 \ + bitset.9 BIT_OR2.9 \ bitset.9 BIT_AND.9 \ + bitset.9 BIT_AND2.9 \ bitset.9 BIT_ANDNOT.9 \ + bitset.9 BIT_ANDNOT2.9 \ + bitset.9 BIT_XOR.9 \ + bitset.9 BIT_XOR2.9 \ bitset.9 BIT_CLR_ATOMIC.9 \ bitset.9 BIT_SET_ATOMIC.9 \ bitset.9 BIT_SET_ATOMIC_ACQ.9 \ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363307 - head/sys/compat/linux
Author: trasz Date: Sat Jul 18 12:21:08 2020 New Revision: 363307 URL: https://svnweb.freebsd.org/changeset/base/363307 Log: Make linux fallocate(2) return EOPNOTSUPP, not ENOSYS, on unsupported mode, as documented in the man page. MFC after:2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/compat/linux/linux_file.c Modified: head/sys/compat/linux/linux_file.c == --- head/sys/compat/linux/linux_file.c Sat Jul 18 11:37:30 2020 (r363306) +++ head/sys/compat/linux/linux_file.c Sat Jul 18 12:21:08 2020 (r363307) @@ -1670,7 +1670,7 @@ linux_fallocate(struct thread *td, struct linux_falloc * mode should be 0. */ if (args->mode != 0) - return (ENOSYS); + return (EOPNOTSUPP); #if defined(__amd64__) && defined(COMPAT_LINUX32) len = PAIR32TO64(off_t, args->len); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363306 - head/sys/compat/linux
Author: trasz Date: Sat Jul 18 11:37:30 2020 New Revision: 363306 URL: https://svnweb.freebsd.org/changeset/base/363306 Log: Bump the default linux version from 3.2.0 to 3.10.0, which corresponds to RHEL 7. Required for DB2. Reviewed by: emaste MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D25656 Modified: head/sys/compat/linux/linux_mib.h Modified: head/sys/compat/linux/linux_mib.h == --- head/sys/compat/linux/linux_mib.h Sat Jul 18 11:31:31 2020 (r363305) +++ head/sys/compat/linux/linux_mib.h Sat Jul 18 11:37:30 2020 (r363306) @@ -47,7 +47,7 @@ int linux_get_oss_version(struct thread *td); intlinux_kernver(struct thread *td); #defineLINUX_KVERSION 3 -#defineLINUX_KPATCHLEVEL 2 +#defineLINUX_KPATCHLEVEL 10 #defineLINUX_KSUBLEVEL 0 #defineLINUX_KERNVER(a,b,c)(((a) << 16) + ((b) << 8) + (c)) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363305 - in head/sys: amd64/linux amd64/linux32 arm64/linux i386/linux
Author: trasz Date: Sat Jul 18 11:31:31 2020 New Revision: 363305 URL: https://svnweb.freebsd.org/changeset/base/363305 Log: Regen after r363304. MFC after:2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/amd64/linux/linux_proto.h 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_sysent.c head/sys/amd64/linux32/linux32_systrace_args.c head/sys/arm64/linux/linux_proto.h head/sys/arm64/linux/linux_sysent.c head/sys/arm64/linux/linux_systrace_args.c head/sys/i386/linux/linux_proto.h 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 Sat Jul 18 11:28:40 2020 (r363304) +++ head/sys/amd64/linux/linux_proto.h Sat Jul 18 11:31:31 2020 (r363305) @@ -1010,7 +1010,12 @@ struct linux_get_robust_list_args { char len_l_[PADL_(l_size_t *)]; l_size_t * len; char len_r_[PADR_(l_size_t *)]; }; struct linux_splice_args { - register_t dummy; + char fd_in_l_[PADL_(int)]; int fd_in; char fd_in_r_[PADR_(int)]; + char off_in_l_[PADL_(l_loff_t *)]; l_loff_t * off_in; char off_in_r_[PADR_(l_loff_t *)]; + char fd_out_l_[PADL_(int)]; int fd_out; char fd_out_r_[PADR_(int)]; + char off_out_l_[PADL_(l_loff_t *)]; l_loff_t * off_out; char off_out_r_[PADR_(l_loff_t *)]; + char len_l_[PADL_(l_size_t)]; l_size_t len; char len_r_[PADR_(l_size_t)]; + char flags_l_[PADL_(l_uint)]; l_uint flags; char flags_r_[PADR_(l_uint)]; }; struct linux_tee_args { register_t dummy; Modified: head/sys/amd64/linux/linux_sysent.c == --- head/sys/amd64/linux/linux_sysent.c Sat Jul 18 11:28:40 2020 (r363304) +++ head/sys/amd64/linux/linux_sysent.c Sat Jul 18 11:31:31 2020 (r363305) @@ -292,7 +292,7 @@ struct sysent linux_sysent[] = { { 0, (sy_call_t *)linux_unshare, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 272 = linux_unshare */ { AS(linux_set_robust_list_args), (sy_call_t *)linux_set_robust_list, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 273 = linux_set_robust_list */ { AS(linux_get_robust_list_args), (sy_call_t *)linux_get_robust_list, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 274 = linux_get_robust_list */ - { 0, (sy_call_t *)linux_splice, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 275 = linux_splice */ + { AS(linux_splice_args), (sy_call_t *)linux_splice, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 275 = linux_splice */ { 0, (sy_call_t *)linux_tee, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 276 = linux_tee */ { AS(linux_sync_file_range_args), (sy_call_t *)linux_sync_file_range, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 277 = linux_sync_file_range */ { 0, (sy_call_t *)linux_vmsplice, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 278 = linux_vmsplice */ Modified: head/sys/amd64/linux/linux_systrace_args.c == --- head/sys/amd64/linux/linux_systrace_args.c Sat Jul 18 11:28:40 2020 (r363304) +++ head/sys/amd64/linux/linux_systrace_args.c Sat Jul 18 11:31:31 2020 (r363305) @@ -2092,7 +2092,14 @@ systrace_args(int sysnum, void *params, uint64_t *uarg } /* linux_splice */ case 275: { - *n_args = 0; + struct linux_splice_args *p = params; + iarg[0] = p->fd_in; /* int */ + uarg[1] = (intptr_t) p->off_in; /* l_loff_t * */ + iarg[2] = p->fd_out; /* int */ + uarg[3] = (intptr_t) p->off_out; /* l_loff_t * */ + iarg[4] = p->len; /* l_size_t */ + iarg[5] = p->flags; /* l_uint */ + *n_args = 6; break; } /* linux_tee */ @@ -5962,6 +5969,28 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d break; /* linux_splice */ case 275: + switch(ndx) { + case 0: + p = "int"; + break; + case 1: + p = "userland l_loff_t *"; + break; + case 2: + p = "int"; + break; + case 3: + p = "userland l_loff_t *"; + break; + case 4: + p = "l_size_t"; + break; + case 5: + p = "l_uint"; + break; + default: + break; + }; break; /* linux_tee */
svn commit: r363304 - in head/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux
Author: trasz Date: Sat Jul 18 11:28:40 2020 New Revision: 363304 URL: https://svnweb.freebsd.org/changeset/base/363304 Log: Add a trivial linux(4) splice(2) implementation, which simply returns EINVAL. Fixes grep (grep-3.1-2build1). PR: kern/218699 Reported by: avos Reviewed by: emaste MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D25636 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/arm64/linux/linux_dummy.c head/sys/arm64/linux/syscalls.master head/sys/compat/linux/linux_file.c 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 Sat Jul 18 10:56:04 2020 (r363303) +++ head/sys/amd64/linux/linux_dummy.c Sat Jul 18 11:28:40 2020 (r363304) @@ -105,7 +105,6 @@ DUMMY(inotify_rm_watch); DUMMY(migrate_pages); DUMMY(unshare); /* Linux 2.6.17: */ -DUMMY(splice); DUMMY(tee); DUMMY(vmsplice); /* Linux 2.6.18: */ Modified: head/sys/amd64/linux/syscalls.master == --- head/sys/amd64/linux/syscalls.masterSat Jul 18 10:56:04 2020 (r363303) +++ head/sys/amd64/linux/syscalls.masterSat Jul 18 11:28:40 2020 (r363304) @@ -1612,7 +1612,14 @@ ); } 275AUE_NULLSTD { - int linux_splice(void); + int linux_splice( + int fd_in, + l_loff_t *off_in, + int fd_out, + l_loff_t *off_out, + l_size_t len, + l_uint flags + ); } 276AUE_NULLSTD { int linux_tee(void); Modified: head/sys/amd64/linux32/linux32_dummy.c == --- head/sys/amd64/linux32/linux32_dummy.c Sat Jul 18 10:56:04 2020 (r363303) +++ head/sys/amd64/linux32/linux32_dummy.c Sat Jul 18 11:28:40 2020 (r363304) @@ -102,7 +102,6 @@ DUMMY(inotify_rm_watch); DUMMY(migrate_pages); DUMMY(unshare); /* Linux 2.6.17: */ -DUMMY(splice); DUMMY(tee); DUMMY(vmsplice); /* Linux 2.6.18: */ Modified: head/sys/amd64/linux32/syscalls.master == --- head/sys/amd64/linux32/syscalls.master Sat Jul 18 10:56:04 2020 (r363303) +++ head/sys/amd64/linux32/syscalls.master Sat Jul 18 11:28:40 2020 (r363304) @@ -1731,7 +1731,14 @@ ); } 313AUE_NULLSTD { - int linux_splice(void); + int linux_splice( + int fd_in, + l_loff_t *off_in, + int fd_out, + l_loff_t *off_out, + l_size_t len, + l_uint flags + ); } 314AUE_NULLSTD { int linux_sync_file_range( Modified: head/sys/arm64/linux/linux_dummy.c == --- head/sys/arm64/linux/linux_dummy.c Sat Jul 18 10:56:04 2020 (r363303) +++ head/sys/arm64/linux/linux_dummy.c Sat Jul 18 11:28:40 2020 (r363304) @@ -98,7 +98,6 @@ DUMMY(inotify_rm_watch); DUMMY(migrate_pages); DUMMY(unshare); /* Linux 2.6.17: */ -DUMMY(splice); DUMMY(tee); DUMMY(vmsplice); /* Linux 2.6.18: */ Modified: head/sys/arm64/linux/syscalls.master == --- head/sys/arm64/linux/syscalls.masterSat Jul 18 10:56:04 2020 (r363303) +++ head/sys/arm64/linux/syscalls.masterSat Jul 18 11:28:40 2020 (r363304) @@ -467,7 +467,14 @@ int linux_vmsplice(void); } 76 AUE_NULLSTD { - int linux_splice(void); + int linux_splice( + int fd_in, + l_loff_t *off_in, + int fd_out, + l_loff_t *off_out, + l_size_t len, + l_uint flags + ); } 77 AUE_NULLSTD { int linux_tee(void); Modified: head/sys/compat/linux/linux_file.c == --- head/sys/compat/linux/linux_file.c Sat Jul 18 10:56:04 2020 (r363303) +++ head/sys/compat/linux/linux_file.c Sat Jul 18 11:28:40 2020 (r363304) @@ -1766,3 +1766,17 @@ linux_memfd_create(struct thread *td, struct linux_mem return (kern_shm_open2(td, SHM_ANON, oflags, 0, shmflags, NULL,
svn commit: r363303 - head/sys/compat/linprocfs
Author: trasz Date: Sat Jul 18 10:56:04 2020 New Revision: 363303 URL: https://svnweb.freebsd.org/changeset/base/363303 Log: Add missing SysV IPC stats to linprocfs(4). Fixes 'ipcs -l', and also helps Oracle. MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D25669 Modified: head/sys/compat/linprocfs/linprocfs.c Modified: head/sys/compat/linprocfs/linprocfs.c == --- head/sys/compat/linprocfs/linprocfs.c Sat Jul 18 10:53:56 2020 (r363302) +++ head/sys/compat/linprocfs/linprocfs.c Sat Jul 18 10:56:04 2020 (r363303) @@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1405,6 +1406,17 @@ linprocfs_doosbuild(PFS_FILL_ARGS) } /* + * Filler function for proc/sys/kernel/msgmax + */ +static int +linprocfs_domsgmax(PFS_FILL_ARGS) +{ + + sbuf_printf(sb, "%d\n", msginfo.msgmax); + return (0); +} + +/* * Filler function for proc/sys/kernel/msgmni */ static int @@ -1416,6 +1428,17 @@ linprocfs_domsgmni(PFS_FILL_ARGS) } /* + * Filler function for proc/sys/kernel/msgmnb + */ +static int +linprocfs_domsgmnb(PFS_FILL_ARGS) +{ + + sbuf_printf(sb, "%d\n", msginfo.msgmnb); + return (0); +} + +/* * Filler function for proc/sys/kernel/pid_max */ static int @@ -1439,6 +1462,39 @@ linprocfs_dosem(PFS_FILL_ARGS) } /* + * Filler function for proc/sys/kernel/shmall + */ +static int +linprocfs_doshmall(PFS_FILL_ARGS) +{ + + sbuf_printf(sb, "%lu\n", shminfo.shmall); + return (0); +} + +/* + * Filler function for proc/sys/kernel/shmmax + */ +static int +linprocfs_doshmmax(PFS_FILL_ARGS) +{ + + sbuf_printf(sb, "%lu\n", shminfo.shmmax); + return (0); +} + +/* + * Filler function for proc/sys/kernel/shmmni + */ +static int +linprocfs_doshmmni(PFS_FILL_ARGS) +{ + + sbuf_printf(sb, "%lu\n", shminfo.shmmni); + return (0); +} + +/* * Filler function for proc/sys/kernel/tainted */ static int @@ -1837,6 +1893,7 @@ linprocfs_init(PFS_INIT_ARGS) /* /proc/sys/... */ sys = pfs_create_dir(root, "sys", NULL, NULL, NULL, 0); + /* /proc/sys/kernel/... */ dir = pfs_create_dir(sys, "kernel", NULL, NULL, NULL, 0); pfs_create_file(dir, "osrelease", _doosrelease, @@ -1845,12 +1902,22 @@ linprocfs_init(PFS_INIT_ARGS) NULL, NULL, NULL, PFS_RD); pfs_create_file(dir, "version", _doosbuild, NULL, NULL, NULL, PFS_RD); + pfs_create_file(dir, "msgmax", _domsgmax, + NULL, NULL, NULL, PFS_RD); pfs_create_file(dir, "msgmni", _domsgmni, NULL, NULL, NULL, PFS_RD); + pfs_create_file(dir, "msgmnb", _domsgmnb, + NULL, NULL, NULL, PFS_RD); pfs_create_file(dir, "pid_max", _dopid_max, NULL, NULL, NULL, PFS_RD); pfs_create_file(dir, "sem", _dosem, NULL, NULL, NULL, PFS_RD); + pfs_create_file(dir, "shmall", _doshmall, + NULL, NULL, NULL, PFS_RD); + pfs_create_file(dir, "shmmax", _doshmmax, + NULL, NULL, NULL, PFS_RD); + pfs_create_file(dir, "shmmni", _doshmmni, + NULL, NULL, NULL, PFS_RD); pfs_create_file(dir, "tainted", _dotainted, NULL, NULL, NULL, PFS_RD); @@ -1887,3 +1954,4 @@ MODULE_DEPEND(linprocfs, linux, 1, 1, 1); MODULE_DEPEND(linprocfs, procfs, 1, 1, 1); MODULE_DEPEND(linprocfs, sysvmsg, 1, 1, 1); MODULE_DEPEND(linprocfs, sysvsem, 1, 1, 1); +MODULE_DEPEND(linprocfs, sysvshm, 1, 1, 1); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363302 - head/sys/compat/linprocfs
Author: trasz Date: Sat Jul 18 10:53:56 2020 New Revision: 363302 URL: https://svnweb.freebsd.org/changeset/base/363302 Log: Fix bogomips calculation. Previously it was off by half. This was verified under VMWare Fusion, comparing to what's reported under CentOS, and by comparing numbers reported by linuxulator on T420 with a googled up Linux cpuinfo (https://lkml.org/lkml/2011/11/29/116). MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D20693 Modified: head/sys/compat/linprocfs/linprocfs.c Modified: head/sys/compat/linprocfs/linprocfs.c == --- head/sys/compat/linprocfs/linprocfs.c Sat Jul 18 10:49:17 2020 (r363301) +++ head/sys/compat/linprocfs/linprocfs.c Sat Jul 18 10:53:56 2020 (r363302) @@ -364,7 +364,7 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) #else "", #endif - fqmhz, fqkhz, + fqmhz * 2, fqkhz, cpu_clflush_line_size, cpu_clflush_line_size, cpu_maxphyaddr, (cpu_maxphyaddr > 32) ? 48 : 0); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363301 - head/sys/compat/linprocfs
Author: trasz Date: Sat Jul 18 10:49:17 2020 New Revision: 363301 URL: https://svnweb.freebsd.org/changeset/base/363301 Log: Fix two typos in flag names in /proc/cpuinfo. MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D25695 Modified: head/sys/compat/linprocfs/linprocfs.c Modified: head/sys/compat/linprocfs/linprocfs.c == --- head/sys/compat/linprocfs/linprocfs.c Sat Jul 18 07:35:34 2020 (r363300) +++ head/sys/compat/linprocfs/linprocfs.c Sat Jul 18 10:49:17 2020 (r363301) @@ -235,10 +235,10 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) }; static char *cpu_feature2_names[] = { - /* 0 */ "pni", "pclmulqdq", "dtes3", "monitor", + /* 0 */ "pni", "pclmulqdq", "dtes64", "monitor", /* 4 */ "ds_cpl", "vmx", "smx", "est", /* 8 */ "tm2", "ssse3", "cid", "sdbg", - /* 12 */ "fma", "cx16", "xptr", "pdcm", + /* 12 */ "fma", "cx16", "xtpr", "pdcm", /* 16 */ "", "pcid", "dca", "sse4_1", /* 20 */ "sse4_2", "x2apic", "movbe", "popcnt", /* 24 */ "tsc_deadline_timer", "aes", "xsave", "", ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363094 - head/sys/compat/linprocfs
Author: trasz Date: Sat Jul 11 13:11:54 2020 New Revision: 363094 URL: https://svnweb.freebsd.org/changeset/base/363094 Log: Make linprocfs(5) report correct tty number in /proc//stat. Fixes sudo (sudo-1.8.21p2-3ubuntu1.2); previously would fail with "sudo: no tty present and no askpass program specified". Reviewed by: kib, emaste MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D25588 Modified: head/sys/compat/linprocfs/linprocfs.c Modified: head/sys/compat/linprocfs/linprocfs.c == --- head/sys/compat/linprocfs/linprocfs.c Sat Jul 11 13:08:16 2020 (r363093) +++ head/sys/compat/linprocfs/linprocfs.c Sat Jul 11 13:11:54 2020 (r363094) @@ -767,6 +767,32 @@ linprocfs_doloadavg(PFS_FILL_ARGS) return (0); } +static int +linprocfs_get_tty_nr(struct proc *p) +{ + struct session *sp; + const char *ttyname; + int error, major, minor, nr; + + PROC_LOCK_ASSERT(p, MA_OWNED); + sx_assert(_lock, SX_LOCKED); + + if ((p->p_flag & P_CONTROLT) == 0) + return (-1); + + sp = p->p_pgrp->pg_session; + if (sp == NULL) + return (-1); + + ttyname = devtoname(sp->s_ttyp->t_dev); + error = linux_driver_get_major_minor(ttyname, , ); + if (error != 0) + return (-1); + + nr = makedev(major, minor); + return (nr); +} + /* * Filler function for proc/pid/stat */ @@ -777,12 +803,14 @@ linprocfs_doprocstat(PFS_FILL_ARGS) struct timeval boottime; char state; static int ratelimit = 0; + int tty_nr; vm_offset_t startcode, startdata; getboottime(); sx_slock(_lock); PROC_LOCK(p); fill_kinfo_proc(p, ); + tty_nr = linprocfs_get_tty_nr(p); sx_sunlock(_lock); if (p->p_vmspace) { startcode = (vm_offset_t)p->p_vmspace->vm_taddr; @@ -809,10 +837,7 @@ linprocfs_doprocstat(PFS_FILL_ARGS) PS_ADD("pgrp", "%d", p->p_pgid); PS_ADD("session", "%d", p->p_session->s_sid); PROC_UNLOCK(p); - if (kp.ki_tdev == NODEV) - PS_ADD("tty", "%s", "-1"); - else - PS_ADD("tty", "%ju", (uintmax_t)kp.ki_tdev); + PS_ADD("tty", "%d", tty_nr); PS_ADD("tpgid", "%d", kp.ki_tpgid); PS_ADD("flags", "%u", 0); /* XXX */ PS_ADD("minflt","%lu", kp.ki_rusage.ru_minflt); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363093 - head/sys/compat/linux
Author: trasz Date: Sat Jul 11 13:08:16 2020 New Revision: 363093 URL: https://svnweb.freebsd.org/changeset/base/363093 Log: Make linux stat(2) return the same st_dev for every devfs instance. The reason for this is to work around an idiosyncrasy of glibc getttynam(3) implementation: it checks whether st_dev returned for fd 0 is the same as st_dev returned for the target of /proc/self/fd/0 symlink, and with linux chroots having their own devfs instance, the check will fail if you chrooted into it. PR: kern/240767 Reviewed by: kib MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D25559 Modified: head/sys/compat/linux/linux_stats.c Modified: head/sys/compat/linux/linux_stats.c == --- head/sys/compat/linux/linux_stats.c Sat Jul 11 09:43:16 2020 (r363092) +++ head/sys/compat/linux/linux_stats.c Sat Jul 11 13:08:16 2020 (r363093) @@ -70,6 +70,17 @@ translate_vnhook_major_minor(struct vnode *vp, struct sb->st_mode |= S_IFBLK; } + /* +* Return the same st_dev for every devfs instance. The reason +* for this is to work around an idiosyncrasy of glibc getttynam() +* implementation: it checks whether st_dev returned for fd 0 +* is the same as st_dev returned for the target of /proc/self/fd/0 +* symlink, and with linux chroots having their own devfs instance, +* the check will fail if you chroot into it. +*/ + if (rootdevmp != NULL && vp->v_mount->mnt_vfc == rootdevmp->mnt_vfc) + sb->st_dev = rootdevmp->mnt_stat.f_fsid.val[0]; + if (vp->v_type == VCHR && vp->v_rdev != NULL && linux_driver_get_major_minor(devtoname(vp->v_rdev), , ) == 0) { @@ -110,6 +121,7 @@ translate_fd_major_minor(struct thread *td, int fd, st { struct file *fp; struct vnode *vp; + struct mount *mp; int major, minor; /* @@ -122,6 +134,12 @@ translate_fd_major_minor(struct thread *td, int fd, st if (vp != NULL && vn_isdisk(vp, NULL)) { buf->st_mode &= ~S_IFMT; buf->st_mode |= S_IFBLK; + } + if (vp != NULL && rootdevmp != NULL) { + mp = vp->v_mount; + __compiler_membar(); + if (mp != NULL && mp->mnt_vfc == rootdevmp->mnt_vfc) + buf->st_dev = rootdevmp->mnt_stat.f_fsid.val[0]; } if (vp != NULL && vp->v_rdev != NULL && linux_driver_get_major_minor(devtoname(vp->v_rdev), ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363087 - head/sys/compat/linux
Author: trasz Date: Fri Jul 10 21:41:09 2020 New Revision: 363087 URL: https://svnweb.freebsd.org/changeset/base/363087 Log: Don't emit warnings on MADV_HUGEPAGE; Firefox uses it a lot. MFC after:2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/compat/linux/linux_mmap.c Modified: head/sys/compat/linux/linux_mmap.c == --- head/sys/compat/linux/linux_mmap.c Fri Jul 10 19:58:26 2020 (r363086) +++ head/sys/compat/linux/linux_mmap.c Fri Jul 10 21:41:09 2020 (r363087) @@ -371,7 +371,13 @@ linux_madvise_common(struct thread *td, uintptr_t addr /* Ignored; on FreeBSD huge pages are always on. */ return (0); case LINUX_MADV_NOHUGEPAGE: +#if 0 + /* +* Don't warn - Firefox uses it a lot, and in real Linux it's +* an optional feature. +*/ linux_msg(curthread, "unsupported madvise MADV_NOHUGEPAGE"); +#endif return (EINVAL); case LINUX_MADV_DONTDUMP: return (kern_madvise(td, addr, len, MADV_NOCORE)); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362943 - head/share/man/man4
Author: trasz Date: Sun Jul 5 13:15:13 2020 New Revision: 362943 URL: https://svnweb.freebsd.org/changeset/base/362943 Log: Make linux(4) man page also mention /compat/linux/dev. MFC after:2 weeks Sponsored by: The FreeBSD Foundation Modified: head/share/man/man4/linux.4 Modified: head/share/man/man4/linux.4 == --- head/share/man/man4/linux.4 Sun Jul 5 13:08:17 2020(r362942) +++ head/share/man/man4/linux.4 Sun Jul 5 13:15:13 2020(r362943) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 4, 2020 +.Dd July 5, 2020 .Dt LINUX 4 .Os .Sh NAME @@ -129,6 +129,9 @@ Defaults to 0. .Bl -tag -width /compat/linux/dev/shm -compact .It Pa /compat/linux minimal Linux run-time environment +.It Pa /compat/linux/dev +device file system, see +.Xr devfs 5 .It Pa /compat/linux/dev/fd file descriptor file system mounted with the .Cm linrdlnk ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362941 - head/sys/compat/linux
Author: trasz Date: Sun Jul 5 10:57:28 2020 New Revision: 362941 URL: https://svnweb.freebsd.org/changeset/base/362941 Log: Fix Linux recvmsg(2) when msg_namelen returned is 0. Previously it would fail with EINVAL, breaking some of the Python regression tests. While here, cap the user-controlled message length. Note that the code doesn't seem to be copying out the new length in either (success or failure) case. This will be addressed separately. Reviewed by: kib MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D25392 Modified: head/sys/compat/linux/linux_socket.c Modified: head/sys/compat/linux/linux_socket.c == --- head/sys/compat/linux/linux_socket.cSun Jul 5 06:51:39 2020 (r362940) +++ head/sys/compat/linux/linux_socket.cSun Jul 5 10:57:28 2020 (r362941) @@ -1196,11 +1196,14 @@ linux_recvmsg_common(struct thread *td, l_int s, struc if (error != 0) return (error); - if (msg->msg_name) { + if (msg->msg_name != NULL && msg->msg_namelen > 0) { + msg->msg_namelen = min(msg->msg_namelen, SOCK_MAXADDRLEN); sa = malloc(msg->msg_namelen, M_SONAME, M_WAITOK); msg->msg_name = sa; - } else + } else { sa = NULL; + msg->msg_name = NULL; + } uiov = msg->msg_iov; msg->msg_iov = iov; @@ -1210,7 +1213,10 @@ linux_recvmsg_common(struct thread *td, l_int s, struc if (error != 0) goto bad; - if (msg->msg_name) { + /* +* Note that kern_recvit() updates msg->msg_namelen. +*/ + if (msg->msg_name != NULL && msg->msg_namelen > 0) { msg->msg_name = PTRIN(linux_msghdr.msg_name); error = bsd_to_linux_sockaddr(sa, , msg->msg_namelen); if (error == 0) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362935 - in head: libexec/rc/rc.d share/man/man4
Author: trasz Date: Sat Jul 4 18:01:29 2020 New Revision: 362935 URL: https://svnweb.freebsd.org/changeset/base/362935 Log: Make the linux rc script use linrdlnk by default. This fixes Linux gettyname(3), with caveats (see PR). PR: kern/240767 MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D25558 Modified: head/libexec/rc/rc.d/linux head/share/man/man4/linux.4 Modified: head/libexec/rc/rc.d/linux == --- head/libexec/rc/rc.d/linux Sat Jul 4 15:20:23 2020(r362934) +++ head/libexec/rc/rc.d/linux Sat Jul 4 18:01:29 2020(r362935) @@ -51,7 +51,7 @@ linux_start() mount -o nocover -t linprocfs linprocfs "${_emul_path}/proc" mount -o nocover -t linsysfs linsysfs "${_emul_path}/sys" mount -o nocover -t devfs devfs "${_emul_path}/dev" - mount -o nocover -t fdescfs fdescfs "${_emul_path}/dev/fd" + mount -o nocover,linrdlnk -t fdescfs fdescfs "${_emul_path}/dev/fd" mount -o nocover,mode=1777 -t tmpfs tmpfs "${_emul_path}/dev/shm" fi } Modified: head/share/man/man4/linux.4 == --- head/share/man/man4/linux.4 Sat Jul 4 15:20:23 2020(r362934) +++ head/share/man/man4/linux.4 Sat Jul 4 18:01:29 2020(r362935) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 12, 2020 +.Dd July 4, 2020 .Dt LINUX 4 .Os .Sh NAME @@ -130,7 +130,9 @@ Defaults to 0. .It Pa /compat/linux minimal Linux run-time environment .It Pa /compat/linux/dev/fd -file-descriptor file system, see +file descriptor file system mounted with the +.Cm linrdlnk +option, see .Xr fdescfs 5 .It Pa /compat/linux/dev/shm in-memory file system, see ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362930 - head/sys/compat/linprocfs
Author: trasz Date: Sat Jul 4 11:26:03 2020 New Revision: 362930 URL: https://svnweb.freebsd.org/changeset/base/362930 Log: Add /proc/sys/kernel/tainted to linprocfs(5). Helps LTP. MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D25556 Modified: head/sys/compat/linprocfs/linprocfs.c Modified: head/sys/compat/linprocfs/linprocfs.c == --- head/sys/compat/linprocfs/linprocfs.c Sat Jul 4 11:22:35 2020 (r362929) +++ head/sys/compat/linprocfs/linprocfs.c Sat Jul 4 11:26:03 2020 (r362930) @@ -1414,6 +1414,17 @@ linprocfs_dosem(PFS_FILL_ARGS) } /* + * Filler function for proc/sys/kernel/tainted + */ +static int +linprocfs_dotainted(PFS_FILL_ARGS) +{ + + sbuf_printf(sb, "0\n"); + return (0); +} + +/* * Filler function for proc/sys/vm/min_free_kbytes * * This mirrors the approach in illumos to return zero for reads. Effectively, @@ -1814,6 +1825,8 @@ linprocfs_init(PFS_INIT_ARGS) pfs_create_file(dir, "pid_max", _dopid_max, NULL, NULL, NULL, PFS_RD); pfs_create_file(dir, "sem", _dosem, + NULL, NULL, NULL, PFS_RD); + pfs_create_file(dir, "tainted", _dotainted, NULL, NULL, NULL, PFS_RD); /* /proc/sys/kernel/random/... */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362929 - in head/sys/compat: linprocfs linsysfs
Author: trasz Date: Sat Jul 4 11:22:35 2020 New Revision: 362929 URL: https://svnweb.freebsd.org/changeset/base/362929 Log: Make linprocfs(5) create /proc/bus/pci/devices/, and linsysfs(5) create /sys/class/power_supply/. This silences some warnings from biology/linux-foldingathome. Reported by: 0mp MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D25557 Modified: head/sys/compat/linprocfs/linprocfs.c head/sys/compat/linsysfs/linsysfs.c Modified: head/sys/compat/linprocfs/linprocfs.c == --- head/sys/compat/linprocfs/linprocfs.c Sat Jul 4 09:18:19 2020 (r362928) +++ head/sys/compat/linprocfs/linprocfs.c Sat Jul 4 11:22:35 2020 (r362929) @@ -1746,6 +1746,11 @@ linprocfs_init(PFS_INIT_ARGS) pfs_create_file(root, "version", _doversion, NULL, NULL, NULL, PFS_RD); + /* /proc/bus/... */ + dir = pfs_create_dir(root, "bus", NULL, NULL, NULL, 0); + dir = pfs_create_dir(dir, "pci", NULL, NULL, NULL, 0); + dir = pfs_create_dir(dir, "devices", NULL, NULL, NULL, 0); + /* /proc/net/... */ dir = pfs_create_dir(root, "net", NULL, NULL, NULL, 0); pfs_create_file(dir, "dev", _donetdev, Modified: head/sys/compat/linsysfs/linsysfs.c == --- head/sys/compat/linsysfs/linsysfs.c Sat Jul 4 09:18:19 2020 (r362928) +++ head/sys/compat/linsysfs/linsysfs.c Sat Jul 4 11:22:35 2020 (r362929) @@ -622,6 +622,7 @@ linsysfs_init(PFS_INIT_ARGS) struct pfs_node *pci; struct pfs_node *scsi; struct pfs_node *net; + struct pfs_node *power_supply; struct pfs_node *devdir, *chardev; devclass_t devclass; device_t dev; @@ -634,6 +635,7 @@ linsysfs_init(PFS_INIT_ARGS) class = pfs_create_dir(root, "class", NULL, NULL, NULL, 0); scsi = pfs_create_dir(class, "scsi_host", NULL, NULL, NULL, 0); drm = pfs_create_dir(class, "drm", NULL, NULL, NULL, 0); + power_supply = pfs_create_dir(class, "power_supply", NULL, NULL, NULL, 0); /* /sys/class/net/.. */ net = pfs_create_dir(class, "net", NULL, NULL, NULL, 0); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r362806 - head/sys/compat/linprocfs
On 0630T1828, Mateusz Piotrowski wrote: > Hi, > > On 6/30/20 6:24 PM, Edward Tomasz Napierala wrote: > > Author: trasz > > Date: Tue Jun 30 16:24:28 2020 > > New Revision: 362806 > > URL: https://svnweb.freebsd.org/changeset/base/362806 > > > > Log: > > Make linprocfs(5) create the /proc//task/ directores. > > This is to silence down some Chromium assertions. > > > > PR: kern/240991 > > Analyzed by: Alex S > > MFC after:2 weeks > > Sponsored by: The FreeBSD Foundation > > Differential Revision:https://reviews.freebsd.org/D25256 > > Hmm, could something similar be done to the following warning which is being > printed > when service fahclient is started (from the biology/linux-foldingathome port): > > 16:25:39:WARNING:Exception: Failed to open '/proc/bus/pci/devices': Failed to > open > '/proc/bus/pci/devices': No such file or directory: No such file or directory Sure: https://reviews.freebsd.org/D25557 ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362833 - head/sys/compat/linux
Author: trasz Date: Wed Jul 1 10:37:08 2020 New Revision: 362833 URL: https://svnweb.freebsd.org/changeset/base/362833 Log: Rework linux accept(2). This makes the code flow easier to follow, and fixes a bug where calling accept(2) could result in closing fd 0. Note that the code still contains a number of problems: it makes assumptions about l_sockaddr_in being the same as sockaddr_in, the EFAULT-related code looks like it doesn't work at all, and the socket type check is racy. Those will be addressed later on; I'm trying to work in small steps to avoid breaking one thing while fixing another. It fixes Redis, among other things. Reviewed by: kib MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D25461 Modified: head/sys/compat/linux/linux_socket.c Modified: head/sys/compat/linux/linux_socket.c == --- head/sys/compat/linux/linux_socket.cWed Jul 1 09:35:33 2020 (r362832) +++ head/sys/compat/linux/linux_socket.cWed Jul 1 10:37:08 2020 (r362833) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -611,17 +612,19 @@ linux_accept_common(struct thread *td, int s, l_uintpt { struct l_sockaddr *lsa; struct sockaddr *sa; - struct file *fp; + struct file *fp, *fp1; int bflags, len; struct socket *so; int error, error1; bflags = 0; + fp = NULL; + sa = NULL; + error = linux_set_socket_flags(flags, ); if (error != 0) return (error); - sa = NULL; if (PTRIN(addr) == NULL) { len = 0; error = kern_accept4(td, s, NULL, NULL, bflags, NULL); @@ -632,48 +635,54 @@ linux_accept_common(struct thread *td, int s, l_uintpt if (len < 0) return (EINVAL); error = kern_accept4(td, s, , , bflags, ); - if (error == 0) - fdrop(fp, td); } + /* +* Translate errno values into ones used by Linux. +*/ if (error != 0) { /* * XXX. This is wrong, different sockaddr structures * have different sizes. */ - if (error == EFAULT && namelen != sizeof(struct sockaddr_in)) - { - error = EINVAL; - goto out; - } - if (error == EINVAL) { - error1 = getsock_cap(td, s, _accept_rights, , NULL, NULL); + switch (error) { + case EFAULT: + if (namelen != sizeof(struct sockaddr_in)) + error = EINVAL; + break; + case EINVAL: + error1 = getsock_cap(td, s, _accept_rights, , NULL, NULL); if (error1 != 0) { error = error1; - goto out; + break; } - so = fp->f_data; + so = fp1->f_data; if (so->so_type == SOCK_DGRAM) error = EOPNOTSUPP; - fdrop(fp, td); + fdrop(fp1, td); + break; } - goto out; + return (error); } - if (len != 0 && error == 0) { + if (len != 0) { error = bsd_to_linux_sockaddr(sa, , len); if (error == 0) error = copyout(lsa, PTRIN(addr), len); free(lsa, M_SONAME); - } - free(sa, M_SONAME); + /* +* XXX: We should also copyout the len, shouldn't we? +*/ -out: - if (error != 0) { - (void)kern_close(td, td->td_retval[0]); - td->td_retval[0] = 0; + if (error != 0) { + fdclose(td, fp, td->td_retval[0]); + td->td_retval[0] = 0; + } } + if (fp != NULL) + fdrop(fp, td); + free(sa, M_SONAME); return (error); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362807 - head/usr.sbin/sesutil
Author: trasz Date: Tue Jun 30 16:49:43 2020 New Revision: 362807 URL: https://svnweb.freebsd.org/changeset/base/362807 Log: Fix misplaced voltages/temperatures labels in 'sesutil show'. PR: bin/247384 Reported by: brd MFC after:2 weeks Differential Revision:https://reviews.freebsd.org/D25353 Modified: head/usr.sbin/sesutil/sesutil.c Modified: head/usr.sbin/sesutil/sesutil.c == --- head/usr.sbin/sesutil/sesutil.c Tue Jun 30 16:24:28 2020 (r362806) +++ head/usr.sbin/sesutil/sesutil.c Tue Jun 30 16:49:43 2020 (r362807) @@ -831,7 +831,7 @@ show(int argc, char **argv __unused) break; case ELMTYP_THERM: if (e_ptr[j].elm_type != prev_type) - xo_emit("\nVoltages: "); + xo_emit("\nTemperatures: "); else xo_emit(", "); prev_type = e_ptr[j].elm_type; @@ -839,7 +839,7 @@ show(int argc, char **argv __unused) break; case ELMTYP_VOM: if (e_ptr[j].elm_type != prev_type) - xo_emit("\nTemperatures: "); + xo_emit("\nVoltages: "); else xo_emit(", "); prev_type = e_ptr[j].elm_type; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362806 - head/sys/compat/linprocfs
Author: trasz Date: Tue Jun 30 16:24:28 2020 New Revision: 362806 URL: https://svnweb.freebsd.org/changeset/base/362806 Log: Make linprocfs(5) create the /proc//task/ directores. This is to silence down some Chromium assertions. PR: kern/240991 Analyzed by: Alex S MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D25256 Modified: head/sys/compat/linprocfs/linprocfs.c Modified: head/sys/compat/linprocfs/linprocfs.c == --- head/sys/compat/linprocfs/linprocfs.c Tue Jun 30 16:23:51 2020 (r362805) +++ head/sys/compat/linprocfs/linprocfs.c Tue Jun 30 16:24:28 2020 (r362806) @@ -1620,6 +1620,28 @@ out: } /* + * The point of the following two functions is to work around + * an assertion in Chromium; see kern/240991 for details. + */ +static int +linprocfs_dotaskattr(PFS_ATTR_ARGS) +{ + + vap->va_nlink = 3; + return (0); +} + +/* + * Filler function for proc//task/.dummy + */ +static int +linprocfs_dotaskdummy(PFS_FILL_ARGS) +{ + + return (0); +} + +/* * Filler function for proc/sys/kernel/random/uuid */ static int @@ -1758,6 +1780,11 @@ linprocfs_init(PFS_INIT_ARGS) pfs_create_file(dir, "auxv", _doauxv, NULL, _candebug, NULL, PFS_RD|PFS_RAWRD); pfs_create_file(dir, "limits", _doproclimits, + NULL, NULL, NULL, PFS_RD); + + /* /proc//task/... */ + dir = pfs_create_dir(dir, "task", linprocfs_dotaskattr, NULL, NULL, 0); + pfs_create_file(dir, ".dummy", _dotaskdummy, NULL, NULL, NULL, PFS_RD); /* /proc/scsi/... */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362804 - head/sys/compat/linux
Author: trasz Date: Tue Jun 30 16:18:09 2020 New Revision: 362804 URL: https://svnweb.freebsd.org/changeset/base/362804 Log: Make linux(4) ignore SA_INTERRUPT. The zsh(1) binary from Bionic uses it. MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D25499 Modified: head/sys/compat/linux/linux_signal.c Modified: head/sys/compat/linux/linux_signal.c == --- head/sys/compat/linux/linux_signal.cTue Jun 30 15:58:29 2020 (r362803) +++ head/sys/compat/linux/linux_signal.cTue Jun 30 16:18:09 2020 (r362804) @@ -102,6 +102,10 @@ linux_to_bsd_sigaction(l_sigaction_t *lsa, struct siga flags &= ~LINUX_SA_RESTART; bsa->sa_flags |= SA_RESTART; } + if (lsa->lsa_flags & LINUX_SA_INTERRUPT) { + flags &= ~LINUX_SA_INTERRUPT; + /* Documented to be a "historical no-op". */ + } if (lsa->lsa_flags & LINUX_SA_ONESHOT) { flags &= ~LINUX_SA_ONESHOT; bsa->sa_flags |= SA_RESETHAND; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362735 - head/sys/compat/linux
Author: trasz Date: Sun Jun 28 18:56:32 2020 New Revision: 362735 URL: https://svnweb.freebsd.org/changeset/base/362735 Log: Make linux(4) support SO_PROTOCOL. Running Python test suite with python3.8 from Focal triggers those. MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D25491 Modified: head/sys/compat/linux/linux_socket.c head/sys/compat/linux/linux_socket.h Modified: head/sys/compat/linux/linux_socket.c == --- head/sys/compat/linux/linux_socket.cSun Jun 28 18:02:51 2020 (r362734) +++ head/sys/compat/linux/linux_socket.cSun Jun 28 18:56:32 2020 (r362735) @@ -236,6 +236,8 @@ linux_to_bsd_so_sockopt(int opt) return (SO_TIMESTAMP); case LINUX_SO_ACCEPTCONN: return (SO_ACCEPTCONN); + case LINUX_SO_PROTOCOL: + return (SO_PROTOCOL); } return (-1); } Modified: head/sys/compat/linux/linux_socket.h == --- head/sys/compat/linux/linux_socket.hSun Jun 28 18:02:51 2020 (r362734) +++ head/sys/compat/linux/linux_socket.hSun Jun 28 18:56:32 2020 (r362735) @@ -197,6 +197,7 @@ int linux_accept(struct thread *td, struct linux_accep #defineLINUX_SO_ACCEPTCONN 30 #defineLINUX_SO_SNDBUFFORCE32 #defineLINUX_SO_RCVBUFFORCE33 +#defineLINUX_SO_PROTOCOL 38 /* Socket options */ #defineLINUX_IP_TOS1 ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362699 - head/sys/compat/linux
Author: trasz Date: Sat Jun 27 15:50:35 2020 New Revision: 362699 URL: https://svnweb.freebsd.org/changeset/base/362699 Log: Make linux(4) warn about unsupported SA_ flags. MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D25453 Modified: head/sys/compat/linux/linux_signal.c Modified: head/sys/compat/linux/linux_signal.c == --- head/sys/compat/linux/linux_signal.cSat Jun 27 15:06:58 2020 (r362698) +++ head/sys/compat/linux/linux_signal.cSat Jun 27 15:50:35 2020 (r362699) @@ -63,24 +63,56 @@ static void sicode_to_lsicode(int si_code, int *lsi_co static void linux_to_bsd_sigaction(l_sigaction_t *lsa, struct sigaction *bsa) { + unsigned long flags; linux_to_bsd_sigset(>lsa_mask, >sa_mask); bsa->sa_handler = PTRIN(lsa->lsa_handler); bsa->sa_flags = 0; - if (lsa->lsa_flags & LINUX_SA_NOCLDSTOP) + + flags = lsa->lsa_flags; + if (lsa->lsa_flags & LINUX_SA_NOCLDSTOP) { + flags &= ~LINUX_SA_NOCLDSTOP; bsa->sa_flags |= SA_NOCLDSTOP; - if (lsa->lsa_flags & LINUX_SA_NOCLDWAIT) + } + if (lsa->lsa_flags & LINUX_SA_NOCLDWAIT) { + flags &= ~LINUX_SA_NOCLDWAIT; bsa->sa_flags |= SA_NOCLDWAIT; - if (lsa->lsa_flags & LINUX_SA_SIGINFO) + } + if (lsa->lsa_flags & LINUX_SA_SIGINFO) { + flags &= ~LINUX_SA_SIGINFO; bsa->sa_flags |= SA_SIGINFO; - if (lsa->lsa_flags & LINUX_SA_ONSTACK) +#ifdef notyet + /* +* XXX: We seem to be missing code to convert +* some of the fields in ucontext_t. +*/ + linux_msg(curthread, + "partially unsupported sigaction flag SA_SIGINFO"); +#endif + } + if (lsa->lsa_flags & LINUX_SA_RESTORER) { + flags &= ~LINUX_SA_RESTORER; + /* XXX: We might want to handle it; see Linux sigreturn(2). */ + } + if (lsa->lsa_flags & LINUX_SA_ONSTACK) { + flags &= ~LINUX_SA_ONSTACK; bsa->sa_flags |= SA_ONSTACK; - if (lsa->lsa_flags & LINUX_SA_RESTART) + } + if (lsa->lsa_flags & LINUX_SA_RESTART) { + flags &= ~LINUX_SA_RESTART; bsa->sa_flags |= SA_RESTART; - if (lsa->lsa_flags & LINUX_SA_ONESHOT) + } + if (lsa->lsa_flags & LINUX_SA_ONESHOT) { + flags &= ~LINUX_SA_ONESHOT; bsa->sa_flags |= SA_RESETHAND; - if (lsa->lsa_flags & LINUX_SA_NOMASK) + } + if (lsa->lsa_flags & LINUX_SA_NOMASK) { + flags &= ~LINUX_SA_NOMASK; bsa->sa_flags |= SA_NODEFER; + } + + if (flags != 0) + linux_msg(curthread, "unsupported sigaction flag %#lx", flags); } static void ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362693 - in head/sys: amd64/linux amd64/linux32 arm64/linux i386/linux
Author: trasz Date: Sat Jun 27 14:43:29 2020 New Revision: 362693 URL: https://svnweb.freebsd.org/changeset/base/362693 Log: Regen. MFC after:2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/amd64/linux/linux_proto.h 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_sysent.c head/sys/amd64/linux32/linux32_systrace_args.c head/sys/arm64/linux/linux_proto.h head/sys/arm64/linux/linux_sysent.c head/sys/arm64/linux/linux_systrace_args.c head/sys/i386/linux/linux_proto.h 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 Sat Jun 27 14:42:08 2020 (r362692) +++ head/sys/amd64/linux/linux_proto.h Sat Jun 27 14:43:29 2020 (r362693) @@ -38,7 +38,7 @@ struct thread; struct linux_open_args { char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)]; - char mode_l_[PADL_(l_int)]; l_int mode; char mode_r_[PADR_(l_int)]; + char mode_l_[PADL_(l_mode_t)]; l_mode_t mode; char mode_r_[PADR_(l_mode_t)]; }; struct linux_newstat_args { char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; @@ -66,9 +66,9 @@ struct linux_mmap2_args { char pgoff_l_[PADL_(l_ulong)]; l_ulong pgoff; char pgoff_r_[PADR_(l_ulong)]; }; struct linux_mprotect_args { - char addr_l_[PADL_(caddr_t)]; caddr_t addr; char addr_r_[PADR_(caddr_t)]; - 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)]; + char addr_l_[PADL_(l_ulong)]; l_ulong addr; char addr_r_[PADR_(l_ulong)]; + char len_l_[PADL_(l_size_t)]; l_size_t len; char len_r_[PADR_(l_size_t)]; + char prot_l_[PADL_(l_ulong)]; l_ulong prot; char prot_r_[PADR_(l_ulong)]; }; struct linux_brk_args { char dsend_l_[PADL_(l_ulong)]; l_ulong dsend; char dsend_r_[PADR_(l_ulong)]; @@ -91,7 +91,7 @@ struct linux_rt_sigreturn_args { struct linux_ioctl_args { char fd_l_[PADL_(l_uint)]; l_uint fd; char fd_r_[PADR_(l_uint)]; char cmd_l_[PADL_(l_uint)]; l_uint cmd; char cmd_r_[PADR_(l_uint)]; - char arg_l_[PADL_(uintptr_t)]; uintptr_t arg; char arg_r_[PADR_(uintptr_t)]; + char arg_l_[PADL_(l_ulong)]; l_ulong arg; char arg_r_[PADR_(l_ulong)]; }; struct linux_pread_args { char fd_l_[PADL_(l_uint)]; l_uint fd; char fd_r_[PADR_(l_uint)]; @@ -110,7 +110,7 @@ struct linux_access_args { char amode_l_[PADL_(l_int)]; l_int amode; char amode_r_[PADR_(l_int)]; }; struct linux_pipe_args { - char pipefds_l_[PADL_(l_ulong *)]; l_ulong * pipefds; char pipefds_r_[PADR_(l_ulong *)]; + char pipefds_l_[PADL_(l_int *)]; l_int * pipefds; char pipefds_r_[PADR_(l_int *)]; }; struct linux_select_args { char nfds_l_[PADL_(l_int)]; l_int nfds; char nfds_r_[PADR_(l_int)]; @@ -137,9 +137,9 @@ struct linux_mincore_args { char vec_l_[PADL_(u_char *)]; u_char * vec; char vec_r_[PADR_(u_char *)]; }; struct linux_madvise_args { - char addr_l_[PADL_(void *)]; void * addr; char addr_r_[PADR_(void *)]; - char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)]; - char behav_l_[PADL_(int)]; int behav; char behav_r_[PADR_(int)]; + char addr_l_[PADL_(l_ulong)]; l_ulong addr; char addr_r_[PADR_(l_ulong)]; + char len_l_[PADL_(l_size_t)]; l_size_t len; char len_r_[PADR_(l_size_t)]; + char behav_l_[PADL_(l_int)]; l_int behav; char behav_r_[PADR_(l_int)]; }; struct linux_shmget_args { char key_l_[PADL_(l_key_t)]; l_key_t key; char key_r_[PADR_(l_key_t)]; @@ -181,7 +181,7 @@ struct linux_getpid_args { struct linux_sendfile_args { 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 offset_l_[PADL_(l_off_t *)]; l_off_t * offset; char offset_r_[PADR_(l_off_t *)]; char count_l_[PADL_(l_size_t)]; l_size_t count; char count_r_[PADR_(l_size_t)]; }; struct linux_socket_args { @@ -202,8 +202,8 @@ struct linux_accept_args { struct linux_sendto_args { char s_l_[PADL_(l_int)]; l_int s; char s_r_[PADR_(l_int)]; char msg_l_[PADL_(l_uintptr_t)]; l_uintptr_t msg; char msg_r_[PADR_(l_uintptr_t)]; - char len_l_[PADL_(l_int)]; l_int len; char len_r_[PADR_(l_int)]; - char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)]; + char len_l_[PADL_(l_size_t)]; l_size_t len; char len_r_[PADR_(l_size_t)]; + char flags_l_[PADL_(l_uint)]; l_uint flags; char
svn commit: r362692 - in head/sys: amd64/linux amd64/linux32 arm64/linux i386/linux
Author: trasz Date: Sat Jun 27 14:42:08 2020 New Revision: 362692 URL: https://svnweb.freebsd.org/changeset/base/362692 Log: Add proper types for linux message queue syscalls; mostly taken from 32-bit Linuxulator. MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D25386 Modified: head/sys/amd64/linux/syscalls.master head/sys/amd64/linux32/syscalls.master head/sys/arm64/linux/linux.h head/sys/arm64/linux/syscalls.master head/sys/i386/linux/syscalls.master Modified: head/sys/amd64/linux/syscalls.master == --- head/sys/amd64/linux/syscalls.masterSat Jun 27 14:39:44 2020 (r362691) +++ head/sys/amd64/linux/syscalls.masterSat Jun 27 14:42:08 2020 (r362692) @@ -1394,22 +1394,48 @@ int linux_get_mempolicy(void); } 240AUE_NULLSTD { - int linux_mq_open(void); + int linux_mq_open( + const char *name, + l_int oflag, + l_mode_t mode, + struct mq_attr *attr + ); } 241AUE_NULLSTD { - int linux_mq_unlink(void); + int linux_mq_unlink( + const char *name + ); } 242AUE_NULLSTD { - int linux_mq_timedsend(void); + int linux_mq_timedsend( + l_mqd_t mqd, + const char *msg_ptr, + l_size_t msg_len, + l_uint msg_prio, + const struct l_timespec *abs_timeout + ); } 243AUE_NULLSTD { - int linux_mq_timedreceive(void); + int linux_mq_timedreceive( + l_mqd_t mqd, + char *msg_ptr, + l_size_t msg_len, + l_uint *msg_prio, + const struct l_timespec *abs_timeout + ); } 244AUE_NULLSTD { - int linux_mq_notify(void); + int linux_mq_notify( + l_mqd_t mqd, + const struct l_timespec *abs_timeout + ); } 245AUE_NULLSTD { - int linux_mq_getsetattr(void); + int linux_mq_getsetattr( + l_mqd_t mqd, + const struct mq_attr *attr, + struct mq_attr *oattr + ); } 246AUE_NULLSTD { int linux_kexec_load(void); Modified: head/sys/amd64/linux32/syscalls.master == --- head/sys/amd64/linux32/syscalls.master Sat Jun 27 14:39:44 2020 (r362691) +++ head/sys/amd64/linux32/syscalls.master Sat Jun 27 14:42:08 2020 (r362692) @@ -1508,22 +1508,48 @@ } ; Linux 2.6.6: 277AUE_NULLSTD { - int linux_mq_open(void); + int linux_mq_open( + const char *name, + l_int oflag, + l_mode_t mode, + struct mq_attr *attr + ); } 278AUE_NULLSTD { - int linux_mq_unlink(void); + int linux_mq_unlink( + const char *name + ); } 279AUE_NULLSTD { - int linux_mq_timedsend(void); + int linux_mq_timedsend( + l_mqd_t mqd, + const char *msg_ptr, + l_size_t msg_len, + l_uint msg_prio, + const struct l_timespec *abs_timeout + ); } 280AUE_NULLSTD { - int linux_mq_timedreceive(void); + int linux_mq_timedreceive( + l_mqd_t mqd, + char *msg_ptr, + l_size_t msg_len, + l_uint *msg_prio, + const struct l_timespec *abs_timeout + ); } 281AUE_NULLSTD { - int linux_mq_notify(void); + int linux_mq_notify( + l_mqd_t mqd, + const struct l_timespec *abs_timeout + ); } 282AUE_NULLSTD { - int linux_mq_getsetattr(void); + int linux_mq_getsetattr( + l_mqd_t mqd, + const struct mq_attr *attr, + struct mq_attr *oattr + ); } 283AUE_NULLSTD { int linux_kexec_load(void); Modified: head/sys/arm64/linux/linux.h == --- head/sys/arm64/linux/linux.hSat Jun 27 14:39:44 2020 (r362691) +++
svn commit: r362691 - in head/sys: amd64/linux amd64/linux32 arm64/linux i386/linux
Author: trasz Date: Sat Jun 27 14:39:44 2020 New Revision: 362691 URL: https://svnweb.freebsd.org/changeset/base/362691 Log: Add syscall definitions for linux xattr syscalls. MFC after:2 weeks Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D25387 Modified: head/sys/amd64/linux/syscalls.master head/sys/amd64/linux32/syscalls.master head/sys/arm64/linux/syscalls.master head/sys/i386/linux/syscalls.master Modified: head/sys/amd64/linux/syscalls.master == --- head/sys/amd64/linux/syscalls.masterSat Jun 27 14:37:36 2020 (r362690) +++ head/sys/amd64/linux/syscalls.masterSat Jun 27 14:39:44 2020 (r362691) @@ -1112,40 +1112,94 @@ int linux_readahead(void); } 188AUE_NULLSTD { - int linux_setxattr(void); + int linux_setxattr( + const char *path, + const char *name, + const char *value, + l_size_t size, + l_int flags + ); } 189AUE_NULLSTD { - int linux_lsetxattr(void); + int linux_lsetxattr( + const char *path, + const char *name, + const char *value, + l_size_t size, + l_int flags + ); } 190AUE_NULLSTD { - int linux_fsetxattr(void); + int linux_fsetxattr( + l_int fd, + const char *name, + const char *value, + l_size_t size, + l_int flags + ); } 191AUE_NULLSTD { - int linux_getxattr(void); + int linux_getxattr( + const char *path, + const char *name, + char *value, + l_size_t size + ); } 192AUE_NULLSTD { - int linux_lgetxattr(void); + int linux_lgetxattr( + const char *path, + const char *name, + char *value, + l_size_t size + ); } 193AUE_NULLSTD { - int linux_fgetxattr(void); + int linux_fgetxattr( + l_int fd, + const char *name, + char *value, + l_size_t size + ); } 194AUE_NULLSTD { - int linux_listxattr(void); + int linux_listxattr( + const char *path, + const char *list, + l_size_t size + ); } 195AUE_NULLSTD { - int linux_llistxattr(void); + int linux_llistxattr( + const char *path, + const char *list, + l_size_t size + ); } 196AUE_NULLSTD { - int linux_flistxattr(void); + int linux_flistxattr( + l_int fd, + const char *list, + l_size_t size + ); } 197AUE_NULLSTD { - int linux_removexattr(void); + int linux_removexattr( + const char *path, + const char *name + ); } 198AUE_NULLSTD { - int linux_lremovexattr(void); + int linux_lremovexattr( + const char *path, + const char *name + ); } 199AUE_NULLSTD { - int linux_fremovexattr(void); + int linux_fremovexattr( + l_int fd, + const char *name + ); } 200AUE_NULLSTD { int linux_tkill( Modified: head/sys/amd64/linux32/syscalls.master == --- head/sys/amd64/linux32/syscalls.master Sat Jun 27 14:37:36 2020 (r362690) +++ head/sys/amd64/linux32/syscalls.master Sat Jun 27 14:39:44 2020 (r362691) @@ -1217,40 +1217,94 @@ } 225AUE_NULLUNIMPL linux_readahead 226AUE_NULLSTD { - int linux_setxattr(void); + int linux_setxattr( + const char *path, + const char *name, + const char *value, + l_size_t size, + l_int flags + ); } 227AUE_NULLSTD { - int linux_lsetxattr(void); + int linux_lsetxattr( + const char *path, + const