Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Oct 2011 16:37:38 -0400
From:      Arnaud Lacombe <lacombar@gmail.com>
To:        Warren Block <wblock@wonkity.com>
Cc:        Garrett Cooper <yanegomi@gmail.com>, Glen Barber <gjb@freebsd.org>, Poul-Henning Kamp <phk@phk.freebsd.dk>, freebsd-current@freebsd.org, Benjamin Kaduk <kaduk@mit.edu>
Subject:   Re: aliasing (or renaming) kern.geom.debugflags
Message-ID:  <CACqU3MV2cMxRHuqLCk5wmETB%2B3_fpxt-nYz_zy9rdL%2BF-8oypg@mail.gmail.com>
In-Reply-To: <alpine.BSF.2.00.1110071352210.2450@wonkity.com>
References:  <81477.1318015137@critter.freebsd.dk> <4E8F55CC.3060302@FreeBSD.org> <alpine.BSF.2.00.1110071352210.2450@wonkity.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

On Fri, Oct 7, 2011 at 4:27 PM, Warren Block <wblock@wonkity.com> wrote:
> On Fri, 7 Oct 2011, Glen Barber wrote:
>
>> Hi,
>>
>> On 10/7/11 3:18 PM, Poul-Henning Kamp wrote:
>>>>
>>>> My guess is that GEOM isn't letting go of the GPT table and you have
>>>> multiple partitions in the GPT table and you're not destroying them
>>>> hierarchically in a proper manner.. but again, that's just a guess
>>>> based on hazy recollection.
>>>
>>> If none of the GPT partitions are open, you should be able to
>>> open /dev/da0. =A0If not, the GPT geom class is buggy.
>>>
>>
>> In my experience, without kern.geom.debugflags=3D16, the MBR will not be
>> written to the memstick, leaving you with what would effectively be a
>> coaster in the not-so-distant past.
>
> Tried it just now with the 9.0-BETA3 memstick image.
>
> # dd if=3D/tmp/FreeBSD-9.0-BETA3-amd64-memstick.img of=3D/dev/da0 bs=3D64=
k
> 10463+1 records in
> 10463+1 records out
> 685731840 bytes transferred in 52.614157 secs (13033219 bytes/sec)
> # mount /dev/da0p2 /mnt
> # dd if=3D/tmp/FreeBSD-9.0-BETA3-amd64-memstick.img of=3D/dev/da0 bs=3D64=
k
> dd: /dev/da0: Operation not permitted
> # sysctl kern.geom.debugflags=3D16
> kern.geom.debugflags: 0 -> 16
> # dd if=3D/tmp/FreeBSD-9.0-BETA3-amd64-memstick.img of=3D/dev/da0 bs=3D64=
k
> 10463+1 records in
> 10463+1 records out
> 685731840 bytes transferred in 52.915362 secs (12959031 bytes/sec)
>
in the mean time, some background application issued a sync(2),
corrupting part of what you just wrote, if not crashing the kernel.

> Followed by removing the memory stick without unmounting it to avoid
> overwriting part of the image. =A0No obvious problems, but no, it's not
> polite. =A0(I'm thinking "automounter" here.)
>
> We could make the normal procedure just the dd, followed by a note:
>
> =A0If this gives an 'Operation not permitted' error, make sure that the
> =A0target device is not in use or being automounted by some helpful
> =A0utility program.
>
> And maybe
>
> =A0If the error still appears and no other options are available,
> =A0 =A0sysctl kern.geomflags.debug=3D16
> =A0will override the system safety and allow writes to the device.
>
Then you can start to introduce backdoor for every single
kernel-enforced policy. `kern.geomflags.debug=3D16' should not be used
by the lambda user.

 - Arnaud



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACqU3MV2cMxRHuqLCk5wmETB%2B3_fpxt-nYz_zy9rdL%2BF-8oypg>