Re: svn commit: r233745 - head/sys/netinet/ipfw

2012-04-04 Thread Gleb Smirnoff
  Julian,

On Tue, Apr 03, 2012 at 04:46:56PM -0700, Julian Elischer wrote:
J Many years ago there was the possibility that malloc M_WAITOK could
J return on shutdown or in some other rare error cases.
J 
J Are we certain this is no longer true?

At least it is documented so.

-- 
Totus tuus, Glebius.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r233745 - head/sys/netinet/ipfw

2012-04-04 Thread John Baldwin
On Tuesday, April 03, 2012 7:46:56 pm Julian Elischer wrote:
 On 3/31/12 4:20 AM, Gleb Smirnoff wrote:
 
 
 Many years ago there was the possibility that malloc M_WAITOK could
 return on shutdown or in some other rare error cases.
 
 Are we certain this is no longer true?

That hasn't been true in a long while.  In edge cases malloc() with M_WAITOK 
will just panic rather than return NULL.  (e.g. kmem too small)

-- 
John Baldwin
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r233745 - head/sys/netinet/ipfw

2012-04-04 Thread Julian Elischer

On 4/4/12 4:57 AM, John Baldwin wrote:

On Tuesday, April 03, 2012 7:46:56 pm Julian Elischer wrote:

On 3/31/12 4:20 AM, Gleb Smirnoff wrote:


Many years ago there was the possibility that malloc M_WAITOK could
return on shutdown or in some other rare error cases.

Are we certain this is no longer true?

That hasn't been true in a long while.  In edge cases malloc() with M_WAITOK
will just panic rather than return NULL.  (e.g. kmem too small)


what happens if you call reboot while it is waiting for free space?

___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r233745 - head/sys/netinet/ipfw

2012-04-04 Thread John Baldwin
On Wednesday, April 04, 2012 3:32:26 pm Julian Elischer wrote:
 On 4/4/12 4:57 AM, John Baldwin wrote:
  On Tuesday, April 03, 2012 7:46:56 pm Julian Elischer wrote:
  On 3/31/12 4:20 AM, Gleb Smirnoff wrote:
 
 
  Many years ago there was the possibility that malloc M_WAITOK could
  return on shutdown or in some other rare error cases.
 
  Are we certain this is no longer true?
  That hasn't been true in a long while.  In edge cases malloc() with 
M_WAITOK
  will just panic rather than return NULL.  (e.g. kmem too small)
 
 what happens if you call reboot while it is waiting for free space?

The same thing that happens to any other thread asleep when we reboot, they 
eventually die one way or another when the CPU resets.  If it happens to be a 
user thread that doesn't respond to kill then you get a warning about not all 
processes dying during shutdown, but that's about it.

-- 
John Baldwin
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r233745 - head/sys/netinet/ipfw

2012-04-03 Thread Julian Elischer

On 3/31/12 4:20 AM, Gleb Smirnoff wrote:


Many years ago there was the possibility that malloc M_WAITOK could
return on shutdown or in some other rare error cases.

Are we certain this is no longer true?


Author: glebius
Date: Sat Mar 31 11:20:48 2012
New Revision: 233745
URL: http://svn.freebsd.org/changeset/base/233745

Log:
   Don't check malloc(M_WAITOK) results.

Modified:
   head/sys/netinet/ipfw/ip_fw_sockopt.c

Modified: head/sys/netinet/ipfw/ip_fw_sockopt.c
==
--- head/sys/netinet/ipfw/ip_fw_sockopt.c   Sat Mar 31 10:47:40 2012
(r233744)
+++ head/sys/netinet/ipfw/ip_fw_sockopt.c   Sat Mar 31 11:20:48 2012
(r233745)
@@ -163,8 +163,6 @@ ipfw_add_rule(struct ip_fw_chain *chain,

l = RULESIZE(input_rule);
rule = malloc(l, M_IPFW, M_WAITOK | M_ZERO);
-   if (rule == NULL)
-   return (ENOSPC);
/* get_map returns with IPFW_UH_WLOCK if successful */
map = get_map(chain, 1, 0 /* not locked */);
if (map == NULL) {
@@ -1010,8 +1008,6 @@ ipfw_ctl(struct sockopt *sopt)
if (size= sopt-sopt_valsize)
break;
buf = malloc(size, M_TEMP, M_WAITOK);
-   if (buf == NULL)
-   break;
IPFW_UH_RLOCK(chain);
/* check again how much space we need */
want = chain-static_len + ipfw_dyn_len();




___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r233745 - head/sys/netinet/ipfw

2012-03-31 Thread Gleb Smirnoff
Author: glebius
Date: Sat Mar 31 11:20:48 2012
New Revision: 233745
URL: http://svn.freebsd.org/changeset/base/233745

Log:
  Don't check malloc(M_WAITOK) results.

Modified:
  head/sys/netinet/ipfw/ip_fw_sockopt.c

Modified: head/sys/netinet/ipfw/ip_fw_sockopt.c
==
--- head/sys/netinet/ipfw/ip_fw_sockopt.c   Sat Mar 31 10:47:40 2012
(r233744)
+++ head/sys/netinet/ipfw/ip_fw_sockopt.c   Sat Mar 31 11:20:48 2012
(r233745)
@@ -163,8 +163,6 @@ ipfw_add_rule(struct ip_fw_chain *chain,
 
l = RULESIZE(input_rule);
rule = malloc(l, M_IPFW, M_WAITOK | M_ZERO);
-   if (rule == NULL)
-   return (ENOSPC);
/* get_map returns with IPFW_UH_WLOCK if successful */
map = get_map(chain, 1, 0 /* not locked */);
if (map == NULL) {
@@ -1010,8 +1008,6 @@ ipfw_ctl(struct sockopt *sopt)
if (size = sopt-sopt_valsize)
break;
buf = malloc(size, M_TEMP, M_WAITOK);
-   if (buf == NULL)
-   break;
IPFW_UH_RLOCK(chain);
/* check again how much space we need */
want = chain-static_len + ipfw_dyn_len();
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org