"one of the best moves you can make for the sustainability of that site is to lower the percentage of traffic that comes from search"That's one reason why I'm glad to see the suggestion of etbe: Advertising Free Software Projects - nearly every free software project would be better off improving their web sites, adding cross-links and building more sustainable traffic, instead of wasting resources competing in the Google-ad Games. Unless you've got the thousands of pounds a year that successful AdWords marketers spend, your Google-ad success will probably be short-lived, as people with more money will outbid you for keywords that work. It's even less sustainable than search result traffic, because it's consuming your financial resources as well as your vounteer time. Meanwhile, most free software project webmasters I know are over-stretched, but many wannabe-contributors seem to want to nuke the entire site to rebuild it with their pet tool. Those offers are really about their ego more than helping the project, in my opinion. They want to Get Themslves Noticed, but I've seen far too many unfinished site rebuilds to like those offers. In fact, I don't think any good webmaster would offer a rebuild without the site owner asking for it - even in the rare cases where I really strongly want to restart a site, I explain why and ask permission first, not just wade in with an offer to nuke-and-rebuild. If the site owner says no, I move on: there's no shortage of work here, after all and very few free software projects pay their webmasters. So, if you want to help a free software project, ask their webmasters for suggestions and access to the site source code.
Alex Hudson commented:
"Similar comments about another W3C WG: http://ln.hixie.ch/?start=1181118077&order=-1&count=1 W3C should be about authoring material for the web. It seems at the moment, they're more concerned with the stuff that happens after authoring - e.g., how stuff relates in "the semantic web". IMHO we still don't have any powerful tools for authoring either, so the idea that authoring tools will automate many of the "bolt on accessibility" tasks is pretty naive."After implementing pingback, I have some respect for hixie. It's disappointing but not surprising to read those comments. Not sure what is meant by powerful authoring tools there. My tools are powerful, but I know they're not easy for new users. As I'm getting old and cynical, I'm not sure whether power tools can ever be correct and truly easy - just look at the pigswill spewing out of some Web 2.0 sites. niq sent me a link to the WCAG Samurai Errata and commented:
"The problem with WCAG 2, as with WCAG 1, is precisely that it's a Work of Committee, and seeks to represent too many irreconcilable viewpoints and egos. In some cases, even the ideas behind it are inconsistent. Many (myself included) regard accessibility as being about ensuring a reader with a physical disability can make use of a site (think Steven Hawking). That's also what HTML is designed to support. Others are concerned with the mentally impaired, also a worthy cause, but one that becomes counterproductive when its advocates fail to distinguish between a site that's inherently inaccessible because it presents a complex and challenging subject, and one that's unnecessarily difficult due to poor presentation. Add the two together, blend in some stupidity, and you get "accessible" sites full of classic "friendly" little illustrations like a "helpful" government booklet, and a horribly intrusive "alt" to explain each pointless "ethnic mummy and child" picture."I think a Work of Committee could be useful, as long as you have the right committee. Thinking about that, I found the group membership list and I'm not sure that's the right committee. For example, I think the ex-Adobe Google-worker must surely have an irreconcilable conflict of interest (inappropriate use of Adobe's Flash and PDF formats and Google's Web Apps have done more than many to harm accessibility in the past IMO), yet is a leading light of WCAG 2.0 - maybe that's why it's gone so dark? Update: Thijs Kinkhorst comments:
"As I read in the draft, suggestions are still possible until the 29th, not the 27th of June."I'm sure that's different to the email which started me writing this, but please go comment and see if we can make WCAG-2.0 useful.
set -e
dev=$1
luks=$(mktemp)
cryptdev=$(basename $dev)_crypt
pvsize=$(pvs -o pe_start,pv_size --units s --noheadings --nosuffix "$dev" awk ' print $1 + $2 ')
devsize=$(blockdev --getsz "$dev")
mchunk=8
The script takes the physical volume device to convert as an argument. Note there is no check for the validity of its value.
dd of="$luks" seek=$devsize count=0 bs=512 2> /dev/null
luksdev=$(losetup -f)
losetup "$luksdev" "$luks"
trap "losetup -d \"$luksdev\"; rm -f \"$luks\"" EXIT
Next, we create a sparse luks file the same size as the device (in case luksFormat would use the size somehow, but I believe it doesn’t), and a loopback device on this file. The trap is here to avoid leaving the loopback device and the file when an error occurs later (though during the conversion itself, it will be pointless).
cryptsetup luksFormat -q "$luksdev"
cryptsetup luksOpen "$luksdev" $ cryptdev _real
read start length crypt format key IVoff cdev offset <<EOF
$(dmsetup table $ cryptdev _real)
EOF
We create a LUKS device, so that we can get the encryption key ($key), and the size of the LUKS header ($offset). Note you need to add –showkey to the dmsetup table command on sid.
if [ $(expr $devsize - $pvsize) -lt $offset ]; then
echo Not enough free space after LVM physical volume
cryptsetup luksClose $ cryptdev _real
exit
fi
Check we have enough space after the LVM physical volume to offset everything by the size of the LUKS header. If not, you can still try again after you reduce the size of the LVM physical volume by an extent.
if [ $(expr $devsize % $offset % $mchunk) -gt 0 ]; then
echo Last
cryptsetup luksClose $ cryptdev _real
exit
fi
This is another check to avoid surprises at the end, when dealing with the last chunk. As the script is written for the moment, it doesn’t support cases where this last chunk is not a multiple of $mchunk. So we need to abort in these.
read major minor <<EOF
$(stat -t "$dev" awk ' print $10,$11 ')
EOF
maps=$(dmsetup deps awk -F: "/\($major, $minor\)/ print \$1 ")
dmsetup create $cryptdev <<EOF
0 $length linear $dev 0
EOF
dmsetup reload $ cryptdev _real <<EOF
$start $length crypt $format $key $IVoff $dev $offset
EOF
dmsetup resume $ cryptdev _real
for map in $ maps ; do
dmsetup table "$map" sed s,$major:$minor,/dev/mapper/$cryptdev, dmsetup reload "$map"
dmsetup resume "$map"
done
Here, we create the dev_crypt device mapper that is our fake LUKS device, which starts as a simple linear mapper and will end as a complete crypt mapper. This fake LUKS device is inserted as an intermediate mapper between the LVM device mapper and the real device. So, the LVM device mapper will have this fake LUKS device as backend, and, at the beginning, the fake LUKS device maps linearly to the real device.
Note we look for all device mappers using the real device as backend before creating the fake LUKS device to avoid finding the fake LUKS device in the list.
Also note dmsetup reload only loads a new table in the INACTIVE slot, and dmsetup resume makes this inactive table LIVE.
cursor=$length
chunk=$offset
while [ $cursor -gt 0 ]; do
cursor=$(expr $cursor - $chunk)
if [ $cursor -lt 0 ]; then
chunk=$(expr $chunk + $cursor)
cursor=0
fi
(
[ $cursor -ne 0 ] && echo 0 $cursor linear $dev 0
echo $cursor $chunk mirror core 1 $mchunk 2 $dev $cursor /dev/mapper/$ cryptdev _real $cursor
[ $cursor -lt $(expr $length - $chunk) ] && echo $(expr $cursor + $chunk) $(expr $length - $cursor - $chunk) crypt $format $key $(expr $IVoff + $cursor + $chunk) $dev $(expr $offset + $cursor + $chunk)
) dmsetup reload "$cryptdev"
dmsetup resume "$cryptdev"
chunks=$(expr $chunk / $mchunk)
while ! dmsetup status "$cryptdev" grep "$chunks/$chunks"; do
true
done
done
This is where the main work is done : moving the data around. We actually just let the device mapper deal with the data duplication, $offset blocks by $offset blocks ($offset being the LUKS header size), using a mirror target for the chunk being moved. So our disk looks like the following:
dmsetup status, dmsetup wait doesn’t seem to be very helpful here.
dmsetup reload "$cryptdev" <<EOF
$start $length crypt $format $key $IVoff $dev $offset
EOF
dmsetup resume "$cryptdev"
dmsetup remove "$ cryptdev _real"
dd if="$luks" of=$dev count=$offset bs=512 2> /dev/null
Final steps of the conversion : our dev_crypt device becomes a full LUKS volume, so we can remove dev_crypt_real and add the LUKS headers at the top of the device we converted.
At this moment, the LUKS volume is setup just as if it had been setup by cryptsetup. For LVM to recognize the change properly, you need to run pvscan. Once you ran it, you can do whatever you want with LVM.
Now, you may want to add the following to your /etc/crypttab file:
$cryptdev $dev none luks
i.e. hda5_crypt /dev/hda5 none luks if the device was /dev/hda5.
And if the LVM volume you converted contains your root filesystem, you should run (for Debian systems):
update-initramfs -u
I tested this successfully under qemu and will give it a shot on my laptop some time soon.
Now, because I had a hard time not finding much about the mirror target of the device mapper, here is what I could gather about it. The target syntax is as follows:
<logical_start_sector> <num_sectors> mirror [ core disk ] <num_params> <param> ... <num_mirrors> [ <destination > <start_sector> ] ...
logical_start_sector, num_sectors, destination and start_sector have the same meaning as in other targets.core and disk are two different log types (to track differences between mirrors), respectively in memory and on disk.num_params and params depend on the log type:
core, num_params can be either 1 or 2.region_size, which is the size (in blocks) of the chunks the mirror log tracks for synchronization. It can’t be less than the page size divided by 512, i.e. 8 on x86, must be a power of 2, and must not exceed num_sectors. Apparently, it is not a problem if num_sectors is not a multiple of region_size.sync or nosync, meaning of which I’m not sure. I think it determines whether the mirror should do the initial synchronization (sync) or not (nosync).disk, num_params can be either 2 or 3, with params being log_device (device where the logs are kept), region_size, as above, and an optional sync or nosync, as above too.num_mirrors is the number of mirrors and for each mirror, we have a pair destination and start_sector.
[ Update: after a quick look at the device mapper source code in Linus’s git tree, updated the mirror target description ]

