From owner-freebsd-hackers@FreeBSD.ORG Sun Dec 21 02:31:50 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 320B0106564A for ; Sun, 21 Dec 2008 02:31:50 +0000 (UTC) (envelope-from michelle_li_001@yahoo.com) Received: from web65403.mail.ac4.yahoo.com (web65403.mail.ac4.yahoo.com [76.13.9.23]) by mx1.freebsd.org (Postfix) with SMTP id 8EED18FC08 for ; Sun, 21 Dec 2008 02:31:49 +0000 (UTC) (envelope-from michelle_li_001@yahoo.com) Received: (qmail 24097 invoked by uid 60001); 21 Dec 2008 02:05:06 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=lAp1Uf8M7FKXYhhQnswZrA2mVMj/cFajQFtBaMpxM7q4hsuAEEQJJYQX5aqzIvqgQAdsGgD23gRSv0vwgRBSoQogOny2J+jm61J3vCDRYf2udspEgaco4R6d/L2oPcYVrCzcBT5kzSrPQ+spLZM75hpR69yTCBL9p27EDgkcBe8=; X-YMail-OSG: gg5e6nwVM1nCQDoryBQxEGTAAc_2sj2A.XlhEPLYSNKqgZxjU1OfeiPiIZiR2jT1deqeLC.XD51ZGY9NpL6l.d5B6hYZH_jecAw82VyHrU08Wq3cG_V9SYugBxjGZfjh7kV3HsBAUguq6iGji6m9AC2w8e5N6enlSiMbrsPyl2oTvt5n.vyf1vjHbi3yZhI- Received: from [68.110.123.27] by web65403.mail.ac4.yahoo.com via HTTP; Sat, 20 Dec 2008 18:05:06 PST Date: Sat, 20 Dec 2008 18:05:06 -0800 (PST) From: Michelle Li To: freebsd-hackers@freebsd.org In-Reply-To: <20081220120017.322FA10656E1@hub.freebsd.org> MIME-Version: 1.0 Message-ID: <823694.23548.qm@web65403.mail.ac4.yahoo.com> Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: reg: adding proc to allproc (Ferner Cilloniz) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Dec 2008 02:31:50 -0000 reg: adding proc to allproc (Ferner Cilloniz) new_entry->p ..... is accessing the "read/write" pointer declared in the proc_ll struct new_entry->p = p; is attempting an assignment of a "read ONLY" const pointer that has been passed into add_proc_entry() to a "read/write" pointer new_entry->"read/write pointer" = "read ONLY pointer"; is invalid "new_entry->p = p; // maybe doing this assignment isnt correct?" with this assertion I agree freebsd-hackers-request@freebsd.org wrote: Send freebsd-hackers mailing list submissions to freebsd-hackers@freebsd.org To subscribe or unsubscribe via the World Wide Web, visit http://lists.freebsd.org/mailman/listinfo/freebsd-hackers or, via email, send a message with subject or body 'help' to freebsd-hackers-request@freebsd.org You can reach the person managing the list at freebsd-hackers-owner@freebsd.org When replying, please edit your Subject line so it is more specific than "Re: Contents of freebsd-hackers digest..." Today's Topics: 1. adding proc to allproc (Ferner Cilloniz) 2. Re: adding proc to allproc (Julian Elischer) 3. Re: adding proc to allproc (Ferner Cilloniz) 4. Re: adding proc to allproc (Julian Elischer) 5. Re: adding proc to allproc (Ferner Cilloniz) ---------------------------------------------------------------------- Message: 1 Date: Fri, 19 Dec 2008 22:39:20 +0000 From: Ferner Cilloniz Subject: adding proc to allproc To: freebsd-hackers@freebsd.org Message-ID: <1229726360.5614.15.camel@mobiliare.Belkin> Content-Type: text/plain Hello everyone. I am playing with freebsd and just learning some things about the FreeBSD kernel. So for my first quest i am placing random processes from the allproc list into a list of my own and trying to add them back into allproc I have pasted the code below. ----------------------------------------------------------------------- struct proc *p = a process from my own list; if( p != NULL && (p->p_state == PRS_NEW || p->p_state == PRS_NORMAL) ){ LIST_INSERT_HEAD(&allproc, p, p_list); } ----------------------------------------------------------------------- Thanks. ------------------------------ Message: 2 Date: Fri, 19 Dec 2008 21:27:34 -0800 From: Julian Elischer Subject: Re: adding proc to allproc To: Ferner Cilloniz Cc: freebsd-hackers@freebsd.org Message-ID: <494C8246.3020703@elischer.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Ferner Cilloniz wrote: > Hello everyone. > > I am playing with freebsd and just learning some things about the > FreeBSD kernel. > > So for my first quest i am placing random processes from the allproc > list into a list of my own and trying to add them back into allproc > > I have pasted the code below. > > ----------------------------------------------------------------------- > struct proc *p = a process from my own list; > if( p != NULL && (p->p_state == PRS_NEW || p->p_state == PRS_NORMAL) ){ > LIST_INSERT_HEAD(&allproc, p, p_list); > } > ----------------------------------------------------------------------- > > Thanks. and your question is? > > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" ------------------------------ Message: 3 Date: Fri, 19 Dec 2008 23:28:46 +0000 From: Ferner Cilloniz Subject: Re: adding proc to allproc To: Julian Elischer Cc: freebsd-hackers@freebsd.org Message-ID: <1229729326.5614.16.camel@mobiliare.Belkin> Content-Type: text/plain When i run the code from a KLD it hangs the system. No reboot occurs however, it just hangs there. On Fri, 2008-12-19 at 21:27 -0800, Julian Elischer wrote: > Ferner Cilloniz wrote: > > Hello everyone. > > > > I am playing with freebsd and just learning some things about the > > FreeBSD kernel. > > > > So for my first quest i am placing random processes from the allproc > > list into a list of my own and trying to add them back into allproc > > > > I have pasted the code below. > > > > ----------------------------------------------------------------------- > > struct proc *p = a process from my own list; > > if( p != NULL && (p->p_state == PRS_NEW || p->p_state == PRS_NORMAL) ){ > > LIST_INSERT_HEAD(&allproc, p, p_list); > > } > > ----------------------------------------------------------------------- > > > > Thanks. > > and your question is? > > > > > > _______________________________________________ > > freebsd-hackers@freebsd.org mailing list > > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > -- Cilloniz Bicchi, Ferner Research Assistant Dept. of Computer Sciences The University of Texas at Austin http://www.cs.utexas.edu/~fernercc fernercc@cs.utexas.edu ------------------------------ Message: 4 Date: Fri, 19 Dec 2008 21:39:20 -0800 From: Julian Elischer Subject: Re: adding proc to allproc To: Ferner Cilloniz Cc: freebsd-hackers@freebsd.org Message-ID: <494C8508.2020000@elischer.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Ferner Cilloniz wrote: > When i run the code from a KLD it hangs the system. No reboot occurs > however, it just hangs there. well, firstly you have no locking though that would probably let you get away with it most times. Where does the process come from in the first place? It sounds like you are making a circular list somewhere or somehow... have you tried going into ddb? > > > On Fri, 2008-12-19 at 21:27 -0800, Julian Elischer wrote: >> Ferner Cilloniz wrote: >>> Hello everyone. >>> >>> I am playing with freebsd and just learning some things about the >>> FreeBSD kernel. >>> >>> So for my first quest i am placing random processes from the allproc >>> list into a list of my own and trying to add them back into allproc >>> >>> I have pasted the code below. >>> >>> ----------------------------------------------------------------------- >>> struct proc *p = a process from my own list; >>> if( p != NULL && (p->p_state == PRS_NEW || p->p_state == PRS_NORMAL) ){ >>> LIST_INSERT_HEAD(&allproc, p, p_list); >>> } >>> ----------------------------------------------------------------------- >> >>> _______________________________________________ >>> freebsd-hackers@freebsd.org mailing list >>> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers >>> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" ------------------------------ Message: 5 Date: Sat, 20 Dec 2008 02:23:20 +0000 From: Ferner Cilloniz Subject: Re: adding proc to allproc To: Julian Elischer Cc: freebsd-hackers@freebsd.org Message-ID: <1229739800.5614.24.camel@mobiliare.Belkin> Content-Type: text/plain The process comes from the allproc list. I am simply iterating through this list and removing the first 1/2 of allproc list and adding the removed process to my own singly linked list. LIST_REMOVE(current_proc, p_list); // remove from the allproc add_proc_entry(current_proc); Later, i am iterating through my singly linked list and doing the below: struct proc *p = current->p; f( p != NULL && (p->p_state == PRS_NEW || p->p_state == PRS_NORMAL) ){ LIST_INSERT_HEAD(&allproc, p, p_list); } Could this be causing a circular list? I am adding the proc entries to my singly linked list as follows: static void add_proc_entry(const struct proc *p) { struct proc_ll *new_entry = (struct proc_ll*)malloc(sizeof(struct proc_ll), M_TEMP, M_ZERO | M_NOWAIT); int done = 0; new_entry->p = p; // maybe doing this assignment isnt correct? if(proc_entries == NULL) { proc_entries = new_entry; return; } struct proc_ll *current = proc_entries; while(current != NULL) { if(current->next == NULL) { current->next = new_entry; break; } current = current->next; } } struct proc_ll { struct proc *p; struct proc_ll *next; }; A circular list does sound like it could cause hanging to occur but the above code, atleast from my eyes, doesn't seem to cause it. On Fri, 2008-12-19 at 21:39 -0800, Julian Elischer wrote: > Ferner Cilloniz wrote: > > When i run the code from a KLD it hangs the system. No reboot occurs > > however, it just hangs there. > > well, firstly you have no locking though that would probably let you > get away with it most times. > > Where does the process come from in the first place? > > It sounds like you are making a circular list somewhere or somehow... > > have you tried going into ddb? > > > > > > > > > > On Fri, 2008-12-19 at 21:27 -0800, Julian Elischer wrote: > >> Ferner Cilloniz wrote: > >>> Hello everyone. > >>> > >>> I am playing with freebsd and just learning some things about the > >>> FreeBSD kernel. > >>> > >>> So for my first quest i am placing random processes from the allproc > >>> list into a list of my own and trying to add them back into allproc > >>> > >>> I have pasted the code below. > >>> > >>> ----------------------------------------------------------------------- > >>> struct proc *p = a process from my own list; > >>> if( p != NULL && (p->p_state == PRS_NEW || p->p_state == PRS_NORMAL) ){ > >>> LIST_INSERT_HEAD(&allproc, p, p_list); > >>> } > >>> ----------------------------------------------------------------------- > > >> > >>> _______________________________________________ > >>> freebsd-hackers@freebsd.org mailing list > >>> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > >>> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > ------------------------------ _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" End of freebsd-hackers Digest, Vol 299, Issue 5 *********************************************** From owner-freebsd-hackers@FreeBSD.ORG Sun Dec 21 02:49:44 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8FA1A1065673 for ; Sun, 21 Dec 2008 02:49:44 +0000 (UTC) (envelope-from fernercc@gmail.com) Received: from yx-out-2324.google.com (yx-out-2324.google.com [74.125.44.28]) by mx1.freebsd.org (Postfix) with ESMTP id 433CA8FC1B for ; Sun, 21 Dec 2008 02:49:43 +0000 (UTC) (envelope-from fernercc@gmail.com) Received: by yx-out-2324.google.com with SMTP id 8so1273272yxb.13 for ; Sat, 20 Dec 2008 18:49:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:cc :in-reply-to:references:content-type:date:message-id:mime-version :x-mailer:content-transfer-encoding; bh=CKeGXQVhokel5zX4AhwZZ7jKq6uOYg/oIJAbAdq9PRA=; b=AVo5/t8cN4vYl0IrDSB1iPwewT1Nj0w81EbaD54T+azDIhmSjRqwLuwiHpgHF04cHc YWMsHY6bEtPySs4YB4UWvSpN/DiuBO+H3OAfyc7aOI5eIXvv7+9lJe89IgqdBzdGI84o ZDgN4yJoY0iGTnON/9k4/sUzsC/zFGSUibF4s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:cc:in-reply-to:references:content-type:date :message-id:mime-version:x-mailer:content-transfer-encoding; b=QoBhK7APYWweSIhu1YLjWmaxqa+MqxaK0RvKAUsXLUPeAllxLQxLAPliZe44LIJa7z 9OKB8rbtPQY6z4YDIj49SIqZNiv+K1yickBr7tB7LR/ex+nAjjFC9io+Zz/ghtBNQ+lF 15/LP+yEEgLcoQa03B4VXyygIfc6qMVNws6yU= Received: by 10.100.128.2 with SMTP id a2mr3138620and.93.1229827783323; Sat, 20 Dec 2008 18:49:43 -0800 (PST) Received: from ?192.168.2.2? (cpe-70-112-179-136.austin.res.rr.com [70.112.179.136]) by mx.google.com with ESMTPS id c1sm6561577ana.36.2008.12.20.18.49.41 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 20 Dec 2008 18:49:42 -0800 (PST) From: Ferner Cilloniz To: Michelle Li In-Reply-To: <823694.23548.qm@web65403.mail.ac4.yahoo.com> References: <823694.23548.qm@web65403.mail.ac4.yahoo.com> Content-Type: text/plain Date: Sat, 20 Dec 2008 20:49:39 +0000 Message-Id: <1229806179.4952.3.camel@mobiliare.Belkin> Mime-Version: 1.0 X-Mailer: Evolution 2.24.2 Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: reg: adding proc to allproc X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Dec 2008 02:49:44 -0000 for the sake of this discussion its suffice to consider new_entry->p as read-only pointer because i never modify it. I am just storing its address. It easily just be considered an unsigned long value. However, would really calling LIST_INSERT_HEAD(&allproc, entry->p, p_list) result in a hang of the system? I'm flipping through pages in FreeBSD design and implementation right now. On Sat, 2008-12-20 at 18:05 -0800, Michelle Li wrote: > reg: adding proc to allproc (Ferner Cilloniz) > > new_entry->p ..... > is accessing the "read/write" pointer declared in the proc_ll struct > > new_entry->p = p; > is attempting an assignment of a "read ONLY" const pointer that > has been passed into add_proc_entry() to a "read/write" pointer > > new_entry->"read/write pointer" = "read ONLY pointer"; > is invalid > > "new_entry->p = p; // maybe doing this assignment isnt correct?" > with this assertion I agree > > > freebsd-hackers-request@freebsd.org wrote: Send freebsd-hackers mailing list submissions to > freebsd-hackers@freebsd.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > or, via email, send a message with subject or body 'help' to > freebsd-hackers-request@freebsd.org > > You can reach the person managing the list at > freebsd-hackers-owner@freebsd.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of freebsd-hackers digest..." > > > Today's Topics: > > 1. adding proc to allproc (Ferner Cilloniz) > 2. Re: adding proc to allproc (Julian Elischer) > 3. Re: adding proc to allproc (Ferner Cilloniz) > 4. Re: adding proc to allproc (Julian Elischer) > 5. Re: adding proc to allproc (Ferner Cilloniz) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Fri, 19 Dec 2008 22:39:20 +0000 > From: Ferner Cilloniz > Subject: adding proc to allproc > To: freebsd-hackers@freebsd.org > Message-ID: <1229726360.5614.15.camel@mobiliare.Belkin> > Content-Type: text/plain > > Hello everyone. > > I am playing with freebsd and just learning some things about the > FreeBSD kernel. > > So for my first quest i am placing random processes from the allproc > list into a list of my own and trying to add them back into allproc > > I have pasted the code below. > > ----------------------------------------------------------------------- > struct proc *p = a process from my own list; > if( p != NULL && (p->p_state == PRS_NEW || p->p_state == PRS_NORMAL) ){ > LIST_INSERT_HEAD(&allproc, p, p_list); > } > ----------------------------------------------------------------------- > > Thanks. > > > > ------------------------------ > > Message: 2 > Date: Fri, 19 Dec 2008 21:27:34 -0800 > From: Julian Elischer > Subject: Re: adding proc to allproc > To: Ferner Cilloniz > Cc: freebsd-hackers@freebsd.org > Message-ID: <494C8246.3020703@elischer.org> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > Ferner Cilloniz wrote: > > Hello everyone. > > > > I am playing with freebsd and just learning some things about the > > FreeBSD kernel. > > > > So for my first quest i am placing random processes from the allproc > > list into a list of my own and trying to add them back into allproc > > > > I have pasted the code below. > > > > ----------------------------------------------------------------------- > > struct proc *p = a process from my own list; > > if( p != NULL && (p->p_state == PRS_NEW || p->p_state == PRS_NORMAL) ){ > > LIST_INSERT_HEAD(&allproc, p, p_list); > > } > > ----------------------------------------------------------------------- > > > > Thanks. > > and your question is? > > > > > > _______________________________________________ > > freebsd-hackers@freebsd.org mailing list > > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > > > > ------------------------------ > > Message: 3 > Date: Fri, 19 Dec 2008 23:28:46 +0000 > From: Ferner Cilloniz > Subject: Re: adding proc to allproc > To: Julian Elischer > Cc: freebsd-hackers@freebsd.org > Message-ID: <1229729326.5614.16.camel@mobiliare.Belkin> > Content-Type: text/plain > > When i run the code from a KLD it hangs the system. No reboot occurs > however, it just hangs there. > > > On Fri, 2008-12-19 at 21:27 -0800, Julian Elischer wrote: > > Ferner Cilloniz wrote: > > > Hello everyone. > > > > > > I am playing with freebsd and just learning some things about the > > > FreeBSD kernel. > > > > > > So for my first quest i am placing random processes from the allproc > > > list into a list of my own and trying to add them back into allproc > > > > > > I have pasted the code below. > > > > > > ----------------------------------------------------------------------- > > > struct proc *p = a process from my own list; > > > if( p != NULL && (p->p_state == PRS_NEW || p->p_state == PRS_NORMAL) ){ > > > LIST_INSERT_HEAD(&allproc, p, p_list); > > > } > > > ----------------------------------------------------------------------- > > > > > > Thanks. > > > > and your question is? > > > > > > > > > > _______________________________________________ > > > freebsd-hackers@freebsd.org mailing list > > > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > > > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > > > -- > Cilloniz Bicchi, Ferner > > Research Assistant > Dept. of Computer Sciences > The University of Texas at Austin > http://www.cs.utexas.edu/~fernercc > fernercc@cs.utexas.edu > > > > ------------------------------ > > Message: 4 > Date: Fri, 19 Dec 2008 21:39:20 -0800 > From: Julian Elischer > Subject: Re: adding proc to allproc > To: Ferner Cilloniz > Cc: freebsd-hackers@freebsd.org > Message-ID: <494C8508.2020000@elischer.org> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > Ferner Cilloniz wrote: > > When i run the code from a KLD it hangs the system. No reboot occurs > > however, it just hangs there. > > well, firstly you have no locking though that would probably let you > get away with it most times. > > Where does the process come from in the first place? > > It sounds like you are making a circular list somewhere or somehow... > > have you tried going into ddb? > > > > > > > > > > On Fri, 2008-12-19 at 21:27 -0800, Julian Elischer wrote: > >> Ferner Cilloniz wrote: > >>> Hello everyone. > >>> > >>> I am playing with freebsd and just learning some things about the > >>> FreeBSD kernel. > >>> > >>> So for my first quest i am placing random processes from the allproc > >>> list into a list of my own and trying to add them back into allproc > >>> > >>> I have pasted the code below. > >>> > >>> ----------------------------------------------------------------------- > >>> struct proc *p = a process from my own list; > >>> if( p != NULL && (p->p_state == PRS_NEW || p->p_state == PRS_NORMAL) ){ > >>> LIST_INSERT_HEAD(&allproc, p, p_list); > >>> } > >>> ----------------------------------------------------------------------- > > >> > >>> _______________________________________________ > >>> freebsd-hackers@freebsd.org mailing list > >>> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > >>> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > > > > ------------------------------ > > Message: 5 > Date: Sat, 20 Dec 2008 02:23:20 +0000 > From: Ferner Cilloniz > Subject: Re: adding proc to allproc > To: Julian Elischer > Cc: freebsd-hackers@freebsd.org > Message-ID: <1229739800.5614.24.camel@mobiliare.Belkin> > Content-Type: text/plain > > The process comes from the allproc list. > I am simply iterating through this list and removing the first 1/2 of > allproc list and adding the removed process to my own singly linked > list. > > LIST_REMOVE(current_proc, p_list); // remove from the allproc > add_proc_entry(current_proc); > > Later, i am iterating through my singly linked list and doing the below: > > struct proc *p = current->p; > f( p != NULL && (p->p_state == PRS_NEW || p->p_state == PRS_NORMAL) ){ > LIST_INSERT_HEAD(&allproc, p, p_list); > } > > Could this be causing a circular list? > > I am adding the proc entries to my singly linked list as follows: > > static void add_proc_entry(const struct proc *p) > { > struct proc_ll *new_entry = (struct proc_ll*)malloc(sizeof(struct > proc_ll), M_TEMP, M_ZERO | M_NOWAIT); > int done = 0; > > new_entry->p = p; // maybe doing this assignment isnt correct? > > if(proc_entries == NULL) { > proc_entries = new_entry; > return; > } > > struct proc_ll *current = proc_entries; > > while(current != NULL) { > if(current->next == NULL) { > current->next = new_entry; > break; > } > current = current->next; > } > } > > > struct proc_ll { > struct proc *p; > struct proc_ll *next; > }; > > > A circular list does sound like it could cause hanging to occur but the > above code, atleast from my eyes, doesn't seem to cause it. > > On Fri, 2008-12-19 at 21:39 -0800, Julian Elischer wrote: > > Ferner Cilloniz wrote: > > > When i run the code from a KLD it hangs the system. No reboot occurs > > > however, it just hangs there. > > > > well, firstly you have no locking though that would probably let you > > get away with it most times. > > > > Where does the process come from in the first place? > > > > It sounds like you are making a circular list somewhere or somehow... > > > > have you tried going into ddb? > > > > > > > > > > > > > > > > > On Fri, 2008-12-19 at 21:27 -0800, Julian Elischer wrote: > > >> Ferner Cilloniz wrote: > > >>> Hello everyone. > > >>> > > >>> I am playing with freebsd and just learning some things about the > > >>> FreeBSD kernel. > > >>> > > >>> So for my first quest i am placing random processes from the allproc > > >>> list into a list of my own and trying to add them back into allproc > > >>> > > >>> I have pasted the code below. > > >>> > > >>> ----------------------------------------------------------------------- > > >>> struct proc *p = a process from my own list; > > >>> if( p != NULL && (p->p_state == PRS_NEW || p->p_state == PRS_NORMAL) ){ > > >>> LIST_INSERT_HEAD(&allproc, p, p_list); > > >>> } > > >>> ----------------------------------------------------------------------- > > > > >> > > >>> _______________________________________________ > > >>> freebsd-hackers@freebsd.org mailing list > > >>> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > > >>> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > > > > > > > ------------------------------ > > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > > End of freebsd-hackers Digest, Vol 299, Issue 5 > *********************************************** > > > > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" -- Cilloniz Bicchi, Ferner Research Assistant Dept. of Computer Sciences The University of Texas at Austin http://www.cs.utexas.edu/~fernercc fernercc@cs.utexas.edu From owner-freebsd-hackers@FreeBSD.ORG Sun Dec 21 02:51:16 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1548D106567B for ; Sun, 21 Dec 2008 02:51:16 +0000 (UTC) (envelope-from fernercc@gmail.com) Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.247]) by mx1.freebsd.org (Postfix) with ESMTP id B2CE98FC2E for ; Sun, 21 Dec 2008 02:51:15 +0000 (UTC) (envelope-from fernercc@gmail.com) Received: by an-out-0708.google.com with SMTP id c2so820738anc.13 for ; Sat, 20 Dec 2008 18:51:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:cc :in-reply-to:references:content-type:date:message-id:mime-version :x-mailer:content-transfer-encoding; bh=OHiZwm6qI6vbDCiTbVNRWHLZ92TYQxUFaME80sWkyTY=; b=fM9u01S/RaIQZ1wuwLBS/fUuV/o02ygCHDPyUsncWMQGxwJSae3VzpM5Iv824JVF2j uTCdmIVsz0VYajPoK7WrZ4LhpYidtGENBboGMHWT9HdT4zGgb8xKXjfPRcoLUwvSgyhI DkgrQ3HvbrVYIL0siYO9/UWco64B9A7DXA6dE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:cc:in-reply-to:references:content-type:date :message-id:mime-version:x-mailer:content-transfer-encoding; b=GyfvcXvY0lkTShfgROy2wpUGZxXPssRYOGuvp595fRM4NUWSwr7yUgiKW3RttDnj14 Exsjkeke9NzWCG6psksYC0W3lZvIJWmdWxJKwdD697YxrQ20L8vbXuwFBZjZvx2R+DGf Czk6Tkte1pzcsaCPBFlLii0lnE71/4FY6r7f8= Received: by 10.101.68.19 with SMTP id v19mr3145196ank.58.1229827874949; Sat, 20 Dec 2008 18:51:14 -0800 (PST) Received: from ?192.168.2.2? (cpe-70-112-179-136.austin.res.rr.com [70.112.179.136]) by mx.google.com with ESMTPS id d35sm9075082and.45.2008.12.20.18.51.13 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 20 Dec 2008 18:51:14 -0800 (PST) From: Ferner Cilloniz To: Michelle Li In-Reply-To: <1229806179.4952.3.camel@mobiliare.Belkin> References: <823694.23548.qm@web65403.mail.ac4.yahoo.com> <1229806179.4952.3.camel@mobiliare.Belkin> Content-Type: text/plain Date: Sat, 20 Dec 2008 20:51:11 +0000 Message-Id: <1229806271.4952.4.camel@mobiliare.Belkin> Mime-Version: 1.0 X-Mailer: Evolution 2.24.2 Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: reg: adding proc to allproc X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Dec 2008 02:51:16 -0000 Forgot to mention. Im using the below book and /sys/kern/kern_fork.c as references for process management. On Sat, 2008-12-20 at 20:49 +0000, Ferner Cilloniz wrote: > for the sake of this discussion its suffice to consider new_entry->p as > read-only pointer because i never modify it. I am just storing its > address. It easily just be considered an unsigned long value. > > However, would really calling > LIST_INSERT_HEAD(&allproc, entry->p, p_list) > > result in a hang of the system? I'm flipping through pages in FreeBSD > design and implementation right now. > > On Sat, 2008-12-20 at 18:05 -0800, Michelle Li wrote: > > reg: adding proc to allproc (Ferner Cilloniz) > > > > new_entry->p ..... > > is accessing the "read/write" pointer declared in the proc_ll struct > > > > new_entry->p = p; > > is attempting an assignment of a "read ONLY" const pointer that > > has been passed into add_proc_entry() to a "read/write" pointer > > > > new_entry->"read/write pointer" = "read ONLY pointer"; > > is invalid > > > > "new_entry->p = p; // maybe doing this assignment isnt correct?" > > with this assertion I agree > > > > > > freebsd-hackers-request@freebsd.org wrote: Send freebsd-hackers mailing list submissions to > > freebsd-hackers@freebsd.org > > > > To subscribe or unsubscribe via the World Wide Web, visit > > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > > or, via email, send a message with subject or body 'help' to > > freebsd-hackers-request@freebsd.org > > > > You can reach the person managing the list at > > freebsd-hackers-owner@freebsd.org > > > > When replying, please edit your Subject line so it is more specific > > than "Re: Contents of freebsd-hackers digest..." > > > > > > Today's Topics: > > > > 1. adding proc to allproc (Ferner Cilloniz) > > 2. Re: adding proc to allproc (Julian Elischer) > > 3. Re: adding proc to allproc (Ferner Cilloniz) > > 4. Re: adding proc to allproc (Julian Elischer) > > 5. Re: adding proc to allproc (Ferner Cilloniz) > > > > > > ---------------------------------------------------------------------- > > > > Message: 1 > > Date: Fri, 19 Dec 2008 22:39:20 +0000 > > From: Ferner Cilloniz > > Subject: adding proc to allproc > > To: freebsd-hackers@freebsd.org > > Message-ID: <1229726360.5614.15.camel@mobiliare.Belkin> > > Content-Type: text/plain > > > > Hello everyone. > > > > I am playing with freebsd and just learning some things about the > > FreeBSD kernel. > > > > So for my first quest i am placing random processes from the allproc > > list into a list of my own and trying to add them back into allproc > > > > I have pasted the code below. > > > > ----------------------------------------------------------------------- > > struct proc *p = a process from my own list; > > if( p != NULL && (p->p_state == PRS_NEW || p->p_state == PRS_NORMAL) ){ > > LIST_INSERT_HEAD(&allproc, p, p_list); > > } > > ----------------------------------------------------------------------- > > > > Thanks. > > > > > > > > ------------------------------ > > > > Message: 2 > > Date: Fri, 19 Dec 2008 21:27:34 -0800 > > From: Julian Elischer > > Subject: Re: adding proc to allproc > > To: Ferner Cilloniz > > Cc: freebsd-hackers@freebsd.org > > Message-ID: <494C8246.3020703@elischer.org> > > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > > > Ferner Cilloniz wrote: > > > Hello everyone. > > > > > > I am playing with freebsd and just learning some things about the > > > FreeBSD kernel. > > > > > > So for my first quest i am placing random processes from the allproc > > > list into a list of my own and trying to add them back into allproc > > > > > > I have pasted the code below. > > > > > > ----------------------------------------------------------------------- > > > struct proc *p = a process from my own list; > > > if( p != NULL && (p->p_state == PRS_NEW || p->p_state == PRS_NORMAL) ){ > > > LIST_INSERT_HEAD(&allproc, p, p_list); > > > } > > > ----------------------------------------------------------------------- > > > > > > Thanks. > > > > and your question is? > > > > > > > > > > _______________________________________________ > > > freebsd-hackers@freebsd.org mailing list > > > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > > > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > > > > > > > > ------------------------------ > > > > Message: 3 > > Date: Fri, 19 Dec 2008 23:28:46 +0000 > > From: Ferner Cilloniz > > Subject: Re: adding proc to allproc > > To: Julian Elischer > > Cc: freebsd-hackers@freebsd.org > > Message-ID: <1229729326.5614.16.camel@mobiliare.Belkin> > > Content-Type: text/plain > > > > When i run the code from a KLD it hangs the system. No reboot occurs > > however, it just hangs there. > > > > > > On Fri, 2008-12-19 at 21:27 -0800, Julian Elischer wrote: > > > Ferner Cilloniz wrote: > > > > Hello everyone. > > > > > > > > I am playing with freebsd and just learning some things about the > > > > FreeBSD kernel. > > > > > > > > So for my first quest i am placing random processes from the allproc > > > > list into a list of my own and trying to add them back into allproc > > > > > > > > I have pasted the code below. > > > > > > > > ----------------------------------------------------------------------- > > > > struct proc *p = a process from my own list; > > > > if( p != NULL && (p->p_state == PRS_NEW || p->p_state == PRS_NORMAL) ){ > > > > LIST_INSERT_HEAD(&allproc, p, p_list); > > > > } > > > > ----------------------------------------------------------------------- > > > > > > > > Thanks. > > > > > > and your question is? > > > > > > > > > > > > > > _______________________________________________ > > > > freebsd-hackers@freebsd.org mailing list > > > > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > > > > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > > > > > -- > > Cilloniz Bicchi, Ferner > > > > Research Assistant > > Dept. of Computer Sciences > > The University of Texas at Austin > > http://www.cs.utexas.edu/~fernercc > > fernercc@cs.utexas.edu > > > > > > > > ------------------------------ > > > > Message: 4 > > Date: Fri, 19 Dec 2008 21:39:20 -0800 > > From: Julian Elischer > > Subject: Re: adding proc to allproc > > To: Ferner Cilloniz > > Cc: freebsd-hackers@freebsd.org > > Message-ID: <494C8508.2020000@elischer.org> > > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > > > Ferner Cilloniz wrote: > > > When i run the code from a KLD it hangs the system. No reboot occurs > > > however, it just hangs there. > > > > well, firstly you have no locking though that would probably let you > > get away with it most times. > > > > Where does the process come from in the first place? > > > > It sounds like you are making a circular list somewhere or somehow... > > > > have you tried going into ddb? > > > > > > > > > > > > > > > > > On Fri, 2008-12-19 at 21:27 -0800, Julian Elischer wrote: > > >> Ferner Cilloniz wrote: > > >>> Hello everyone. > > >>> > > >>> I am playing with freebsd and just learning some things about the > > >>> FreeBSD kernel. > > >>> > > >>> So for my first quest i am placing random processes from the allproc > > >>> list into a list of my own and trying to add them back into allproc > > >>> > > >>> I have pasted the code below. > > >>> > > >>> ----------------------------------------------------------------------- > > >>> struct proc *p = a process from my own list; > > >>> if( p != NULL && (p->p_state == PRS_NEW || p->p_state == PRS_NORMAL) ){ > > >>> LIST_INSERT_HEAD(&allproc, p, p_list); > > >>> } > > >>> ----------------------------------------------------------------------- > > > > >> > > >>> _______________________________________________ > > >>> freebsd-hackers@freebsd.org mailing list > > >>> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > > >>> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > > > > > > > > ------------------------------ > > > > Message: 5 > > Date: Sat, 20 Dec 2008 02:23:20 +0000 > > From: Ferner Cilloniz > > Subject: Re: adding proc to allproc > > To: Julian Elischer > > Cc: freebsd-hackers@freebsd.org > > Message-ID: <1229739800.5614.24.camel@mobiliare.Belkin> > > Content-Type: text/plain > > > > The process comes from the allproc list. > > I am simply iterating through this list and removing the first 1/2 of > > allproc list and adding the removed process to my own singly linked > > list. > > > > LIST_REMOVE(current_proc, p_list); // remove from the allproc > > add_proc_entry(current_proc); > > > > Later, i am iterating through my singly linked list and doing the below: > > > > struct proc *p = current->p; > > f( p != NULL && (p->p_state == PRS_NEW || p->p_state == PRS_NORMAL) ){ > > LIST_INSERT_HEAD(&allproc, p, p_list); > > } > > > > Could this be causing a circular list? > > > > I am adding the proc entries to my singly linked list as follows: > > > > static void add_proc_entry(const struct proc *p) > > { > > struct proc_ll *new_entry = (struct proc_ll*)malloc(sizeof(struct > > proc_ll), M_TEMP, M_ZERO | M_NOWAIT); > > int done = 0; > > > > new_entry->p = p; // maybe doing this assignment isnt correct? > > > > if(proc_entries == NULL) { > > proc_entries = new_entry; > > return; > > } > > > > struct proc_ll *current = proc_entries; > > > > while(current != NULL) { > > if(current->next == NULL) { > > current->next = new_entry; > > break; > > } > > current = current->next; > > } > > } > > > > > > struct proc_ll { > > struct proc *p; > > struct proc_ll *next; > > }; > > > > > > A circular list does sound like it could cause hanging to occur but the > > above code, atleast from my eyes, doesn't seem to cause it. > > > > On Fri, 2008-12-19 at 21:39 -0800, Julian Elischer wrote: > > > Ferner Cilloniz wrote: > > > > When i run the code from a KLD it hangs the system. No reboot occurs > > > > however, it just hangs there. > > > > > > well, firstly you have no locking though that would probably let you > > > get away with it most times. > > > > > > Where does the process come from in the first place? > > > > > > It sounds like you are making a circular list somewhere or somehow... > > > > > > have you tried going into ddb? > > > > > > > > > > > > > > > > > > > > > > > > On Fri, 2008-12-19 at 21:27 -0800, Julian Elischer wrote: > > > >> Ferner Cilloniz wrote: > > > >>> Hello everyone. > > > >>> > > > >>> I am playing with freebsd and just learning some things about the > > > >>> FreeBSD kernel. > > > >>> > > > >>> So for my first quest i am placing random processes from the allproc > > > >>> list into a list of my own and trying to add them back into allproc > > > >>> > > > >>> I have pasted the code below. > > > >>> > > > >>> ----------------------------------------------------------------------- > > > >>> struct proc *p = a process from my own list; > > > >>> if( p != NULL && (p->p_state == PRS_NEW || p->p_state == PRS_NORMAL) ){ > > > >>> LIST_INSERT_HEAD(&allproc, p, p_list); > > > >>> } > > > >>> ----------------------------------------------------------------------- > > > > > > >> > > > >>> _______________________________________________ > > > >>> freebsd-hackers@freebsd.org mailing list > > > >>> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > > > >>> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > > > > > > > > > > > > > ------------------------------ > > > > _______________________________________________ > > freebsd-hackers@freebsd.org mailing list > > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > > > > End of freebsd-hackers Digest, Vol 299, Issue 5 > > *********************************************** > > > > > > > > _______________________________________________ > > freebsd-hackers@freebsd.org mailing list > > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" -- Cilloniz Bicchi, Ferner Research Assistant Dept. of Computer Sciences The University of Texas at Austin http://www.cs.utexas.edu/~fernercc fernercc@cs.utexas.edu From owner-freebsd-hackers@FreeBSD.ORG Sun Dec 21 05:44:30 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 856CB1065679 for ; Sun, 21 Dec 2008 05:44:30 +0000 (UTC) (envelope-from davidxu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 748378FC1B; Sun, 21 Dec 2008 05:44:30 +0000 (UTC) (envelope-from davidxu@freebsd.org) Received: from apple.my.domain (root@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id mBL5iR1f072753; Sun, 21 Dec 2008 05:44:28 GMT (envelope-from davidxu@freebsd.org) Message-ID: <494DD834.7050108@freebsd.org> Date: Sun, 21 Dec 2008 13:46:28 +0800 From: David Xu User-Agent: Thunderbird 2.0.0.9 (X11/20080612) MIME-Version: 1.0 To: Ravi Murty References: <95b10a340812142103u3ab8bd2br97033a7c7e8bec3@mail.gmail.com> In-Reply-To: <95b10a340812142103u3ab8bd2br97033a7c7e8bec3@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: td_critnest X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Dec 2008 05:44:30 -0000 Ravi Murty wrote: > Hello All, > > The implementation of critical_enter and critical_exit changed between > freebsd 5 and freebsd 6. In the newer implemtnation, the code checks if > td_critnest is 1 and if it is sets it to zero, then checks if the thread > owes a preempt. If so, it increments td_critnest by 1 before grabbing a lock > and then decrements it back to zero. I can't figure out why it does this. > The freebsd 5 implementation seems straightforward where we check if the > thread owes a preempt and if so we switch to the new thread. Can anyone help > me with this? > > Thanks > Ravi I guess this becauses thread_lock() also calls critical_exit(), this code avoids recursion. From owner-freebsd-hackers@FreeBSD.ORG Sun Dec 21 22:31:20 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 627B01065676 for ; Sun, 21 Dec 2008 22:31:20 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id 2398E8FC5A for ; Sun, 21 Dec 2008 22:31:19 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 058926D43F; Sun, 21 Dec 2008 22:31:19 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id D4887844AD; Sun, 21 Dec 2008 23:31:18 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Ferner Cilloniz References: <1229726360.5614.15.camel@mobiliare.Belkin> <494C8246.3020703@elischer.org> <1229729326.5614.16.camel@mobiliare.Belkin> <494C8508.2020000@elischer.org> <1229739800.5614.24.camel@mobiliare.Belkin> Date: Sun, 21 Dec 2008 23:31:18 +0100 In-Reply-To: <1229739800.5614.24.camel@mobiliare.Belkin> (Ferner Cilloniz's message of "Sat, 20 Dec 2008 02:23:20 +0000") Message-ID: <86ocz55fex.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: freebsd-hackers@freebsd.org, Julian Elischer Subject: Re: adding proc to allproc X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Dec 2008 22:31:20 -0000 Ferner Cilloniz writes: > The process comes from the allproc list. > I am simply iterating through this list and removing the first 1/2 of > allproc list and adding the removed process to my own singly linked > list. > > LIST_REMOVE(current_proc, p_list); // remove from the allproc > add_proc_entry(current_proc); You can't do that without holding allproc_lock. > Later, i am iterating through my singly linked list and doing the below: > > struct proc *p =3D current->p; > f( p !=3D NULL && (p->p_state =3D=3D PRS_NEW || p->p_state =3D=3D PRS_NOR= MAL) ){ > LIST_INSERT_HEAD(&allproc, p, p_list); > } You can't do that without holding allproc_lock. > struct proc_ll *new_entry =3D (struct proc_ll*)malloc(sizeof(struct > proc_ll), M_TEMP, M_ZERO | M_NOWAIT); unnecessary cast, missing NULL check > int done =3D 0; unused variable > new_entry->p =3D p; // maybe doing this assignment isnt correct? > > if(proc_entries =3D=3D NULL) { > proc_entries =3D new_entry; > return; > } > > struct proc_ll *current =3D proc_entries; > > while(current !=3D NULL) { > if(current->next =3D=3D NULL) { > current->next =3D new_entry; > break; > } > current =3D current->next; > } This is gross. The usual idiom is new_entry->next =3D proc_entries; proc_entries =3D new_entry; However, the simplest solution is to use the macros. > A circular list does sound like it could cause hanging to occur but the > above code, atleast from my eyes, doesn't seem to cause it. With no locking, who knows what really goes on in your code... DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-freebsd-hackers@FreeBSD.ORG Sun Dec 21 22:32:33 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 26BF71065674 for ; Sun, 21 Dec 2008 22:32:33 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id DEFB08FC19 for ; Sun, 21 Dec 2008 22:32:32 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 366C16D449; Sun, 21 Dec 2008 22:32:32 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 1DC2C844AD; Sun, 21 Dec 2008 23:32:32 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Michelle Li References: <823694.23548.qm@web65403.mail.ac4.yahoo.com> Date: Sun, 21 Dec 2008 23:32:32 +0100 In-Reply-To: <823694.23548.qm@web65403.mail.ac4.yahoo.com> (Michelle Li's message of "Sat, 20 Dec 2008 18:05:06 -0800 (PST)") Message-ID: <86k59t5fcv.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: freebsd-hackers@freebsd.org Subject: Re: reg: adding proc to allproc (Ferner Cilloniz) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Dec 2008 22:32:33 -0000 Michelle Li writes: > new_entry->p ..... > is accessing the "read/write" pointer declared in the proc_ll struct > > new_entry->p =3D p;=20 > is attempting an assignment of a "read ONLY" const pointer that > has been passed into add_proc_entry() to a "read/write" pointer > > new_entry->"read/write pointer" =3D "read ONLY pointer";=20=20 > is invalid It's bad form, but it makes no practical difference. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-freebsd-hackers@FreeBSD.ORG Mon Dec 22 08:37:52 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D4C781065677 for ; Mon, 22 Dec 2008 08:37:52 +0000 (UTC) (envelope-from corne.kotze@za.striata.com) Received: from mail.striata.com (mail.striata.com [196.35.74.195]) by mx1.freebsd.org (Postfix) with ESMTP id D88DB8FC19 for ; Mon, 22 Dec 2008 08:37:51 +0000 (UTC) (envelope-from corne.kotze@za.striata.com) Received: from exchdeux.striata.lan (Not Verified[10.2.37.17]) by mail.striata.com with MailMarshal (v6, 1, 6, 1172) id ; Mon, 22 Dec 2008 10:25:10 +0200 Received: from [10.2.37.62] ([10.2.37.62]) by exchdeux.striata.lan with Microsoft SMTPSVC(5.0.2195.6713); Mon, 22 Dec 2008 10:22:39 +0200 From: Corne Kotze To: freebsd-hackers@freebsd.org Organization: Striata Date: Mon, 22 Dec 2008 10:22:39 +0200 Message-Id: <1229934159.8928.20.camel@jackal> Mime-Version: 1.0 X-Mailer: Evolution 2.24.2 X-OriginalArrivalTime: 22 Dec 2008 08:22:39.0826 (UTC) FILETIME=[742DFB20:01C9640E] Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: SSH Problem X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: cornek@striata.com List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Dec 2008 08:37:52 -0000 Hi all, I have tried to register on the forums to search for any clues there, but cannot as I keep on getting an error with regards to the image verification. "Image verification could not be verified due to server issues. Please try again later." The issue I have, hope somebody can help me, is with ssh security keys, no matter if I use RSA or DSA keys with or without passwords, I still have to login with a password to my FreeBSD server. It is between a Linux server(Client server) and my FreeBSD server. My setups are as follows: >From client server: Linux nagios-server 2.6.23-hardened-r4 #1 SMP OpenSSH_4.7p1, OpenSSL 0.9.8g 19 Oct 2007 To FreeBSD server: FreeBSD secure-server 6.1-RELEASE-p17 FreeBSD 6.1-RELEASE-p17 #0: Fri May 25 19:54:30 IST 2007 root@secure-server:/usr/obj/usr/src/sys/SECURESRV-SMP i386 OpenSSH_4.2p1 FreeBSD-20050903, OpenSSL 0.9.7e-p1 25 Oct 2004 In my "/etc/rc.conf": sshd_enable="NO" sshd2_enable="YES" I have tried the public key in various directories, in the users home directory, ie. .ssh/authorized_keys .ssh/authorized_keys2 .ssh2/authorized_keys .ssh2/authorized_keys2 Permissions are set to 700 for the .ssh(2) directories and 600 for the authorized_keys(2) files. User and group access are also correct, and connection from the client machine is also with the correct user. If I change to the following in my "/etc/rc.conf" file: sshd_enable="YES" sshd2_enable="NO" Restart sshd, the keys work fine, no issues, I connect 100% without having to type any passwords. Thank you kindly CK From owner-freebsd-hackers@FreeBSD.ORG Mon Dec 22 08:59:02 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C7ED6106567A for ; Mon, 22 Dec 2008 08:59:02 +0000 (UTC) (envelope-from rea-fbsd@codelabs.ru) Received: from 0.mx.codelabs.ru (0.mx.codelabs.ru [144.206.177.45]) by mx1.freebsd.org (Postfix) with ESMTP id 6FE228FC14 for ; Mon, 22 Dec 2008 08:59:02 +0000 (UTC) (envelope-from rea-fbsd@codelabs.ru) DomainKey-Signature: a=rsa-sha1; q=dns; c=simple; s=one; d=codelabs.ru; h=Received:Date:From:To:Cc:Subject:Message-ID:Reply-To:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To:Sender; b=emef2mz/RLz6upeDvpC0mHfayW+ShLjjZpmYwUsXiaOlYgJ9RZcn7Q25eEG6DWKY4yfBytHcd2zN/TrAQPtgp+EDqlURy6VtIdciTJKKsVpYhanpNY9jlfRSaWHssdrSl7Gw64NY1INvlE+sprKRcAK0o3pDTX+p8PW6BKWoTss=; Received: from shadow.pikenet.ru (school.pikenet.ru [85.30.229.242]) by 0.mx.codelabs.ru with esmtpsa (TLSv1:AES256-SHA:256) id 1LEgct-000E4K-Lg; Mon, 22 Dec 2008 11:59:00 +0300 Date: Mon, 22 Dec 2008 11:58:56 +0300 From: Eygene Ryabinkin To: Corne Kotze Message-ID: References: <1229934159.8928.20.camel@jackal> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="PNTmBPCT7hxwcZjr" Content-Disposition: inline In-Reply-To: <1229934159.8928.20.camel@jackal> Sender: rea-fbsd@codelabs.ru Cc: freebsd-hackers@freebsd.org Subject: Re: SSH Problem X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: rea-fbsd@codelabs.ru List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Dec 2008 08:59:02 -0000 --PNTmBPCT7hxwcZjr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Corne, good day. Mon, Dec 22, 2008 at 10:22:39AM +0200, Corne Kotze wrote: > The issue I have, hope somebody can help me, is with ssh security keys, > no matter if I use RSA or DSA keys with or without passwords, I still > have to login with a password to my FreeBSD server. > It is between a Linux server(Client server) and my FreeBSD server. >=20 > My setups are as follows: > >From client server: > Linux nagios-server 2.6.23-hardened-r4 #1 SMP > OpenSSH_4.7p1, OpenSSL 0.9.8g 19 Oct 2007 > > > To FreeBSD server: > FreeBSD secure-server 6.1-RELEASE-p17 FreeBSD 6.1-RELEASE-p17 #0: Fri > May 25 19:54:30 IST 2007 > root@secure-server:/usr/obj/usr/src/sys/SECURESRV-SMP i386 > OpenSSH_4.2p1 FreeBSD-20050903, OpenSSL 0.9.7e-p1 25 Oct 2004 > > In my "/etc/rc.conf": > sshd_enable=3D"NO" > sshd2_enable=3D"YES" There is no 'sshd2_enable' knob, there is only 'sshd_enable' one. The protocols (and other stuff) are configured in /etc/ssh/sshd_config. > I have tried the public key in various directories, in the users home > directory, ie. > .ssh/authorized_keys > .ssh/authorized_keys2 > > .ssh2/authorized_keys > .ssh2/authorized_keys2 This is also governed by host's sshd_config: by-default, .ssh/authorized_ke= ys are used: ----- AuthorizedKeysFile .ssh/authorized_keys ----- > Permissions are set to 700 for the .ssh(2) directories and 600 for the > authorized_keys(2) files. That's fine. > User and group access are also correct, and connection from the client > machine is also with the correct user. > If I change to the following in my "/etc/rc.conf" file: > sshd_enable=3D"YES" > sshd2_enable=3D"NO" > > Restart sshd, the keys work fine, no issues, I connect 100% without > having to type any passwords. Yes, it is expected. Forget about sshd2_enable -- 'man sshd_config' is your friend. And if you're trying to enable only SSHv2, then the default configuration of OpenSSH should be fine to you -- it allows only v2 since ages. For your 6.1 only v2 should allowed by-default, but you can explicitely state it in /etc/ssh/sshd_config, just to be sure. --=20 Eygene _ ___ _.--. # \`.|\..----...-'` `-._.-'_.-'` # Remember that it is hard / ' ` , __.--' # to read the on-line manual =20 )/' _/ \ `-_, / # while single-stepping the kernel. `-'" `"\_ ,_.-;_.-\_ ', fsc/as # _.-'_./ {_.' ; / # -- FreeBSD Developers handbook=20 {_.-``-' {_/ # --PNTmBPCT7hxwcZjr Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEUEARECAAYFAklPVtAACgkQthUKNsbL7YhqegCY+G7ZC3gHB7+PBhlgOP3eUmyt qQCgrqJgsJUHs7xhxgRLXrViYBR3NZo= =6NqX -----END PGP SIGNATURE----- --PNTmBPCT7hxwcZjr-- From owner-freebsd-hackers@FreeBSD.ORG Mon Dec 22 09:22:11 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EF0F11065673 for ; Mon, 22 Dec 2008 09:22:10 +0000 (UTC) (envelope-from corne.kotze@za.striata.com) Received: from mail.striata.com (mail.striata.com [196.35.74.195]) by mx1.freebsd.org (Postfix) with ESMTP id F30EE8FC08 for ; Mon, 22 Dec 2008 09:22:09 +0000 (UTC) (envelope-from corne.kotze@za.striata.com) Received: from exchdeux.striata.lan (Not Verified[10.2.37.17]) by mail.striata.com with MailMarshal (v6, 1, 6, 1172) id ; Mon, 22 Dec 2008 11:24:38 +0200 Received: from [10.2.37.62] ([10.2.37.62]) by exchdeux.striata.lan with Microsoft SMTPSVC(5.0.2195.6713); Mon, 22 Dec 2008 11:22:08 +0200 From: Corne Kotze To: rea-fbsd@codelabs.ru In-Reply-To: References: <1229934159.8928.20.camel@jackal> Organization: Striata Date: Mon, 22 Dec 2008 11:22:07 +0200 Message-Id: <1229937727.8928.24.camel@jackal> Mime-Version: 1.0 X-Mailer: Evolution 2.24.2 X-OriginalArrivalTime: 22 Dec 2008 09:22:08.0123 (UTC) FILETIME=[C30CE4B0:01C96416] Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-hackers@freebsd.org Subject: Re: SSH Problem X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: cornek@striata.com List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Dec 2008 09:22:11 -0000 Hi Eygene, Thank for the reply. Sorry for the ignorance, but I should have added this as well. I am running apart from other things, a secure ftp server on this box as well that chroot the users to their home directories. I got the setup information from the following link: http://www.bsdguides.org/guides/freebsd/security/sftp_chroot_users.php Setting the "rc.conf" file to: sshd_enable="YES" sshd2_enable="NO" Then my sftp setup does not work properly, unless I am missing something that I can set in the "/etc/ssh/sshd_config" file. Thanks again. CK On Mon, 2008-12-22 at 11:58 +0300, Eygene Ryabinkin wrote: > Corne, good day. > > Mon, Dec 22, 2008 at 10:22:39AM +0200, Corne Kotze wrote: > > The issue I have, hope somebody can help me, is with ssh security keys, > > no matter if I use RSA or DSA keys with or without passwords, I still > > have to login with a password to my FreeBSD server. > > It is between a Linux server(Client server) and my FreeBSD server. > > > > My setups are as follows: > > >From client server: > > Linux nagios-server 2.6.23-hardened-r4 #1 SMP > > OpenSSH_4.7p1, OpenSSL 0.9.8g 19 Oct 2007 > > > > > > To FreeBSD server: > > FreeBSD secure-server 6.1-RELEASE-p17 FreeBSD 6.1-RELEASE-p17 #0: Fri > > May 25 19:54:30 IST 2007 > > root@secure-server:/usr/obj/usr/src/sys/SECURESRV-SMP i386 > > OpenSSH_4.2p1 FreeBSD-20050903, OpenSSL 0.9.7e-p1 25 Oct 2004 > > > > In my "/etc/rc.conf": > > sshd_enable="NO" > > sshd2_enable="YES" > > There is no 'sshd2_enable' knob, there is only 'sshd_enable' one. > The protocols (and other stuff) are configured in /etc/ssh/sshd_config. > > > I have tried the public key in various directories, in the users home > > directory, ie. > > .ssh/authorized_keys > > .ssh/authorized_keys2 > > > > .ssh2/authorized_keys > > .ssh2/authorized_keys2 > > This is also governed by host's sshd_config: by-default, .ssh/authorized_keys > are used: > ----- > AuthorizedKeysFile .ssh/authorized_keys > ----- > > > Permissions are set to 700 for the .ssh(2) directories and 600 for the > > authorized_keys(2) files. > > That's fine. > > > User and group access are also correct, and connection from the client > > machine is also with the correct user. > > > If I change to the following in my "/etc/rc.conf" file: > > sshd_enable="YES" > > sshd2_enable="NO" > > > > Restart sshd, the keys work fine, no issues, I connect 100% without > > having to type any passwords. > > Yes, it is expected. Forget about sshd2_enable -- 'man sshd_config' is > your friend. And if you're trying to enable only SSHv2, then the > default configuration of OpenSSH should be fine to you -- it allows only > v2 since ages. For your 6.1 only v2 should allowed by-default, but you > can explicitely state it in /etc/ssh/sshd_config, just to be sure. Corne Kotze Systems Administrator Striata messaging innovation E: corne.kotze@za.striata.com T: +27 11 530 9600 F: +27 11 447 9122 This email and all contents are subject to the following disclaimer: http://www.striata.com/_disclaimer/ From owner-freebsd-hackers@FreeBSD.ORG Mon Dec 22 10:22:30 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8FDF21065673 for ; Mon, 22 Dec 2008 10:22:30 +0000 (UTC) (envelope-from rea-fbsd@codelabs.ru) Received: from 0.mx.codelabs.ru (0.mx.codelabs.ru [144.206.177.45]) by mx1.freebsd.org (Postfix) with ESMTP id 3E1FD8FC17 for ; Mon, 22 Dec 2008 10:22:29 +0000 (UTC) (envelope-from rea-fbsd@codelabs.ru) DomainKey-Signature: a=rsa-sha1; q=dns; c=simple; s=one; d=codelabs.ru; h=Received:Date:From:To:Cc:Subject:Message-ID:Reply-To:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To:Sender; b=S7dXHjmT1YcldJWf4A7rVVDoBL0qnEgz+41Hd/edgTJ2ntIBptCBVvnqnNHaa2T3aqPBI2Kfge/iKTPf+I6lYpLzH52HS0IOWnMTQa/Os1VjPpxXHHKfmihBxFtuXCu0WNl+mRmFRIjT4Sm252QyckBluuTCwkoXLy9uK252NZg=; Received: from shadow.pikenet.ru (school.pikenet.ru [85.30.229.242]) by 0.mx.codelabs.ru with esmtpsa (TLSv1:AES256-SHA:256) id 1LEhvg-000KJG-6N; Mon, 22 Dec 2008 13:22:28 +0300 Date: Mon, 22 Dec 2008 13:22:25 +0300 From: Eygene Ryabinkin To: Corne Kotze Message-ID: References: <1229934159.8928.20.camel@jackal> <1229937727.8928.24.camel@jackal> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="8w3uRX/HFJGApMzv" Content-Disposition: inline In-Reply-To: <1229937727.8928.24.camel@jackal> Sender: rea-fbsd@codelabs.ru Cc: freebsd-hackers@freebsd.org Subject: Re: SSH Problem X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: rea-fbsd@codelabs.ru List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Dec 2008 10:22:30 -0000 --8w3uRX/HFJGApMzv Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Corne, Mon, Dec 22, 2008 at 11:22:07AM +0200, Corne Kotze wrote: > Thank for the reply. > Sorry for the ignorance, but I should have added this as well. > > I am running apart from other things, a secure ftp server on this box as > well that chroot the users to their home directories. > > I got the setup information from the following link: > http://www.bsdguides.org/guides/freebsd/security/sftp_chroot_users.php Ahm, SSH.com's realization of SSH suite. Forgot about this, sorry. I had never used it, so can't say how to make it work with public key authentication. But read on ;)) However, OpenSSH had gained the chroot ability in February 2008, http://undeadly.org/cgi?action=3Darticle&sid=3D20080220110039 But if you're running 6.x, you won't be able to use it -- it was imported only to 7.x and -CURRENT, SVN rev 182634 on 2008-09-01 20:03:13Z by des Though, no hope is lost -- security/openssh-portable is at 5.0p1, and chroot support is there. But it is prone to the X11 MITM attack (at least on HP/UX, don't currently know is FreeBSD is affected), http://www.openssh.com/txt/release-5.1 Your mileage may vary, if, for example, you're not using X11 forwarding, then you might be fine with this. > Setting the "rc.conf" file to: > sshd_enable=3D"YES" > sshd2_enable=3D"NO" > > Then my sftp setup does not work properly, unless I am missing something > that I can set in the "/etc/ssh/sshd_config" file. Ooookey, if you still prefer SSH.com's software, you may find the following article very enlightening, http://www.ssh.com/support/documentation/online/ssh/adminguide/32/Public-= Key_Authentication-2.html At least for me it looks very sane and verbose. --=20 Eygene _ ___ _.--. # \`.|\..----...-'` `-._.-'_.-'` # Remember that it is hard / ' ` , __.--' # to read the on-line manual =20 )/' _/ \ `-_, / # while single-stepping the kernel. `-'" `"\_ ,_.-;_.-\_ ', fsc/as # _.-'_./ {_.' ; / # -- FreeBSD Developers handbook=20 {_.-``-' {_/ # --8w3uRX/HFJGApMzv Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEARECAAYFAklPamEACgkQthUKNsbL7YhZ5ACfTtWnfcM4blOnj6aYlz54Rf80 xgAAnjyr+PpXwFIaEE85kBxmD86UN00K =3Bf5 -----END PGP SIGNATURE----- --8w3uRX/HFJGApMzv-- From owner-freebsd-hackers@FreeBSD.ORG Mon Dec 22 12:29:28 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 502211065678 for ; Mon, 22 Dec 2008 12:29:28 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id 146D18FC1A for ; Mon, 22 Dec 2008 12:29:27 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id EA44C6D449; Mon, 22 Dec 2008 12:29:26 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id CFA9F844BD; Mon, 22 Dec 2008 13:29:26 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: cornek@striata.com References: <1229934159.8928.20.camel@jackal> Date: Mon, 22 Dec 2008 13:29:26 +0100 In-Reply-To: <1229934159.8928.20.camel@jackal> (Corne Kotze's message of "Mon, 22 Dec 2008 10:22:39 +0200") Message-ID: <868wq8jsux.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: freebsd-hackers@freebsd.org Subject: Re: SSH Problem X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Dec 2008 12:29:28 -0000 Corne Kotze writes: > "Image verification could not be verified due to server issues. Please > try again later." This message has absolutely nothing to do with SSH. > In my "/etc/rc.conf": > sshd_enable=3D"NO" > sshd2_enable=3D"YES" This disables sshd entirely. There is no sshd2 in FreeBSD. > If I change to the following in my "/etc/rc.conf" file: > sshd_enable=3D"YES" > sshd2_enable=3D"NO" This enables sshd. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-freebsd-hackers@FreeBSD.ORG Tue Dec 23 00:35:38 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AE2A61065670 for ; Tue, 23 Dec 2008 00:35:38 +0000 (UTC) (envelope-from gerryw@compvia.com) Received: from mail01.compvia.com (mail01.compvia.com [12.147.132.91]) by mx1.freebsd.org (Postfix) with ESMTP id 7C1B88FC17 for ; Tue, 23 Dec 2008 00:35:38 +0000 (UTC) (envelope-from gerryw@compvia.com) Received: from [10.10.20.11] ([10.10.20.11]) by mail01.compvia.com (Kerio MailServer 6.5.1) for freebsd-hackers@freebsd.org; Mon, 22 Dec 2008 18:05:34 -0600 To: freebsd-hackers@freebsd.org From: "Gerry Weaver" Message-ID: <20081223000534.f740ca8a@mail01.compvia.com> Date: Mon, 22 Dec 2008 18:05:34 -0600 X-Mailer: Kerio MailServer 6.5.1 WebMail X-User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1b1) Gecko/20081007 Firefox/3.1b1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: How to access kernel memory from user space X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Dec 2008 00:35:38 -0000 Hello All, I am working on a driver that collects various network statistics via pf= il. I have a simple array of structures that I use to store the statisti= cs. I also have a user space process that needs to collect these statist= ics every second or so. A copy operation from kernel to user space would= be too expensive. Is there a mechanism that would allow me to gain dire= ct access to my kernel array from user space=3F The user process would o= nly need read access. It seems like maybe this could be done with mmap, = but since this is not a character driver, there is no device file etc.. = I'm a newbie, so I apologize if this is something that should be obvious= . Thanks in advance, Gerry From owner-freebsd-hackers@FreeBSD.ORG Tue Dec 23 01:30:55 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C36D81065670 for ; Tue, 23 Dec 2008 01:30:55 +0000 (UTC) (envelope-from assaulter0x80@gmail.com) Received: from mail-bw0-f19.google.com (mail-bw0-f19.google.com [209.85.218.19]) by mx1.freebsd.org (Postfix) with ESMTP id 3A6B78FC42 for ; Tue, 23 Dec 2008 01:30:55 +0000 (UTC) (envelope-from assaulter0x80@gmail.com) Received: by bwz12 with SMTP id 12so6573792bwz.19 for ; Mon, 22 Dec 2008 17:30:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type:references; bh=wpx895KIwxsFLZAFuOD7kxKz+ZH2TP3Lu6CdLRcOwW0=; b=rNNT1WmeaDm5V794uki+4EFlziXsEms2o3Ii1A7dwu1gOkirYT536FQR/EEkDA0ieU 0RZ9J1MRkLHffoXf0AZKF8hlJcl7lFRUTik0dVB+EbOEN2DpUlaU0dv5oPlKGS5/wvag iepQn+uwYvAY7jrQUalQi4lsfJ4ZDA0P+4ofI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:references; b=pGn+GxAYRNW0NO6y1LOIkOXufetZxsURAe1eKpGvb7dNkr5FjiYSt9FeLmnG9AS09/ WtvLc3Znj2X9TJd35/SYfIwJJN6s/N3m1Biffjq+8fcZY2qABi7hpOHnIRpbceYun7rb DWbxZc7yfpybO8FaI8QkbDF3N4kT8NCIRMOqM= Received: by 10.103.221.5 with SMTP id y5mr2552191muq.66.1229995851578; Mon, 22 Dec 2008 17:30:51 -0800 (PST) Received: by 10.103.177.9 with HTTP; Mon, 22 Dec 2008 17:30:51 -0800 (PST) Message-ID: Date: Tue, 23 Dec 2008 01:30:51 +0000 From: "Jacky Oh" To: freebsd-hackers@freebsd.org In-Reply-To: MIME-Version: 1.0 References: <20081223000534.f740ca8a@mail01.compvia.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: Fwd: How to access kernel memory from user space X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Dec 2008 01:30:56 -0000 hi Gerry.. you may be interested in the following functions: int copyin(const void *uaddr, void *kaddr, size_t len); int copyout(const void *kaddr, void *uaddr, size_t len); int copyinstr(const void *uaddr, void *kaddr, size_t len, size_t *done); int bcopy(const void *src, const void *dst, len); this functions are using for syscalls related work, among other things..lucky!! Jacky Ohwers 2008/12/23 Gerry Weaver Hello All, > > I am working on a driver that collects various network statistics via pfil. > I have a simple array of structures that I use to store the statistics. I > also have a user space process that needs to collect these statistics every > second or so. A copy operation from kernel to user space would be too > expensive. Is there a mechanism that would allow me to gain direct access to > my kernel array from user space? The user process would only need read > access. It seems like maybe this could be done with mmap, but since this is > not a character driver, there is no device file etc.. I'm a newbie, so I > apologize if this is something that should be obvious. > > > Thanks in advance, > Gerry > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > From owner-freebsd-hackers@FreeBSD.ORG Tue Dec 23 01:45:52 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B0EB41065670 for ; Tue, 23 Dec 2008 01:45:52 +0000 (UTC) (envelope-from assaulter0x80@gmail.com) Received: from mail-bw0-f19.google.com (mail-bw0-f19.google.com [209.85.218.19]) by mx1.freebsd.org (Postfix) with ESMTP id 2C3268FC1D for ; Tue, 23 Dec 2008 01:45:51 +0000 (UTC) (envelope-from assaulter0x80@gmail.com) Received: by bwz12 with SMTP id 12so6583224bwz.19 for ; Mon, 22 Dec 2008 17:45:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type:references; bh=zOHOc+/+e3u+fWk+KCvUJ/OIT6qQiyej80saZcOkAu8=; b=ho8sbLCybHFhsC3M8D1Tv6utw5dLRi3uxzOooNoRMuw49D2dRk1MSAHRV8aAFF9+aW H8Tz1lwLCZ68FWkI6GpzDh8qYBSKU0jYEpLXJvc+/cGNpOE222fEUqW/MGop9IgsxeUA MRaQuF7mqGfWxvp26MmeeHdGPTJ/7H7zm55Ds= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:references; b=HfKm5imnCxbpTkfs8hiMFhwO0GHfClGSzRFxxEc0bKim3V6z3HkkGh78kNcJCCQhFt 48VA8NjeKFdJNLxQrB5fhK1pbO9XutQIbnhqdDduMZI2+Ry6kxCyxsOhxFe0QPAIg+tu QGUwsJBO4fkBdFpmBU7LwKyf9jaw9nHO0P/T4= Received: by 10.103.172.9 with SMTP id z9mr2542243muo.109.1229995237345; Mon, 22 Dec 2008 17:20:37 -0800 (PST) Received: by 10.103.177.9 with HTTP; Mon, 22 Dec 2008 17:20:37 -0800 (PST) Message-ID: Date: Tue, 23 Dec 2008 01:20:37 +0000 From: "Jacky Oh" To: "Gerry Weaver" In-Reply-To: <20081223000534.f740ca8a@mail01.compvia.com> MIME-Version: 1.0 References: <20081223000534.f740ca8a@mail01.compvia.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-hackers@freebsd.org Subject: Re: How to access kernel memory from user space X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Dec 2008 01:45:52 -0000 hi Gerry.. you may be interested in the following functions: int copyin(const void *uaddr, void *kaddr, size_t len); int copyout(const void *kaddr, void *uaddr, size_t len); int copyinstr(const void *uaddr, void *kaddr, size_t len, size_t *done); int bcopy(const void *src, const void *dst, len); this functions are using for syscalls related work, among other things..lucky!! Jacky Ohwers 2008/12/23 Gerry Weaver > Hello All, > > I am working on a driver that collects various network statistics via pfil. > I have a simple array of structures that I use to store the statistics. I > also have a user space process that needs to collect these statistics every > second or so. A copy operation from kernel to user space would be too > expensive. Is there a mechanism that would allow me to gain direct access to > my kernel array from user space? The user process would only need read > access. It seems like maybe this could be done with mmap, but since this is > not a character driver, there is no device file etc.. I'm a newbie, so I > apologize if this is something that should be obvious. > > > Thanks in advance, > Gerry > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > From owner-freebsd-hackers@FreeBSD.ORG Tue Dec 23 09:06:56 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E6D541065783 for ; Tue, 23 Dec 2008 09:06:56 +0000 (UTC) (envelope-from rdivacky@lev.vlakno.cz) Received: from vlakno.cz (77-93-215-190.static.masterinter.net [77.93.215.190]) by mx1.freebsd.org (Postfix) with ESMTP id A06138FC08 for ; Tue, 23 Dec 2008 09:06:55 +0000 (UTC) (envelope-from rdivacky@lev.vlakno.cz) Received: from localhost (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id C6B9C9CB2B8; Tue, 23 Dec 2008 10:01:51 +0100 (CET) X-Virus-Scanned: amavisd-new at vlakno.cz Received: from vlakno.cz ([127.0.0.1]) by localhost (lev.vlakno.cz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VW33dGQzE2mb; Tue, 23 Dec 2008 10:01:49 +0100 (CET) Received: from lev.vlakno.cz (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 899DF9CB2C6; Tue, 23 Dec 2008 10:01:49 +0100 (CET) Received: (from rdivacky@localhost) by lev.vlakno.cz (8.14.2/8.14.2/Submit) id mBN91mBb016506; Tue, 23 Dec 2008 10:01:48 +0100 (CET) (envelope-from rdivacky) Date: Tue, 23 Dec 2008 10:01:48 +0100 From: Roman Divacky To: Gerry Weaver Message-ID: <20081223090148.GA16158@freebsd.org> References: <20081223000534.f740ca8a@mail01.compvia.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20081223000534.f740ca8a@mail01.compvia.com> User-Agent: Mutt/1.4.2.3i Cc: freebsd-hackers@freebsd.org Subject: Re: How to access kernel memory from user space X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Dec 2008 09:06:57 -0000 On Mon, Dec 22, 2008 at 06:05:34PM -0600, Gerry Weaver wrote: > Hello All, > > I am working on a driver that collects various network statistics via pfil. I have a simple array of structures that I use to store the statistics. I also have a user space process that needs to collect these statistics every second or so. A copy operation from kernel to user space would be too expensive. Is there a mechanism that would allow me to gain direct access to my kernel array from user space? The user process would only need read access. It seems like maybe this could be done with mmap, but since this is not a character driver, there is no device file etc.. I'm a newbie, so I apologize if this is something that should be obvious. would it be feasible to allocate a buffer in userspace and map it into the kernelspace? if so, I believe sf_buf (man 9 sf_buf) should work roman From owner-freebsd-hackers@FreeBSD.ORG Tue Dec 23 11:03:26 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C47331065670 for ; Tue, 23 Dec 2008 11:03:26 +0000 (UTC) (envelope-from tutatnhamon@gmail.com) Received: from wf-out-1314.google.com (wf-out-1314.google.com [209.85.200.175]) by mx1.freebsd.org (Postfix) with ESMTP id 97B5B8FC16 for ; Tue, 23 Dec 2008 11:03:26 +0000 (UTC) (envelope-from tutatnhamon@gmail.com) Received: by wf-out-1314.google.com with SMTP id 24so4083970wfg.7 for ; Tue, 23 Dec 2008 03:03:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:mime-version:content-type:content-transfer-encoding :content-disposition:x-google-sender-auth; bh=aaSIbInj8Ua1YYvpIfZsWNDp6vFJnIowtOsWp7Zgn5c=; b=PbKBELsM40KEg2Hp0qSakYMId3E+HRR03jkSh51M0hcDDY4irRsmYYW/GBJTM0C3Q6 Nq1sd8/OaBBBBauxyj8g6WzNN5Wx1f+SY54E1L1p7kvQsm6K2lsyeQ5CHwtbsxKP2/AD AnNIn08x6lELFS16zMucDxhnbrPIEOXDe6ApI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition:x-google-sender-auth; b=nHXWCkQJdIoL8bmD/0FiDD2rV4cMpm0/k7Wd2TdwK8OwO6rpeG1LQis52qMU499smv KSvCCgzEi3PDT4qhOHUgSt2lIgkoJ6PLB73AzWNTOCTbyPymPo6efPX+i+R1Cv0K/cjo oDLdEMYe2LuKHzbu7YzyJxRPRulRr7pBssOmI= Received: by 10.142.222.21 with SMTP id u21mr3120839wfg.235.1230030206301; Tue, 23 Dec 2008 03:03:26 -0800 (PST) Received: by 10.143.44.12 with HTTP; Tue, 23 Dec 2008 03:03:26 -0800 (PST) Message-ID: <65dfa4fc0812230303h65134bf0r2db3a1af625c5b0b@mail.gmail.com> Date: Tue, 23 Dec 2008 13:03:26 +0200 From: "Artem Naluzhnyy" Sender: tutatnhamon@gmail.com To: freebsd-hackers@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Google-Sender-Auth: 9b13e537aca36246 Subject: RFD: support of per script nice(1) value in periodic.conf(5) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Dec 2008 11:03:26 -0000 bin/129814 The patch adds support of per periodic(8) script nice(1) value the script will be run at (similar to "_nice" variables in rc.conf). There are two features: * default_nice variable - default nice level * _