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]
Message-ID: <b3764692-bfe4-b3f3-acbb-71275e7053b0@yandex-team.ru>
Date:   Mon, 5 Sep 2016 17:02:43 +0300
From:   Konstantin Khlebnikov <khlebnikov@...dex-team.ru>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Konstantin Khlebnikov <koct9i@...il.com>
Cc:     Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        NeilBrown <neilb@...e.de>, Tejun Heo <tj@...nel.org>,
        Stable <stable@...r.kernel.org>,
        Alexander Viro <viro@...iv.linux.org.uk>
Subject: Re: [PATCH] sysfs: correctly handle read offset on PREALLOC attrs

On 05.09.2016 16:46, Greg Kroah-Hartman wrote:
> On Mon, Sep 05, 2016 at 04:25:48PM +0300, Konstantin Khlebnikov wrote:
>> Bump
>
> Huh?
>
>> On Wed, Jun 22, 2016 at 9:42 PM, Konstantin Khlebnikov
>> <khlebnikov@...dex-team.ru> wrote:
>>> Attributes declared with __ATTR_PREALLOC use sysfs_kf_read() which returns
>>> zero bytes for non-zero offset. This breaks script checkarray in mdadm tool
>>> in debian where /bin/sh is 'dash' because its builtin 'read' reads only one
>>> byte at a time. Script gets 'i' instead of 'idle' when reads current action
>>> from /sys/block/$dev/md/sync_action and as a result does nothing.
>>>
>>> This patch adds trivial implementation of partial read: generate whole
>>> string and move required part into buffer head.
>>>
>>> Signed-off-by: Konstantin Khlebnikov <khlebnikov@...dex-team.ru>
>>> Fixes: 4ef67a8c95f3 ("sysfs/kernfs: make read requests on pre-alloc files use the buffer.")
>>> Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=787950
>>> Cc: Stable <stable@...r.kernel.org> # v3.19+
>>> ---
>>>  fs/sysfs/file.c |    8 +++++++-
>>>  1 file changed, 7 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
>>> index f35523d4fa3a..b803213d1307 100644
>>> --- a/fs/sysfs/file.c
>>> +++ b/fs/sysfs/file.c
>>> @@ -114,9 +114,15 @@ static ssize_t sysfs_kf_read(struct kernfs_open_file *of, char *buf,
>>>          * If buf != of->prealloc_buf, we don't know how
>>>          * large it is, so cannot safely pass it to ->show
>>>          */
>>> -       if (pos || WARN_ON_ONCE(buf != of->prealloc_buf))
>>> +       if (WARN_ON_ONCE(buf != of->prealloc_buf))
>>>                 return 0;
>>>         len = ops->show(kobj, of->kn->priv, buf);
>>> +       if (pos) {
>>> +               if (len <= pos)
>>> +                       return 0;
>>> +               len -= pos;
>>> +               memmove(buf, buf + pos, len);
>>> +       }
>>>         return min(count, len);
>>>  }
>
> I don't have this in any queue of mine, so I don't understand what you
> are asking about.
>
> totally confused,
>

Well.. One user poked me about this bug.

Patch was
Acked-by: Tejun Heo <tj@...nel.org>

get_maintainer.pl points to you but probably this more VFS problem. so... this time I've added Al into CC
Should I resend patch once again, or this very trivial but pretty dangerous problem could be solved without this?

IIRR this breaks automatic recheck of MD RAIDs for all debian-based systems

-- 
Konstantin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