lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Tue, 21 Aug 2018 09:41:57 +0200
From:   Richard Weinberger <richard@....at>
To:     liu.song11@....com.cn
Cc:     dedekind1@...il.com, adrian.hunter@...el.com,
        linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org,
        jiang.biao2@....com.cn, zhong.weidong@....com.cn
Subject: Re: [PATCH] ubifs: remove unnecessary check in ubifs_log_start_commit

Am Dienstag, 21. August 2018, 08:57:44 CEST schrieb liu.song11@....com.cn:
> Hi Richard,
> 
> In ubifs_log_start_commit, the value of c->lhead_offs is zero or set to zero by code bellow
> 409         /* Switch to the next log LEB */
> 410         if (c->lhead_offs) {
> 411                 c->lhead_lnum = ubifs_next_log_lnum(c, c->lhead_lnum);
> 412                 ubifs_assert(c->lhead_lnum != c->ltail_lnum);
> 413                 c->lhead_offs = 0;
> 414         }
> 
> The value of 'len' can not exceed 'max_len' which assigned value by code bellow
> 370         max_len = UBIFS_CS_NODE_SZ + c->jhead_cnt * UBIFS_REF_NODE_SZ;
> 
> So, the value of c->lhead_offs cannot exceed 'max_len' 
> 429         c->lhead_offs += len;
> 430         if (c->lhead_offs == c->leb_size) {
> 431                 c->lhead_lnum = ubifs_next_log_lnum(c, c->lhead_lnum);
> 432                 c->lhead_offs = 0;
> 433         }
> 
> Usually, the size of PEB is between 64KB and 256KB, and in UBIFS, the value of
> c->lhead_offs far less than UBIFS_BLOCK_SIZE which equal to 4096. So I think
> the value of c->lhead_offs far less than c->leb_size, the check in line 430 seem 
> never to be true.

Okay, now it makes sense.
But what has this do to with UBIFS_BLOCK_SIZE?

Anyway, your patch description needs to be more detailed.
What you explained to me right now needs to go in the commit message.
Then people can understand why the check is not needed.
For the sake of paranoia and debug-ability, please also add a
ubifs_assert(c->lhead_offs < c->leb_size);.

Thanks,
//richard


Powered by blists - more mailing lists