Agua para todos...
During the walk, we witnessed what the people from the Delta have been
warning about for decades: the Delta is disappearing. The progressive overuse
of the river's flow, excessive irrigation, damm construction and degradation
is killing this unique place. The waters are slowly claiming what once was
theirs. An electricity line, at the beginning of our trip being at the end
of the beach starts approaching the sea, or viceversa, as you move southward,
to end up many metres inside the water. The old people in the Delta still
remember the 200m tall lighthouse in the Illa de Buda, which the sea
managed to devour.

Sunset at the salines del Delta
When we reached the Punta we could watch a beautiful sunset
over the mountains of Els Ports, and when it got dark and cold we
headed to Tortosa, the area's capital, which I had recently visited for the
first time for one of Softcatal 's
meetings. There, we had dinner at a bar and met Jordi and Anna for a while,
before going back to Ampolla, going to bed relatively early due to everyone
being very tired.

On Saturday, we decided to have a look at the Delta... from above. So we
drove to the top of the Cim del Caro, where we could admire a great
view over the flat farmlands of the Delta, and then found a nice trail which
took us to a nice forest, where we had lunch. After a visit to Alfara de
Carles, we went back to the house, had a great dinner and played fun games at
the table.
Unfortunately, Sunday morning was dedicated to cleaning up the mess in the
appartment and packing, as part of the group, the Jordis from Alcoi and the
twins, had to leave early. The remaining four Valencians decided to go to
Deltebre to have a local paella. It was quite good, although the bar
tender laughed at our request to eat directly from the paella, rejecting
dishes. Small cultural clash. ;)
I remember downloading and viewing the pictures of the trip a few days
after getting back in Val ncia, and then losing track of them. Last week,
while testing an EPIA board with some random hard drive, I suddenly realised
there was a big chance the pictures would be on that drive, and after some
search, I found them; I had been close to mkfs the disk a few minutes
before. I hadn't stopped blaming myself for misplacing these pictures, as they
remind me of this wonderful weekend. Luckily, they are back!
Going back to the state of the Delta, experts say it will be mostly gone
in 200 years. All of the Terres de l'Ebre have fought against the previous
government's "PHN" plan to divert part of the river's flow to the North and
South, to supply Barcelona, and specially the South of Val ncia, where the
developing of the coastal areas is out of control. I fear that whenever PP
regains power in Madrid, they will retake this idea. There is a lot of money
involved in building a 700 km long scar in our land. The Delta de
l'Ebre is a fantastic place which doesn't deserve a terrible fate like
this, only for the benefit of the usual suspects. As the good people of this
land would say...
Lo riu s vida. No al transvasament!

