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:	Fri, 04 Jan 2008 09:07:26 +0900
From:	Tejun Heo <teheo@...e.de>
To:	Andrew Patterson <andrew.patterson@...com>
Cc:	Greg KH <greg@...ah.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org, linux-hotplug@...r.kernel.org,
	bjorn.helgaas@...com
Subject: Re: Error returns not handled	correctly	by	sysfs.c:subsys_attr_store()

Hello,

Andrew Patterson wrote:
> It looks like this is a shell issue.  After looking through the sysfs
> code, I realized that this problem seems to be driven from user-land.
> So I performed some experiments:
> 
>      1. Wrote a simple program that just used write(2) to write to the
>         sysfs entry. This works fine.
>      2. Used /bin/echo instead of the built-in echo command.  This too
>         works fine.
>      3. Tried several shells.  Zsh and Bash both fail.  Csh works fine.
> 
> I then ran strace on the following shell-script:
> 
> #!/bin/bash
> 
> echo x > allow_restart
> echo y > allow_restart
> echo z > allow_restart
> 
> and got:
> 
> # strace -e trace=write ~/tmp/tester.sh 
> write(1, "x\n", 2)                      = -1 EINVAL (Invalid argument)
> write(1, "x\n", 2)                      = -1 EINVAL (Invalid argument)
> write(2, "/home/andrew/tmp/tester.sh: line"..., 72/home/andrew/tmp/tester.sh: line 4: echo: write error: Invalid argument
> ) = 72
> write(1, "x\ny\n", 4)                   = -1 EINVAL (Invalid argument)
> write(1, "x\ny\n", 4)                   = -1 EINVAL (Invalid argument)
> write(2, "/home/andrew/tmp/tester.sh: line"..., 72/home/andrew/tmp/tester.sh: line 5: echo: write error: Invalid argument
> ) = 72
> write(1, "x\ny\nz\n", 6)                = -1 EINVAL (Invalid argument)
> write(1, "x\ny\nz\n", 6)                = -1 EINVAL (Invalid argument)
> write(2, "/home/andrew/tmp/tester.sh: line"..., 72/home/andrew/tmp/tester.sh: line 6: echo: write error: Invalid argument
> ) = 72
> write(1, "x\ny\nz\n", 6x
> y
> z
> )                = 6
> Process 3800 detached

Eeeeeeeekkkk.... That's scary.  Which distro are you using and what does
'bash --version' say?

-- 
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