From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: zaitcev@redhat.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: SECURITY - data leakage due to incorrect strncpy implementation
Date: Thu, 29 Jan 2004 09:57:58 +0100 [thread overview]
Message-ID: <20040129085758.GA944@mschwid3.boeblingen.de.ibm.com> (raw)
Hi Pete,
> I do not undestand Alan's position, if he is for it or against it.
> Anyway, in case you want it, here's what I wrote for s390.
> I wrote some userland tests, it seems to check out. BUT I warn you,
> someone better check my assembly.
Learning to write inline assembly? Nice, but it has one small
problem, the count in %r4 is not decremented for 0x00 byte.
Try my little patch.
blue skies,
Martin.
diff -urN linux-2.6.1/arch/s390/lib/strncpy.S linux-2.6.1-s390/arch/s390/lib/strncpy.S
--- linux-2.6.1/arch/s390/lib/strncpy.S Fri Jan 9 07:59:45 2004
+++ linux-2.6.1-s390/arch/s390/lib/strncpy.S Thu Jan 29 09:53:02 2004
@@ -23,8 +23,13 @@
LA 3,1(3)
STC 0,0(1)
LA 1,1(1)
- JZ strncpy_exit # ICM inserted a 0x00
+ JZ strncpy_pad # ICM inserted a 0x00
BRCT 4,strncpy_loop # R4 -= 1, jump to strncpy_loop if > 0
strncpy_exit:
BR 14
-
+strncpy_clear:
+ STC 0,0(1)
+ LA 1,1(1)
+strncpy_pad:
+ BRCT 4,strncpy_clear
+ BR 14
diff -urN linux-2.6.1/arch/s390/lib/strncpy64.S linux-2.6.1-s390/arch/s390/lib/strncpy64.S
--- linux-2.6.1/arch/s390/lib/strncpy64.S Fri Jan 9 07:59:10 2004
+++ linux-2.6.1-s390/arch/s390/lib/strncpy64.S Thu Jan 29 09:53:02 2004
@@ -23,8 +23,13 @@
LA 3,1(3)
STC 0,0(1)
LA 1,1(1)
- JZ strncpy_exit # ICM inserted a 0x00
+ JZ strncpy_pad # ICM inserted a 0x00
BRCTG 4,strncpy_loop # R4 -= 1, jump to strncpy_loop if > 0
strncpy_exit:
BR 14
-
+strncpy_clear:
+ STC 0,0(1)
+ LA 1,1(1)
+strncpy_pad:
+ BRCTG 4,strncpy_clear
+ BR 14
next reply other threads:[~2004-01-29 8:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-29 8:57 Martin Schwidefsky [this message]
-- strict thread matches above, loose matches on Subject: below --
2003-07-11 19:04 Sound updating, security of strlcpy and a question on pci v unload Mikulas Patocka
2003-07-11 21:45 ` SECURITY - data leakage due to incorrect strncpy implementation Alan Cox
2003-07-11 22:10 ` Alan Cox
2003-07-11 23:49 ` Paul Mackerras
2003-07-12 21:28 ` Horst von Brand
2003-07-13 8:02 ` Alan Cox
2003-07-11 22:44 ` Linus Torvalds
2003-07-11 22:50 ` Alan Cox
2004-01-29 3:11 ` Pete Zaitcev
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=20040129085758.GA944@mschwid3.boeblingen.de.ibm.com \
--to=schwidefsky@de.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=zaitcev@redhat.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: link
Be 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.