Re: Trying do mount a slice containing a r/o mounted partition makes the filesystem unreadable

2021-03-03 Thread Arrigo Marchiori via freebsd-stable
Dear All,

On Tue, Mar 02, 2021 at 10:55:15AM +0200, Andriy Gapon wrote:

> On 02/03/2021 09:50, Arrigo Marchiori via freebsd-stable wrote:
> > Dear All,
> > 
> > On Sat, Feb 27, 2021 at 04:34:52PM +0100, Arrigo Marchiori via 
> > freebsd-stable wrote:
> > 
> >> Hello Helge, and thank you for replying again.
> >>
> >> On Sat, Feb 27, 2021 at 03:43:52PM +0100, Helge Oldach wrote:
> >>
> >>> Arrigo Marchiori via freebsd-stable wrote on Sat, 27 Feb 2021 14:00:24 
> >>> +0100 (CET):
>  On the memstick, the root filesystem is mounted read-only.  I
>  apologize, I should have told it explicitly.  The ``invalid'' attempt
>  is to mount it read-write (no mode is indicated on the command line).
> >>>
> >>> Try to make it r/w mounted (which I suspect you are attempting to
> >>> achieve):
> >>>
> >>> mount -uw /
> >>
> >> Ok, I will try this.
> >>
> >> But just for the record: I am not try to achieve anything.  I gave the
> >> ``invalid'' mount command by mistake (I wanted to mount a partition
> >> from another disk and wrote "da0" instead of "da1") and I saw that the
> >> system became unstable. I thought that this should not happen and I
> >> reported it here.
> > 
> > I have two updates.
> > 
> >  1- the da0s2a slice starts 16 (blocks?) after the beginning of da0s2.
> > bsdlabel(8) output (copied by hand):
> > # /dev/da0s2:
> > 8 partitions:
> > #   size offsetfstype[fsize  bsize bps/cpg]
> >   a: 1491200 164.2BSD 0  0 0
> >   c: 1491216  0unused 0  0 # "raw" part, don't 
> > edit
> > 
> >  2- if I mount the partition rw, then the mount command _always_ fails
> >  with error "operation not permitted" and the system _always_ remains
> >  stable. This is independent from mounting from /dev/ufs/label or
> >  /dev/da0s2a.
> > 
> > Therefore I can change the description of this problem report as:
> > 
> > 8<8<8<8<8<8<8<-
> > 
> > When a BSD partition is mounted _read_only_ to / (suppose
> > /dev/da0s2a), if I try to mount its containing slice (/dev/da0s2) I
> > receive a ``strange'' error message, and from that moment the mounted
> > filesystem becomes unreadable.
> > 
> >  - If the partition is mounted from /dev/ufs/label, then mount(8)
> > reports "Operation not permitted" and the system remains stable.
> > This is the expected behavior IMHO.
> > 
> >  - If the partition is mounted read_write, from any special device,
> >then mount(8) reports:
> >  - "Operation not permitted" if I try to mount the slice rw,
> >  - the same strange error message if I try to mount the slice ro,
> >and the system remains stable.
> > 
> >  - The "strange error message" is "invalid argument" on 11.4-STABLE.
> > 
> > 8<8<8<8<8<8<8<-
> > 
> > Now to the question: is this worth a PR? Was it already reported?  Or
> > is it just something that ``should not happen'' because root should be
> > allowed to shoot themselves in the foot?
> > 
> > Thank you in advance and best regards,
> 
> I think that this is worth a PR.

Just reported:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=254005

> I think that even when mounting read-only the underlying GEOM object should be
> marked for exclusive use.
> I vaguely recall that UFS has some quirk in this respect to allow for
> modifications by fsck.  That is supposed to be limited to the root filesystem.
> Maybe it should further be limited to certain boot stages to prevent
> foot-shooting after a system is fully booted.

Thank you and best regards,
-- 
Arrigo

http://rigo.altervista.org
___
freebsd-stable@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Trying do mount a slice containing a r/o mounted partition makes the filesystem unreadable

2021-03-02 Thread Andriy Gapon
On 02/03/2021 09:50, Arrigo Marchiori via freebsd-stable wrote:
> Dear All,
> 
> On Sat, Feb 27, 2021 at 04:34:52PM +0100, Arrigo Marchiori via freebsd-stable 
> wrote:
> 
>> Hello Helge, and thank you for replying again.
>>
>> On Sat, Feb 27, 2021 at 03:43:52PM +0100, Helge Oldach wrote:
>>
>>> Arrigo Marchiori via freebsd-stable wrote on Sat, 27 Feb 2021 14:00:24 
>>> +0100 (CET):
 On the memstick, the root filesystem is mounted read-only.  I
 apologize, I should have told it explicitly.  The ``invalid'' attempt
 is to mount it read-write (no mode is indicated on the command line).
