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  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 06 Jun 2017 07:33:39 -0400
From:   Mimi Zohar <zohar@...ux.vnet.ibm.com>
To:     Roberto Sassu <roberto.sassu@...wei.com>,
        linux-ima-devel@...ts.sourceforge.net
Cc:     linux-security-module@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [Linux-ima-devel] [PATCH 5/7] ima: add securityfs interface to
 save a measurements list with kexec header

On Tue, 2017-06-06 at 11:13 +0200, Roberto Sassu wrote:
> >>  /* returns pointer to hlist_node */
> >>  static void *ima_measurements_start(struct seq_file *m, loff_t *pos)
> >>  {
> >>      loff_t l = *pos;
> >>      struct ima_queue_entry *qe;
> >> +    struct ima_queue_entry *qe_found = NULL;
> >> +    unsigned long size = 0, count = 0;
> >> +    bool khdr = m->file->f_path.dentry == binary_kexec_runtime_measurements;
> >>
> >>      /* we need a lock since pos could point beyond last element */
> >>      rcu_read_lock();
> >>      list_for_each_entry_rcu(qe, &ima_measurements, later) {
> >> -            if (!l--) {
> >> -                    rcu_read_unlock();
> >> -                    return qe;
> >> +            if (!l) {
> >> +                    qe_found = qe_found ? qe_found : qe;
> >
> > What is this?
> 
> ima_measurements_start() should return the list entry at position *pos.
> The line above prevents qe_found from being updated when the loop
> continues until the last list entry.

Wouldn't a simple if/then be more appropriate here?

> 
> >
> >> +
> >> +                    if (!khdr)
> >> +                            break;
> >
> > Does this test need to be in the loop?
> 
> Yes. Otherwise, ima_measurements_start() would iterate over the whole
> list when it is not necessary.

Oh, for displaying the measurement list you need to set qe_found
before returning.

thanks,

Mimi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