[CFT] pw(8) using pw/gr API from libutil
Hi all, I have been modifying pw(8) it order for it to user the pw_* and gr_* function from libutil, to: avoid code duplication have a single API to manipulate user/group things. I have been using this version for a while now and it works quite well to me, I'm just missing testing in real NIS environment. The patch can be find here: http://people.freebsd.org/~bapt/pw_use_pw_gr_utils.diff regards, Bapt pgpijB92ngOEc.pgp Description: PGP signature
Re: Enhancing the user experience with tcsh
On Fri, 10 Feb 2012, Gonzalo Nemmi wrote: On Thu, Feb 9, 2012 at 9:52 PM, Eitan Adler wrote: In conf/160689 (http://www.freebsd.org/cgi/query-pr.cgi?pr=160689) there has been some discussion about changing the default cshrc file. In the same line that Wojciech on the PR ".cshrc should be updated for modern hardware" I always set this ones on /usr/share/skel/dot.cshrc bindkey "\e[1~" beginning-of-line #make Home key work; bindkey "\e[2~" overwrite-mode #make Ins key work; bindkey "\e[3~" delete-char #make Delete key work; bindkey "\e[4~" end-of-line #make End key work; Besides that I add an "if [ -d $HOME/bin ]" and add it to $PATH if it exists, but that has nothing to do with ".cshrc should be updated for modern hardware" ... it jsut comes in really handy. The question becomes "how much is too much?" For example, ever since a thread in the forums showed examples of csh/tcsh autocompletion, I've thought the default .cshrc should be stuffed with them. Not for typing reduction so much as self-documenting commands like complete chown 'p/1/u/' complete man'C/*/c/' complete service'n/*/`service -l`/' 'service' autocompletes with a list of services--it helps the user by showing valid choices. Same with 'chown', it gives a list of users. Then there's this, which probably isn't quite right but has been useful to me (thanks to forum members for help with it): complete make 'n@*@`make -pn | sed -n -E "/^[#_.\/[:blank:]]+/d; /=/d; s/[[:blank:]]*:.*//gp;"`@' That completes with all lower-case make targets for the current directory. Package operations are easier when the package names autocomplete: complete pkg_delete 'c/-/(i v D n p d f G x X r)/' \ 'n@*@`ls /var/db/pkg`@' complete pkg_info 'c/-/(a b v p q Q c d D f g i I j k K r R m L s o G O x X e E l t V P)/' \ 'n@*@`\ls -1 /var/db/pkg | sed s%/var/db/pkg/%%`@' There's lots more that could be done. Are they appropriate for a stock .cshrc? Maybe now is the time. ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: Enhancing the user experience with tcsh
On Thu, 9 Feb 2012 19:52:58 -0500 Eitan Adler wrote: > In conf/160689 (http://www.freebsd.org/cgi/query-pr.cgi?pr=160689) > there has been some discussion about changing the default cshrc file. > > I'd like to commit something like the following based on Chris's patch > at the end of the thread. This post is an attempt to open the change > to wider discussion. > > commit dbe6cb730686dd53af7d06cc9b69b60e6e55549c > diff --git a/etc/root/dot.cshrc b/etc/root/dot.cshrc > --- a/etc/root/dot.cshrc > +++ b/etc/root/dot.cshrc > @@ -7,9 +7,10 @@ > > alias h history 25 > alias j jobs -l > -alias la ls -a > +alias la ls -aF > alias lf ls -FA > -alias ll ls -lA > +alias ll ls -lAF > +alias ls ls -F > > # A righteous umask > umask 22 > @@ -17,19 +18,24 @@ umask 22 > set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin > /usr/local/bin $HOME/bin) > > setenv EDITOR vi > -setenv PAGER more > +setenv PAGER less > setenv BLOCKSIZE K > > if ($?prompt) then > # An interactive shell -- set some stuff up > set prompt = "`/bin/hostname -s`# " > set filec > - set history = 100 > - set savehist = 100 > + set history = 1 > + set savehist = 1 > + set autolist > + # Use history to aid expansion > + set autoexpand > set mail = (/var/mail/$USER) > if ( $?tcsh ) then > bindkey "^W" backward-delete-word > bindkey -k up history-search-backward > bindkey -k down history-search-forward > endif > + set prompt = "[%n@%m]%c04%# " > + set promptchars = "%#" > endif > what are you thinking about: +bindkey "^F" forward-word + bindkey "^B" backward-word ? -- wbr, tiger ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: Enhancing the user experience with tcsh
On Thu, Feb 9, 2012 at 9:52 PM, Eitan Adler wrote: > In conf/160689 (http://www.freebsd.org/cgi/query-pr.cgi?pr=160689) > there has been some discussion about changing the default cshrc file. > > I'd like to commit something like the following based on Chris's patch > at the end of the thread. This post is an attempt to open the change > to wider discussion. > > commit dbe6cb730686dd53af7d06cc9b69b60e6e55549c > diff --git a/etc/root/dot.cshrc b/etc/root/dot.cshrc > --- a/etc/root/dot.cshrc > +++ b/etc/root/dot.cshrc > @@ -7,9 +7,10 @@ > > alias h history 25 > alias j jobs -l > -alias la ls -a > +alias la ls -aF > alias lf ls -FA > -alias ll ls -lA > +alias ll ls -lAF > +alias ls ls -F > > # A righteous umask > umask 22 > @@ -17,19 +18,24 @@ umask 22 > set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin > /usr/local/bin $HOME/bin) > > setenv EDITOR vi > -setenv PAGER more > +setenv PAGER less > setenv BLOCKSIZE K > > if ($?prompt) then > # An interactive shell -- set some stuff up > set prompt = "`/bin/hostname -s`# " > set filec > - set history = 100 > - set savehist = 100 > + set history = 1 > + set savehist = 1 > + set autolist > + # Use history to aid expansion > + set autoexpand > set mail = (/var/mail/$USER) > if ( $?tcsh ) then > bindkey "^W" backward-delete-word > bindkey -k up history-search-backward > bindkey -k down history-search-forward > endif > + set prompt = "[%n@%m]%c04%# " > + set promptchars = "%#" > endif > In the same line that Wojciech on the PR ".cshrc should be updated for modern hardware" I always set this ones on /usr/share/skel/dot.cshrc bindkey "\e[1~" beginning-of-line #make Home key work; bindkey "\e[2~" overwrite-mode #make Ins key work; bindkey "\e[3~" delete-char #make Delete key work; bindkey "\e[4~" end-of-line #make End key work; Besides that I add an "if [ -d $HOME/bin ]" and add it to $PATH if it exists, but that has nothing to do with ".cshrc should be updated for modern hardware" ... it jsut comes in really handy. my 2 cents ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: [ptrace] please review follow fork/exec changes
On 02/09/2012 04:17 PM, Konstantin Belousov wrote: On Thu, Feb 09, 2012 at 12:48:26PM -0800, Dmitry Mikulin wrote: The semantic of PL_FLAG_EXEC up until now is very simple: it indicates that current stop occured during the first return to usermode after successful exec. The proposed patch breaks the semantic, because now some stops which satisfy the stated condition are no longer marked with the flag. That said, I am lost. You stated that you still need some stops at exec even when not PT_FOLLOW_EXEC is requested. Why usermode cannot remember whether the PT_FOLLOW_EXEC was set for the process, and ignore PL_FLAG_EXEC if not requested ? I was trying to avoid making ugly changes in gdb if it was possible not to make ugly changes in the kernel. I changed gdb to work without PT_FOLLOW_EXEC. So, does the patch below helps you, or did I missed something again ? It works, but I managed to make gdb work without it. So, PT_FOLLOW_EXEC is not needed now. Sorry for the confusion. ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: USB3 and a Seagate FA GoFlex
On Friday 10 February 2012 01:22:53 Sam Fourman Jr. wrote: > hello list, > > I bought a new Seagate FA GoFlex USB3 removable disk running FreeBSD 10.x > CURRENT this disk functions correctly on a USB 2.0 port (I can use zpool > create to create a ZFS pool) > however when attached to a USB 3.0 port it does not function correctly when > attempting to create a zpool i get > > *AutoSense failed* > > this happens across 3 separate computers all running FreeBSD while booting > from a usb stick attached to da0 i enabled USB_DEBUG in the kernel > > any ideas? usbconfig dump_quirk_names Try to add the no sync cache quirk for your disk. Could you show dmesg w/o usb.debug enabled? --HPS ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: Enhancing the user experience with tcsh
On 02/10/12 11:52, Eitan Adler wrote: > In conf/160689 (http://www.freebsd.org/cgi/query-pr.cgi?pr=160689) > there has been some discussion about changing the default cshrc file. > > I'd like to commit something like the following based on Chris's patch > at the end of the thread. This post is an attempt to open the change > to wider discussion. I like the proposed changes, although I don't see why you set the prompt twice? I've also inserted the changes I commonly run with inline below. > commit dbe6cb730686dd53af7d06cc9b69b60e6e55549c > diff --git a/etc/root/dot.cshrc b/etc/root/dot.cshrc > --- a/etc/root/dot.cshrc > +++ b/etc/root/dot.cshrc > @@ -7,9 +7,10 @@ > > alias h history 25 > alias j jobs -l > -alias la ls -a > +alias la ls -aF > alias lf ls -FA > -alias ll ls -lA > +alias ll ls -lAF > +alias ls ls -F > > # A righteous umask > umask 22 > @@ -17,19 +18,24 @@ umask 22 > set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin > /usr/local/bin $HOME/bin) > > setenv EDITOR vi > -setenv PAGER more > +setenv PAGER less > setenv BLOCKSIZE K # Sets SSH_AUTH_SOCK to the user's ssh-agent socket path if running if (${?SSH_AUTH_SOCK} != "1") then setenv SSH_AUTH_SOCK `sockstat | grep ${USER} | grep ssh-agent | awk '{print $6}'` endif > if ($?prompt) then > # An interactive shell -- set some stuff up > set prompt = "`/bin/hostname -s`# " # Useful for root's .cshrc, although I run with it in all my .cshrc if (`id -g` == 0) then set prompt="root@%m# " endif > set filec > - set history = 100 > - set savehist = 100 > + set history = 1 > + set savehist = 1 > + set autolist set autologout = 0 > + # Use history to aid expansion > + set autoexpand > set mail = (/var/mail/$USER) > if ( $?tcsh ) then > bindkey "^W" backward-delete-word > bindkey -k up history-search-backward > bindkey -k down history-search-forward # This maps the "Delete" key to do the right thing # Pressing CTRL-v followed by the key of interest will print the shell's mapping for the key bindkey "^[[3~" delete-char-or-list-or-eof > endif > + set prompt = "[%n@%m]%c04%# " > + set promptchars = "%#" > endif > Cheers, Lawrence ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: Enhancing the user experience with tcsh
Do the promptchars work correctly on csh as well as tcsh? Adrian ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Enhancing the user experience with tcsh
In conf/160689 (http://www.freebsd.org/cgi/query-pr.cgi?pr=160689) there has been some discussion about changing the default cshrc file. I'd like to commit something like the following based on Chris's patch at the end of the thread. This post is an attempt to open the change to wider discussion. commit dbe6cb730686dd53af7d06cc9b69b60e6e55549c diff --git a/etc/root/dot.cshrc b/etc/root/dot.cshrc --- a/etc/root/dot.cshrc +++ b/etc/root/dot.cshrc @@ -7,9 +7,10 @@ alias hhistory 25 alias jjobs -l -alias la ls -a +alias la ls -aF alias lf ls -FA -alias ll ls -lA +alias ll ls -lAF +alias ls ls -F # A righteous umask umask 22 @@ -17,19 +18,24 @@ umask 22 set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin $HOME/bin) setenv EDITOR vi -setenv PAGER more +setenv PAGER less setenv BLOCKSIZE K if ($?prompt) then # An interactive shell -- set some stuff up set prompt = "`/bin/hostname -s`# " set filec - set history = 100 - set savehist = 100 + set history = 1 + set savehist = 1 + set autolist + # Use history to aid expansion + set autoexpand set mail = (/var/mail/$USER) if ( $?tcsh ) then bindkey "^W" backward-delete-word bindkey -k up history-search-backward bindkey -k down history-search-forward endif + set prompt = "[%n@%m]%c04%# " + set promptchars = "%#" endif -- Eitan Adler ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
USB3 and a Seagate FA GoFlex
hello list, I bought a new Seagate FA GoFlex USB3 removable disk running FreeBSD 10.x CURRENT this disk functions correctly on a USB 2.0 port (I can use zpool create to create a ZFS pool) however when attached to a USB 3.0 port it does not function correctly when attempting to create a zpool i get *AutoSense failed* this happens across 3 separate computers all running FreeBSD while booting from a usb stick attached to da0 i enabled USB_DEBUG in the kernel any ideas? Feb 9 18:12:28 kernel: uhub_read_port_status: port 2, wPortStatus=0x0100, wPortChange=0x, err=USB_ERR_NORMAL_COMPLETION Feb 9 18:12:28 kernel: uhub_read_port_status: port 3, wPortStatus=0x0100, wPortChange=0x, err=USB_ERR_NORMAL_COMPLETION Feb 9 18:12:28 kernel: uhub_read_port_status: port 4, wPortStatus=0x0503, wPortChange=0x, err=USB_ERR_NORMAL_COMPLETION Feb 9 18:12:28 kernel: uhub_read_port_status: port 5, wPortStatus=0x0100, wPortChange=0x, err=USB_ERR_NORMAL_COMPLETION Feb 9 18:12:28 kernel: uhub_read_port_status: port 6, wPortStatus=0x0100, wPortChange=0x, err=USB_ERR_NORMAL_COMPLETION Feb 9 18:12:28 kernel: uhub_read_port_status: port 7, wPortStatus=0x0100, wPortChange=0x, err=USB_ERR_NORMAL_COMPLETION Feb 9 18:12:28 kernel: uhub_read_port_status: port 8, wPortStatus=0x0100, wPortChange=0x, err=USB_ERR_NORMAL_COMPLETION Feb 9 18:12:28 kernel: uhub_read_port_status: port 2, wPortStatus=0x0500, wPortChange=0x, err=USB_ERR_NORMAL_COMPLETION Feb 9 18:13:18 kernel: ugen1.2: at usbus1 (disconnected) Feb 9 18:13:18 kernel: umass1: at uhub1, port 1, addr 1 (disconnected) Feb 9 18:13:18 kernel: (da1:umass-sim1:1:0:0): lost device - 0 outstanding, 0 refs Feb 9 18:13:18 kernel: (da1:umass-sim1:1:0:0): removing device entry Feb 9 18:13:32 kernel: usb_needs_explore: Feb 9 18:13:32 kernel: usb_bus_powerd: bus=0xff8001d90cd8 Feb 9 18:13:32 kernel: uhub_explore: udev=0xfe001ba93800 addr=1 Feb 9 18:13:32 kernel: uhub_read_port_status: port 1, wPortStatus=0x0503, wPortChange=0x, err=USB_ERR_NORMAL_COMPLETION Feb 9 18:13:32 kernel: uhub_explore: udev=0xfe001bb3c800 addr=2 Feb 9 18:13:32 kernel: uhub_read_port_status: port 1, wPortStatus=0x0100, wPortChange=0x, err=USB_ERR_NORMAL_COMPLETION Feb 9 18:13:32 kernel: uhub_read_port_status: port 2, wPortStatus=0x0503, wPortChange=0x, err=USB_ERR_NORMAL_COMPLETION Feb 9 18:13:32 kernel: uhub_read_port_status: port 3, wPortStatus=0x0100, wPortChange=0x, err=USB_ERR_NORMAL_COMPLETION Feb 9 18:13:32 kernel: uhub_read_port_status: port 4, wPortStatus=0x0100, wPortChange=0x, err=USB_ERR_NORMAL_COMPLETION Feb 9 18:13:32 kernel: uhub_read_port_status: port 5, wPortStatus=0x0103, wPortChange=0x, err=USB_ERR_NORMAL_COMPLETION Feb 9 18:13:32 kernel: uhub_read_port_status: port 6, wPortStatus=0x0100, wPortChange=0x, err=USB_ERR_NORMAL_COMPLETION Feb 9 18:13:32 kernel: uhub_read_port_status: port 2, wPortStatus=0x0500, wPortChange=0x, err=USB_ERR_NORMAL_COMPLETION Feb 9 18:13:32 kernel: usb_needs_explore: Feb 9 18:13:32 kernel: usb_bus_powerd: bus=0xff8001e04cd8 Feb 9 18:13:32 kernel: usb_bus_powerd: Recomputing power masks Feb 9 18:13:32 kernel: uhub_explore: udev=0xfe001bb3d000 addr=1 Feb 9 18:13:32 kernel: uhub_read_port_status: port 1, wPortStatus=0x0503, wPortChange=0x, err=USB_ERR_NORMAL_COMPLETION Feb 9 18:13:32 kernel: uhub_explore: udev=0xfe001bb3c000 addr=2 Feb 9 18:13:32 kernel: usbd_transfer_power_ref: Adding type 0 to power state Feb 9 18:13:32 kernel: usbd_transfer_power_ref: needs power Feb 9 18:13:32 kernel: uhub_read_port_status: port 1, wPortStatus=0x0100, wPortChange=0x, err=USB_ERR_NORMAL_COMPLETION Feb 9 18:13:32 kernel: uhub_read_port_status: port 2, wPortStatus=0x0100, wPortChange=0x, err=USB_ERR_NORMAL_COMPLETION Feb 9 18:13:32 kernel: uhub_read_port_status: port 3, wPortStatus=0x0100, wPortChange=0x, err=USB_ERR_NORMAL_COMPLETION Feb 9 18:13:32 kernel: uhub_read_port_status: port 4, wPortStatus=0x0503, wPortChange=0x, err=USB_ERR_NORMAL_COMPLETION Feb 9 18:13:32 kernel: uhub_read_port_status: port 5, wPortStatus=0x0100, wPortChange=0x, err=USB_ERR_NORMAL_COMPLETION Feb 9 18:13:32 kernel: uhub_read_port_status: port 6, wPortStatus=0x0100, wPortChange=0x, err=USB_ERR_NORMAL_COMPLETION Feb 9 18:13:32 kernel: uhub_read_port_status: port 7, wPortStatus=0x0100, wPortChange=0x, err=USB_ERR_NORMAL_COMPLETION Feb 9 18:13:32 kernel: uhub_read_port_status: port 8, wPortStatus=0x0100, wPortChange=0x, err=USB_ERR_NORMAL_COMPLETION Feb 9 18:13:32 kernel: uhub_read_port_status: port 2, wPortStatus=0x0500, wPortChange=0x, err=USB_ERR_NORMAL_COMPLETION Feb 9 18:13:32 kernel: usbd_transfer_power_ref: Adding type 2 to power state Feb 9 18:13:32 kernel: usbd_transfer_power_ref: needs power Feb 9 18:13:35 kernel: usb_needs_explore: Feb 9 18:13:35 kernel: usb_bus_powerd: bus=0xff8001dfa170 Feb 9
Re: [ptrace] please review follow fork/exec changes
On Thu, Feb 09, 2012 at 12:48:26PM -0800, Dmitry Mikulin wrote: > > >The semantic of PL_FLAG_EXEC up until now is very simple: it indicates > >that current stop occured during the first return to usermode after > >successful exec. The proposed patch breaks the semantic, because now > >some stops which satisfy the stated condition are no longer marked with > >the flag. > > > >That said, I am lost. You stated that you still need some stops at > >exec even when not PT_FOLLOW_EXEC is requested. Why usermode cannot > >remember whether the PT_FOLLOW_EXEC was set for the process, and ignore > >PL_FLAG_EXEC if not requested ? > > I was trying to avoid making ugly changes in gdb if it was possible not to > make ugly changes in the kernel. I changed gdb to work without > PT_FOLLOW_EXEC. So, does the patch below helps you, or did I missed something again ? > > >I just gave up and added PL_FLAG_EXECF, which is set when PT_FOLLOW_EXEC > >was set and exec is active. Would this work for your purposes ? > >PL_FLAG_EXECF has the same semantic as PL_FLAG_EXEC had in your > >follow-exec.patch. But the stop set is not changed comparing with the > >stock src. > > > >Are you fine with PL_FLAG_CHILD part of the changes ? If yes, I will > >commit it to make some progress. > > yes, the PL_FLAG_CHILD part works for me. > Please commit it and we can move on to the next part of the review. Committed as r231320. Below is what left for PT_FOLLOWEXEC. diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c index 2060efe..4f93a79 100644 --- a/sys/kern/sys_process.c +++ b/sys/kern/sys_process.c @@ -660,6 +660,7 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) case PT_TO_SCX: case PT_SYSCALL: case PT_FOLLOW_FORK: + case PT_FOLLOW_EXEC: case PT_DETACH: sx_xlock(&proctree_lock); proctree_locked = 1; @@ -873,6 +874,12 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) else p->p_flag &= ~P_FOLLOWFORK; break; + case PT_FOLLOW_EXEC: + if (data) + p->p_flag |= P_FOLLOWEXEC; + else + p->p_flag &= ~P_FOLLOWEXEC; + break; case PT_STEP: case PT_CONTINUE: @@ -936,7 +943,8 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) p->p_sigparent = SIGCHLD; } p->p_oppid = 0; - p->p_flag &= ~(P_TRACED | P_WAITED | P_FOLLOWFORK); + p->p_flag &= ~(P_TRACED | P_WAITED | P_FOLLOWFORK | + P_FOLLOWEXEC); /* should we send SIGCHLD? */ /* childproc_continued(p); */ @@ -1139,8 +1147,11 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) pl->pl_flags |= PL_FLAG_SCE; else if (td2->td_dbgflags & TDB_SCX) pl->pl_flags |= PL_FLAG_SCX; - if (td2->td_dbgflags & TDB_EXEC) + if (td2->td_dbgflags & TDB_EXEC) { pl->pl_flags |= PL_FLAG_EXEC; + if (p->p_flag & P_FOLLOWEXEC) + pl->pl_flags |= PL_FLAG_EXECF; + } if (td2->td_dbgflags & TDB_FORK) { pl->pl_flags |= PL_FLAG_FORKED; pl->pl_child_pid = td2->td_dbg_forked; diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 0245e88..bec7223 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -614,6 +614,7 @@ struct proc { #defineP_HWPMC 0x80 /* Process is using HWPMCs */ #defineP_JAILED0x100 /* Process is in jail. */ +#defineP_FOLLOWEXEC0x200 /* Report execs with ptrace. */ #defineP_INEXEC0x400 /* Process is in execve(). */ #defineP_STATCHILD 0x800 /* Child process stopped or exited. */ #defineP_INMEM 0x1000 /* Loaded into memory. */ diff --git a/sys/sys/ptrace.h b/sys/sys/ptrace.h index 8a02495..81cebfc 100644 --- a/sys/sys/ptrace.h +++ b/sys/sys/ptrace.h @@ -64,6 +64,7 @@ #definePT_SYSCALL 22 #definePT_FOLLOW_FORK 23 +#definePT_FOLLOW_EXEC 24 #define PT_GETREGS 33 /* get general-purpose registers */ #define PT_SETREGS 34 /* set general-purpose registers */ @@ -100,14 +101,15 @@ struct ptrace_lwpinfo { #definePL_EVENT_NONE 0 #definePL_EVENT_SIGNAL 1 int pl_flags; /* LWP flags. */ -#definePL_FLAG_SA 0x01/* M:N thread */ -#definePL_FLAG_BOUND 0x02/* M:N bound thread */ -#definePL_FLAG_SCE 0x04/* syscall enter point */ -#definePL_FLAG_SCX 0x08/* syscall leave point */ -#define
zfs commit breaks zvol, istgt?
Hi all, Previous kernel I was running on a test SAN was 9-STABLE from Jan 24th. Sorry, no commit # -- didn't have svn on the machine back then. Today I built r231282 because it had an interesting fix in it: r231141 | mm | 2012-02-07 11:57:33 -0600 (Tue, 07 Feb 2012) | 25 lines MFC r230514: Merge illumos revisions 13572, 13573, 13574: Rev. 13572: disk sync write perf regression when slog is used post oi_148 [1] Rev. 13573: crash during reguid causes stale config [2] allow and unallow missing from zpool history since removal of pyzfs [5] Rev. 13574: leaking a vdev when removing an l2cache device [3] memory leak when adding a file-based l2arc device [4] leak in ZFS from metaslab_group_create and zfs_ereport_checksum [6] References: https://www.illumos.org/issues/1909 [1] https://www.illumos.org/issues/1949 [2] https://www.illumos.org/issues/1951 [3] https://www.illumos.org/issues/1952 [4] https://www.illumos.org/issues/1953 [5] https://www.illumos.org/issues/1954 [6] Obtained from: illumos (issues #1909, #1949, #1951, #1952, #1953, #1954) After booting into this kernel iSCSI was hosed. None of the ESXi servers looking at it could do any I/O at all. Weird errors in the istgt log, too: Feb 9 16:26:23 zfs-san2 istgt[8177]: Login from iqn.1998-01.com.vmware:esx1-21ecbe81 (172.16.17.41) on iqn.2011-12.net.supranet.san2.istgt:lun7 LU7 (172.16.17.182:3260,1), ISID=23d02, TSIH=4, CID=0, HeaderDigest=off, DataDigest=off Feb 9 16:26:23 zfs-san2 istgt[8177]: istgt_iscsi.c: 777:istgt_iscsi_write_pdu_internal: ***ERROR*** iscsi_write() failed (errno=32) Feb 9 16:26:23 zfs-san2 istgt[8177]: istgt_iscsi.c:4984:sender: ***ERROR*** iscsi_write_pdu() failed on iqn.2011-12.net.supranet.san2.istgt:lun7,t,0x0001(iqn.1998-01.com.vmware:esx1-21ecbe81,i,0x00023d02) I didn't see any other commits between that could cause this, but can anyone else confirm? After rebooting into the Jan 24th kernel everything went back to normal... Thanks, Mark zfs-san2# zfs list NAMEUSED AVAIL REFER MOUNTPOINT tank 8.25T 7.76T 1.05M /tank tank/LUN1 1.03T 8.77T 24.7G - tank/LUN2 1.03T 8.77T 19.7G - tank/LUN3 1.03T 8.70T 93.6G - tank/LUN4 1.03T 8.77T 19.3G - tank/LUN5 1.03T 8.79T 44.1K - tank/LUN6 1.03T 8.79T 44.1K - tank/LUN7 1.03T 8.79T 44.1K - tank/LUN8 1.03T 8.79T 44.1K - tank/nfs 2.30G 7.76T 2.30G /tank/nfs zfs-san2# zpool status pool: tank state: ONLINE scan: scrub repaired 0 in 0h0m with 0 errors on Thu Jan 26 17:05:40 2012 config: NAME STATE READ WRITE CKSUM tank ONLINE 0 0 0 raidz1-0ONLINE 0 0 0 multipath/disk01 ONLINE 0 0 0 multipath/disk02 ONLINE 0 0 0 multipath/disk03 ONLINE 0 0 0 multipath/disk04 ONLINE 0 0 0 raidz1-1ONLINE 0 0 0 multipath/disk05 ONLINE 0 0 0 multipath/disk06 ONLINE 0 0 0 multipath/disk07 ONLINE 0 0 0 multipath/disk08 ONLINE 0 0 0 raidz1-2ONLINE 0 0 0 multipath/disk09 ONLINE 0 0 0 multipath/disk10 ONLINE 0 0 0 multipath/disk11 ONLINE 0 0 0 multipath/disk12 ONLINE 0 0 0 logs da1 ONLINE 0 0 0 cache da2 ONLINE 0 0 0 da3 ONLINE 0 0 0 errors: No known data errors ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: [ptrace] please review follow fork/exec changes
The semantic of PL_FLAG_EXEC up until now is very simple: it indicates that current stop occured during the first return to usermode after successful exec. The proposed patch breaks the semantic, because now some stops which satisfy the stated condition are no longer marked with the flag. That said, I am lost. You stated that you still need some stops at exec even when not PT_FOLLOW_EXEC is requested. Why usermode cannot remember whether the PT_FOLLOW_EXEC was set for the process, and ignore PL_FLAG_EXEC if not requested ? I was trying to avoid making ugly changes in gdb if it was possible not to make ugly changes in the kernel. I changed gdb to work without PT_FOLLOW_EXEC. I just gave up and added PL_FLAG_EXECF, which is set when PT_FOLLOW_EXEC was set and exec is active. Would this work for your purposes ? PL_FLAG_EXECF has the same semantic as PL_FLAG_EXEC had in your follow-exec.patch. But the stop set is not changed comparing with the stock src. Are you fine with PL_FLAG_CHILD part of the changes ? If yes, I will commit it to make some progress. yes, the PL_FLAG_CHILD part works for me. Please commit it and we can move on to the next part of the review. ___ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: [ptrace] please review follow fork/exec changes
On Wed, Feb 08, 2012 at 04:51:57PM -0800, Dmitry Mikulin wrote: > The patch I sent earlier works for me. Just wanted to let you know to > illustrate what I would like to see from the kernel. > > I'm trying to see if there's way not to add flags with semantics similar to > TDB_EXEC. I think the problem with TDB_EXEC is that is serves a trigger for > a stop as well as an indicator to return PL_FLAG_EXEC. And in my case I > still want to see all the stops but I only want to see the PL_FLAG_EXEC > when PT_FOLLOW_EXEC is specified. > > Do you think the attached patch will do what I'd like without compromising > existing functionality? > The semantic of PL_FLAG_EXEC up until now is very simple: it indicates that current stop occured during the first return to usermode after successful exec. The proposed patch breaks the semantic, because now some stops which satisfy the stated condition are no longer marked with the flag. That said, I am lost. You stated that you still need some stops at exec even when not PT_FOLLOW_EXEC is requested. Why usermode cannot remember whether the PT_FOLLOW_EXEC was set for the process, and ignore PL_FLAG_EXEC if not requested ? I just gave up and added PL_FLAG_EXECF, which is set when PT_FOLLOW_EXEC was set and exec is active. Would this work for your purposes ? PL_FLAG_EXECF has the same semantic as PL_FLAG_EXEC had in your follow-exec.patch. But the stop set is not changed comparing with the stock src. Are you fine with PL_FLAG_CHILD part of the changes ? If yes, I will commit it to make some progress. diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 60639c9..e447c93 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -1035,7 +1035,9 @@ fork_return(struct thread *td, struct trapframe *frame) p->p_oppid = p->p_pptr->p_pid; proc_reparent(p, dbg); sx_xunlock(&proctree_lock); + td->td_dbgflags |= TDB_CHILD; ptracestop(td, SIGSTOP); + td->td_dbgflags &= ~TDB_CHILD; } else { /* * ... otherwise clear the request. diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c index 4510380..4f93a79 100644 --- a/sys/kern/sys_process.c +++ b/sys/kern/sys_process.c @@ -660,6 +660,7 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) case PT_TO_SCX: case PT_SYSCALL: case PT_FOLLOW_FORK: + case PT_FOLLOW_EXEC: case PT_DETACH: sx_xlock(&proctree_lock); proctree_locked = 1; @@ -873,6 +874,12 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) else p->p_flag &= ~P_FOLLOWFORK; break; + case PT_FOLLOW_EXEC: + if (data) + p->p_flag |= P_FOLLOWEXEC; + else + p->p_flag &= ~P_FOLLOWEXEC; + break; case PT_STEP: case PT_CONTINUE: @@ -936,7 +943,8 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) p->p_sigparent = SIGCHLD; } p->p_oppid = 0; - p->p_flag &= ~(P_TRACED | P_WAITED | P_FOLLOWFORK); + p->p_flag &= ~(P_TRACED | P_WAITED | P_FOLLOWFORK | + P_FOLLOWEXEC); /* should we send SIGCHLD? */ /* childproc_continued(p); */ @@ -1139,12 +1147,17 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) pl->pl_flags |= PL_FLAG_SCE; else if (td2->td_dbgflags & TDB_SCX) pl->pl_flags |= PL_FLAG_SCX; - if (td2->td_dbgflags & TDB_EXEC) + if (td2->td_dbgflags & TDB_EXEC) { pl->pl_flags |= PL_FLAG_EXEC; + if (p->p_flag & P_FOLLOWEXEC) + pl->pl_flags |= PL_FLAG_EXECF; + } if (td2->td_dbgflags & TDB_FORK) { pl->pl_flags |= PL_FLAG_FORKED; pl->pl_child_pid = td2->td_dbg_forked; } + if (td2->td_dbgflags & TDB_CHILD) + pl->pl_flags |= PL_FLAG_CHILD; pl->pl_sigmask = td2->td_sigmask; pl->pl_siglist = td2->td_siglist; strcpy(pl->pl_tdname, td2->td_name); diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 9ebfe83..bec7223 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -384,6 +384,7 @@ do { \ process */ #defineTDB_STOPATFORK 0x0080 /* Stop at the return from fork (child