From dev-return-71469-apmail-httpd-dev-archive=httpd.apache.org@httpd.apache.org Sun May 8 11:58:34 2011 Return-Path: X-Original-To: apmail-httpd-dev-archive@www.apache.org Delivered-To: apmail-httpd-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 580823E76 for ; Sun, 8 May 2011 11:58:34 +0000 (UTC) Received: (qmail 94718 invoked by uid 500); 8 May 2011 11:58:33 -0000 Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 94633 invoked by uid 500); 8 May 2011 11:58:33 -0000 Mailing-List: contact dev-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list dev@httpd.apache.org Received: (qmail 94625 invoked by uid 99); 8 May 2011 11:58:33 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 08 May 2011 11:58:33 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of trawick@gmail.com designates 209.85.214.45 as permitted sender) Received: from [209.85.214.45] (HELO mail-bw0-f45.google.com) (209.85.214.45) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 08 May 2011 11:58:28 +0000 Received: by bwz16 with SMTP id 16so5224145bwz.18 for ; Sun, 08 May 2011 04:58:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=x1RF9Z9uvbTUkIZxgbsM6SCG82aR1OO0yUeGbm1WH14=; b=qtHMV/QWv48igMmEu/zMijdJO+wi9YpTwBQKEdWlSWJZGRgbRaHyKcQMdGujxVjeg3 LmWDD2VUpXDrrEYp78cWG7ikiNIAx6qrftO0FJLkM0nDcpsDsGxLGe26GqH+EPfJqO8U QoROj3IKDek0w+wxS/UoR4/iVKLSXvueXmHUw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=AA4+8CYsQVONARxMjDh6O4aE9dT877SV+XwBnrtwHwhHAbPLr04FXF/Uo7oOiX0p+i AQfg2mbxzC99YfXHMF8r4W/OzcjD5vAdDoIZvAJPtFvEMTGx08AhngE1SbaOBbJlRe1m ZcH2bgGL54/WN66P5jlNeWvbH4xFD+D0AQAS8= MIME-Version: 1.0 Received: by 10.205.24.12 with SMTP id rc12mr1368913bkb.199.1304855886411; Sun, 08 May 2011 04:58:06 -0700 (PDT) Received: by 10.204.80.34 with HTTP; Sun, 8 May 2011 04:58:06 -0700 (PDT) In-Reply-To: References: Date: Sun, 8 May 2011 07:58:06 -0400 Message-ID: Subject: Re: Universal setting for APR_HOOK_PROBES_ENABLED From: Jeff Trawick To: dev@httpd.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Sat, May 7, 2011 at 7:33 PM, Jim Jagielski wrote: > Here's my idea: > > =A0o create ap_hooks.h which moves the AP_IMPLEMENT_HOOKS* from > =A0 ap_config.h to itself. > =A0o Fold in the APR_HOOK_PROBES_ENABLED logic as > =A0 described below. > =A0o change configure to accept --enable-hooks-probes=3D > =A0 which points to the location of the ap_hooks_probes.h > =A0 file. > =A0o Adjust all files to include ap_hooks.h instead > =A0 of apr_hooks.h > > I'll start coding this tomorrow; my hope is to have this > in for the next beta (as RM, I'm gonna hold off a T&R > until then) since I think it's something that we want > to really promote as a cool 2.4 feature. sounds right in general; one of my prior patches (Oakland or Atlanta?) had ap_hooks.h or similar a potential concern is that by doing it that way (really, that's the only way httpd can help out, whether the include of third-party code is in ap_hooks.h or elsewhere) the provider of the probe macros is "on the hook" to handle absolutely every hook, which can a bit tedious to do * having separate macros for every individual hook gives you type safety and the ability to ignore some or, in general, have different functionality for different hooks (e.g., connection-based vs. request-based, ignoring everything else); but that gets out of date (not a killer) * having common macros for all hooks breaks because of challenges with the parameter lists (a couple of hooks have 0 parameters!!!) and type safety (first parm isn't always a pointer, though you can look at the name of the hook) ** shall we give optional_fn_retrieve a server_rec & ? (I suggested this previously on-list, but only niq responded, and not possitively IIRC) ** I forget what the other one was but there's probably practical no way to individually select classes of hooks (e.g., it would be nice to enable only for connection-based and request-based) other than invasive preprocessor work within .c files should a distinction be made for core+bundled modules vs. third-party code? maybe the define to include the third-party .h file is for internal CPPFLAGS only, so that it doesn't blow (or get the hook probe implementer on the hook to handle stuff she's never heard of) when building third-party modules against a probe-enabled build? as far as potential bundled exploitation: * DTrace is one flavor (not kept out of date, horrible build changes never cleaned up/committed) * it would be cool to have some teaching/debugging mode available at configure time which resulted in a lot of crap written to the error log during hook execution which a script could create a nice display from, combining error and access log information ** perhaps enabled at runtime via -Dfoo * another flavor I've played with is just maintaining r->notes{"ActiveModule"} and r->notes{"RequestFailer"} for access from mod_whatkilledus or access log, respectively > On May 6, 2011, at 8:38 PM, Jim Jagielski wrote: > >> APR_HOOK_PROBES_ENABLED is pretty nice, the rub is that, esp >> in httpd, we have lots of modules which go ahead and include >> apr_hooks.h on their own, making the setup of "universal" >> probe hooks difficult. >> >> Anyone have ideas on how to make it easier, either in >> APR directly or in httpd? Maybe making some kind of >> httpd_hooks.h file that includes some local local_hooks_probes.h >> file (depending on some config-time setting) assuming >> APR_HOOK_PROBES_ENABLED is set (ie: --enable-hook-probes >> sets APR_HOOK_PROBES_ENABLED and httpd_hooks.h is >> basically: >> >> =A0#ifdef APR_HOOK_PROBES_ENABLED >> =A0#include "local_hooks_probes.h" >> =A0#endif >> =A0#include "apr_hooks.h" >> >> and no httpd files include apr_hooks.h directly... >> >> That seems a very rough way to do it... :/ >> > > --=20 Born in Roswell... married an alien...