Agua para todos...
During the walk, we witnessed what the people from the Delta have been
warning about for decades: the Delta is disappearing. The progressive overuse
of the river's flow, excessive irrigation, damm construction and degradation
is killing this unique place. The waters are slowly claiming what once was
theirs. An electricity line, at the beginning of our trip being at the end
of the beach starts approaching the sea, or viceversa, as you move southward,
to end up many metres inside the water. The old people in the Delta still
remember the 200m tall lighthouse in the Illa de Buda, which the sea
managed to devour.

Sunset at the salines del Delta
When we reached the Punta we could watch a beautiful sunset
over the mountains of Els Ports, and when it got dark and cold we
headed to Tortosa, the area's capital, which I had recently visited for the
first time for one of Softcatal 's
meetings. There, we had dinner at a bar and met Jordi and Anna for a while,
before going back to Ampolla, going to bed relatively early due to everyone
being very tired.
On Saturday, we decided to have a look at the Delta... from above. So we
drove to the top of the Cim del Caro, where we could admire a great
view over the flat farmlands of the Delta, and then found a nice trail which
took us to a nice forest, where we had lunch. After a visit to Alfara de
Carles, we went back to the house, had a great dinner and played fun games at
the table.
Unfortunately, Sunday morning was dedicated to cleaning up the mess in the
appartment and packing, as part of the group, the Jordis from Alcoi and the
twins, had to leave early. The remaining four Valencians decided to go to
Deltebre to have a local paella. It was quite good, although the bar
tender laughed at our request to eat directly from the paella, rejecting
dishes. Small cultural clash. ;)
I remember downloading and viewing the pictures of the trip a few days
after getting back in Val ncia, and then losing track of them. Last week,
while testing an EPIA board with some random hard drive, I suddenly realised
there was a big chance the pictures would be on that drive, and after some
search, I found them; I had been close to mkfs the disk a few minutes
before. I hadn't stopped blaming myself for misplacing these pictures, as they
remind me of this wonderful weekend. Luckily, they are back!
Going back to the state of the Delta, experts say it will be mostly gone
in 200 years. All of the Terres de l'Ebre have fought against the previous
government's "PHN" plan to divert part of the river's flow to the North and
South, to supply Barcelona, and specially the South of Val ncia, where the
developing of the coastal areas is out of control. I fear that whenever PP
regains power in Madrid, they will retake this idea. There is a lot of money
involved in building a 700 km long scar in our land. The Delta de
l'Ebre is a fantastic place which doesn't deserve a terrible fate like
this, only for the benefit of the usual suspects. As the good people of this
land would say...
Lo riu s vida. No al transvasament!
MAJOR=$(awk '/device-mapper/ print $1;exit ' /proc/devices)
dmsetup ls --target linear while read map extra; do
TABLE=$(dmsetup table $map while IFS=" :" read start length linear major minor offset; do
map2=
if [ "$major" -eq "$MAJOR" ]; then
IFS=":" read map2 extra <<EOF
$(dmsetup info -c --noheadings -j $major -m $minor)
EOF
fi
if [ -z "$map2" ] [ $(dmsetup table "$map2" wc -l) -gt 1 ] [ $(dmsetup table --target crypt "$map2" wc -l) -eq 0 ]; then
echo $start $length $linear $major:$minor $offset
else
IFS=" " read cstart clength crypt format key IVoff dev coffset <<EOF
$(dmsetup table "$map2")
EOF
echo $start $length crypt $format $key $(expr $IVoff + $offset) $dev $(expr $coffset + $offset)
fi
done)
if (dmsetup table $map; echo "$TABLE") sort uniq -c grep -v "^ *2 " > /dev/null 2>&1;
then
echo Diverting $map
dmsetup reload $map <<EOF
$TABLE
EOF
dmsetup resume $map
fi
done
[ Update: There was a dmsetup resume missing in the script ]
After running this script, you should be able to run cryptsetup luksClose on your LUKS volume. Once you’ve done it, pvdisplay and other LVM tools will show you nothing, because the physical volume will just have disappeared… but everything will still be in place. Note that if you leave the LUKs volume open, you’d better be careful NOT to do operations with LVM (such as pvmove) because it could break everything.
Note that on sid, you would need to add a –showkey option into the $(dmsetup table "$map2") line. This option is necessary for dmsetup to display the encryption keys.
I wonder if LVM upstream would consider supporting LUKS volumes directly…
Anyways, back to the in-place conversion to LVM over LUKs. The idea would be to:
argv[0] to report status information in the process list.
But what if argv[0] is fine, and what you want to do is remove the following arguments from the process list? Perhaps they contain sensitive information, or perhaps they’re just likely to be surprising.
A fictional example may look like this (I’ve added the $ to demonstrate a later problem):
11234 ? S 0:00 some-program --username=foo --passphrase=bar$
How not to do it
The first thing you’ll probably try is just setting those arguments in the argv list to NULL. For example, with code like this:
for (i = 1; i < argc; i++)
argv[i] = NULL;
That won’t work because that array is just a list of pointers to the real area in which the arguments are stored, and is local to your main function. Modifying it has no effect what ps and similar see.
The next thing you might try, as a C programmer, is setting the first character of each argument to a NULL byte. It’s not unreasonable to assume that these strings are likely to be NULL-terminated. You might use code like:
for (i = 1; i < argc; i++)
strcpy (argv[i], "");
But that doesn’t seem to work either, in fact, what you get in the process list is something rather odd and unexpected!
11234 ? S 0:00 some-program -username=foo -passphrase=bar$
All that’s done is lost the first character of each argument.
In frustration, you might try overwriting the entire argument with NULL bytes, e.g.
for (i = 1; i < argc; i++)
memset (argv[i], '\0', strlen (argv[i]));
Checking the process list, that will have seemed to have worked…
11234 ? S 0:00 some-program $
On closer inspection though, it’s not perfect. You’ll notice that the line ends with spaces in place of where the arguments used to be. If the number or length of arguments you’re trying to hide is particularly long, you can end up with strange blank lines in ps output.
Not ideal.
Why this happens
To understand why this happens, we need to understand how the kernel reports the command line to ps. ps reads the /proc/PID/cmdline file, with contains the entire command line as a single character array, with each argument terminated by a NULL byte.
Looking at it with od -t c, we see something like:
0000000 s o m e - p r o g r a m \0 - - u
0000020 s e r n a m e = f o o \0 - - p a
0000040 s s p h r a s e = b a r \0
When we changed just the first character to a NULL byte, we ended up with:
0000000 s o m e - p r o g r a m \0 \0 - u
0000020 s e r n a m e = f o o \0 \0 - p a
0000040 s s p h r a s e = b a r \0
ps is just assuming that \0 represents any argument gap, so outputs an ordinary space character every time it encounters one. This is why the first character of each argument appeared to be replaced by a space, and the rest were still printed.
When we overwrite the arguments, we ended up with:
0000000 s o m e - p r o g r a m \0 \0 \0 \0
0000020 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0
0000040 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0
Writing all those zeros didn’t change the length of the command line character array, so ps got all those NULLs and output a space character for each one, assuming it was an argument break.
What we need to is decrease the length of this character array, so ps only sees the first argument.
How to do it
The kernel maintains internal pointers to the start and end of the arguments array in the process address space. When you ask for the cmdline file in /proc, it replies with all of the characters between these two positions and a length of the difference.
The kernel doesn’t provide us with any method of moving this pointer, so we’d initially appear to be stuck.
However there turns out to be a very nasty solution.
In order to support processes changing their title, the kernel has to support the arguments possibly overrunning into the environment space. If it thinks this has happened, it concatenates the environment space onto the end of the buffer and returns the entire area with the length set to the length up to the first NULL byte.
All we need to do is fool the kernel into thinking we’ve overrun into the environment space, it’ll then just call strlen on the arguments list and return only the first argument; exactly what we want!
What technique does the kernel use for deciding whether or not the arguments have overrun into the environment space? It checks whether the final character in the argument space is NULL or not.
Thus paradoxically, to hide the argument list from ps, we remove the NULL …
if (argc > 1)
char *arg_end;
arg_end = argv[argc-1] + strlen (argv[argc-1]);
*arg_end = ' ';
The check against argc is necessary, as we don’t want to remove the NULL character on the end of argv[0] as that would cause the first environment variable to be inadvertently concatenated.
Now when we look at ps, we see just the program name:
11234 ? S 0:00 some-program$
And even when we look in /proc/PID/cmdline, we only see the program name and no additional arguments.
0000000 s o m e - p r o g r a m \0
Next.