From: "Valentin Vidić" <vvidic@valentin-vidic.from.hr> To: Joseph Qi <joseph.qi@linux.alibaba.com> Cc: Mark Fasheh <mark@fasheh.com>, Joel Becker <jlbec@evilplan.org>, ocfs2-devel@oss.oracle.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ocfs2: mount fails with buffer overflow in strlen Date: Tue, 28 Sep 2021 15:14:50 +0200 [thread overview] Message-ID: <20210928131450.GM28341@valentin-vidic.from.hr> (raw) In-Reply-To: <00850aed-2027-a0ab-e801-c6498a5a49f8@linux.alibaba.com> On Tue, Sep 28, 2021 at 08:05:22PM +0800, Joseph Qi wrote: > strlcpy in ocfs2_initialize_super() is introduced 8 years ago, so I > don't understand why you've mentioned that the issues starts from > v5.11. v5.11 introduced the overflow checks to string functions so that is when the mount started to fail. > osb->osb_cluster_stack and osb->osb_cluster_name is always larger by > 1 than which in ocfs2_cluster_info, and the input size of strlcpy does > the same, so I don't see how it overflows. strlcpy internally calls strlen on the source argument, in this case that is ci_stack array with size of 4. That array stores the value "o2cb" so the strlen continues reading into the union until it reaches a zero byte somewhere. The same would happen with ci_cluster if the cluster name is long enough. struct ocfs2_cluster_info { /*00*/ __u8 ci_stack[OCFS2_STACK_LABEL_LEN]; union { __le32 ci_reserved; struct { __u8 ci_stackflags; __u8 ci_reserved1; __u8 ci_reserved2; __u8 ci_reserved3; }; }; /*08*/ __u8 ci_cluster[OCFS2_CLUSTER_NAME_LEN]; /*18*/ }; -- Valentin
WARNING: multiple messages have this Message-ID (diff)
From: "Valentin Vidić" <vvidic@valentin-vidic.from.hr> To: Joseph Qi <joseph.qi@linux.alibaba.com> Cc: ocfs2-devel@oss.oracle.com, linux-kernel@vger.kernel.org Subject: Re: [Ocfs2-devel] [PATCH] ocfs2: mount fails with buffer overflow in strlen Date: Tue, 28 Sep 2021 15:14:50 +0200 [thread overview] Message-ID: <20210928131450.GM28341@valentin-vidic.from.hr> (raw) In-Reply-To: <00850aed-2027-a0ab-e801-c6498a5a49f8@linux.alibaba.com> On Tue, Sep 28, 2021 at 08:05:22PM +0800, Joseph Qi wrote: > strlcpy in ocfs2_initialize_super() is introduced 8 years ago, so I > don't understand why you've mentioned that the issues starts from > v5.11. v5.11 introduced the overflow checks to string functions so that is when the mount started to fail. > osb->osb_cluster_stack and osb->osb_cluster_name is always larger by > 1 than which in ocfs2_cluster_info, and the input size of strlcpy does > the same, so I don't see how it overflows. strlcpy internally calls strlen on the source argument, in this case that is ci_stack array with size of 4. That array stores the value "o2cb" so the strlen continues reading into the union until it reaches a zero byte somewhere. The same would happen with ci_cluster if the cluster name is long enough. struct ocfs2_cluster_info { /*00*/ __u8 ci_stack[OCFS2_STACK_LABEL_LEN]; union { __le32 ci_reserved; struct { __u8 ci_stackflags; __u8 ci_reserved1; __u8 ci_reserved2; __u8 ci_reserved3; }; }; /*08*/ __u8 ci_cluster[OCFS2_CLUSTER_NAME_LEN]; /*18*/ }; -- Valentin _______________________________________________ Ocfs2-devel mailing list Ocfs2-devel@oss.oracle.com https://oss.oracle.com/mailman/listinfo/ocfs2-devel
next prev parent reply other threads:[~2021-09-28 13:15 UTC|newest] Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-09-27 15:44 [PATCH] ocfs2: mount fails with buffer overflow in strlen Valentin Vidic 2021-09-27 15:44 ` [Ocfs2-devel] " Valentin Vidic 2021-09-28 12:05 ` Joseph Qi 2021-09-28 12:05 ` [Ocfs2-devel] " Joseph Qi 2021-09-28 13:14 ` Valentin Vidić [this message] 2021-09-28 13:14 ` Valentin Vidić 2021-09-29 2:38 ` Joseph Qi 2021-09-29 2:38 ` [Ocfs2-devel] " Joseph Qi 2021-09-29 6:24 ` Valentin Vidić 2021-09-29 6:24 ` [Ocfs2-devel] " Valentin Vidić 2021-09-29 9:12 ` Joseph Qi 2021-09-29 9:12 ` [Ocfs2-devel] " Joseph Qi 2021-09-29 18:06 ` [PATCH v2] " Valentin Vidic 2021-09-29 18:06 ` [Ocfs2-devel] " Valentin Vidic 2021-09-30 1:54 ` Joseph Qi 2021-09-30 1:54 ` [Ocfs2-devel] " Joseph Qi 2021-10-08 10:46 ` Gang He
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210928131450.GM28341@valentin-vidic.from.hr \ --to=vvidic@valentin-vidic.from.hr \ --cc=jlbec@evilplan.org \ --cc=joseph.qi@linux.alibaba.com \ --cc=linux-kernel@vger.kernel.org \ --cc=mark@fasheh.com \ --cc=ocfs2-devel@oss.oracle.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.