>>>
>>> Try to make it r/w mounted (which I suspect you are attempting to
>>> achieve):
>>>
>>> mount -uw /
>>
>> Ok, I will try this.
>>
>> But just for the record: I am not try to achieve anything.  I gave the
>> ``invalid'' mount command by mistake (I wanted to mount a partition
>> from another disk and wrote "da0" instead of "da1") and I saw that the
>> system became unstable. I thought that this should not happen and I
>> reported it here.
> 
> I have two updates.
> 
>  1- the da0s2a slice starts 16 (blocks?) after the beginning of da0s2.
> bsdlabel(8) output (copied by hand):
> # /dev/da0s2:
> 8 partitions:
> #   size offsetfstype[fsize  bsize bps/cpg]
>   a: 1491200 164.2BSD 0  0 0
>   c: 1491216  0unused 0  0 # "raw" part, don't 
> edit
> 
>  2- if I mount the partition rw, then the mount command _always_ fails
>  with error "operation not permitted" and the system _always_ remains
>  stable. This is independent from mounting from /dev/ufs/label or
>  /dev/da0s2a.
> 
> Therefore I can change the description of this problem report as:
> 
> 8<8<8<8<8<8<8<-
> 
> When a BSD partition is mounted _read_only_ to / (suppose
> /dev/da0s2a), if I try to mount its containing slice (/dev/da0s2) I
> receive a ``strange'' error message, and from that moment the mounted
> filesystem becomes unreadable.
> 
>  - If the partition is mounted from /dev/ufs/label, then mount(8)
> reports "Operation not permitted" and the system remains stable.
> This is the expected behavior IMHO.
> 
>  - If the partition is mounted read_write, from any special device,
>then mount(8) reports:
>  - "Operation not permitted" if I try to mount the slice rw,
>  - the same strange error message if I try to mount the slice ro,
>and the system remains stable.
> 
>  - The "strange error message" is "invalid argument" on 11.4-STABLE.
> 
> 8<8<8<8<8<8<8<-
> 
> Now to the question: is this worth a PR? Was it already reported?  Or
> is it just something that ``should not happen'' because root should be
> allowed to shoot themselves in the foot?
> 
> Thank you in advance and best regards,

I think that this is worth a PR.
I think that even when mounting read-only the underlying GEOM object should be
marked for exclusive use.
I vaguely recall that UFS has some quirk in this respect to allow for
modifications by fsck.  That is supposed to be limited to the root filesystem.
Maybe it should further be limited to certain boot stages to prevent
foot-shooting after a system is fully booted.


-- 
Andriy Gapon
___
freebsd-stable@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: Trying do mount a slice containing a r/o mounted partition makes the filesystem unreadable

2021-03-01 Thread Arrigo Marchiori via freebsd-stable
Dear All,

On Sat, Feb 27, 2021 at 04:34:52PM +0100, Arrigo Marchiori via freebsd-stable 
wrote:

> Hello Helge, and thank you for replying again.
> 
> On Sat, Feb 27, 2021 at 03:43:52PM +0100, Helge Oldach wrote:
> 
> > Arrigo Marchiori via freebsd-stable wrote on Sat, 27 Feb 2021 14:00:24 
> > +0100 (CET):
> > > On the memstick, the root filesystem is mounted read-only.  I
> > > apologize, I should have told it explicitly.  The ``invalid'' attempt
> > > is to mount it read-write (no mode is indicated on the command line).
> > 
> > Try to make it r/w mounted (which I suspect you are attempting to
> > achieve):
> > 
> > mount -uw /
> 
> Ok, I will try this.
> 
> But just for the record: I am not try to achieve anything.  I gave the
> ``invalid'' mount command by mistake (I wanted to mount a partition
> from another disk and wrote "da0" instead of "da1") and I saw that the
> system became unstable. I thought that this should not happen and I
> reported it here.

I have two updates.

 1- the da0s2a slice starts 16 (blocks?) after the beginning of da0s2.
bsdlabel(8) output (copied by hand):
# /dev/da0s2:
8 partitions:
#   size offsetfstype[fsize  bsize bps/cpg]
  a: 1491200 164.2BSD 0  0 0
  c: 1491216  0unused 0  0 # "raw" part, don't edit

 2- if I mount the partition rw, then the mount command _always_ fails
 with error "operation not permitted" and the system _always_ remains
 stable. This is independent from mounting from /dev/ufs/label or
 /dev/da0s2a.

Therefore I can change the description of this problem report as:

8<8<8<8<8<8<8<-

When a BSD partition is mounted _read_only_ to / (suppose
/dev/da0s2a), if I try to mount its containing slice (/dev/da0s2) I
receive a ``strange'' error message, and from that moment the mounted
filesystem becomes unreadable.

 - If the partition is mounted from /dev/ufs/label, then mount(8)
reports "Operation not permitted" and the system remains stable.
This is the expected behavior IMHO.

 - If the partition is mounted read_write, from any special device,
   then mount(8) reports:
 - "Operation not permitted" if I try to mount the slice rw,
 - the same strange error message if I try to mount the slice ro,
   and the system remains stable.

 - The "strange error message" is "invalid argument" on 11.4-STABLE.

8<8<8<8<8<8<8<-

Now to the question: is this worth a PR? Was it already reported?  Or
is it just something that ``should not happen'' because root should be
allowed to shoot themselves in the foot?

Thank you in advance and best regards,
-- 
Arrigo

http://rigo.altervista.org
___
freebsd-stable@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"