linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* nasm over gas?
@ 2003-09-04 10:42 Fruhwirth Clemens
  2003-09-04 12:32 ` Antonio Vargas
                   ` (3 more replies)
  0 siblings, 4 replies; 54+ messages in thread
From: Fruhwirth Clemens @ 2003-09-04 10:42 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 757 bytes --]

Hi!

I recently posted a module for twofish which implements the algorithm in
assembler (http://marc.theaimsgroup.com/?l=linux-kernel&m=106210815132365&w=2)

Unfortunately the assembler used is masm. I'd like to change that. Netwide
Assembler (nasm) is the assembler of my choice since it focuses on
portablity and has a more powerful macro facility (macros are heavily used
by 2fish_86.asm). But as I'd like to make my work useful (aim for an
inclusion in the kernel) I noticed that this would be the first module to
depend on nasm. Everything else uses gas.

So the question is: Is a patch which depends on nasm likely to be merged?

For more information on "what is nasm":
http://nasm.sourceforge.net/doc/html/nasmdoc1.html#section-1.1

Regards, Clemens

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

^ permalink raw reply	[flat|nested] 54+ messages in thread
* Re: nasm over gas?
@ 2003-09-05 12:21 John Bradford
  0 siblings, 0 replies; 54+ messages in thread
From: John Bradford @ 2003-09-05 12:21 UTC (permalink / raw)
  To: clemens-dated-1063536166.2852, joern; +Cc: linux-kernel

> Do some benchmarks on lots of different machines and measure the
> performance of the asm and c code.  If it's faster on PPro but not on
> PIII or Athlon, forget about it.

Presumably the asm code is tuned for a specific processor, and
intended to be used only on kernels optimised for that CPU.

On the other hand, unless it's translated to gas, it's more or less
useless in the context of the kernel - remember the 'perl in the
toolchain' discussion?

John.

^ permalink raw reply	[flat|nested] 54+ messages in thread
* Re: nasm over gas?
@ 2003-09-05 12:25 John Bradford
  2003-09-05 12:25 ` Fruhwirth Clemens
  2003-09-05 13:20 ` Richard B. Johnson
  0 siblings, 2 replies; 54+ messages in thread
From: John Bradford @ 2003-09-05 12:25 UTC (permalink / raw)
  To: clemens-dated-1063627487.e072, joern; +Cc: linux-kernel

> > Are there any buffer overflows or other security holes?
> > How can you be sure about it?
>
> How can you be sure? Mathematical program verification applies quite badly
> to assembler.

The point is, if somebody does find a bug they will want to
re-assemble with Gas after they've fixed it.

> > If your code fails on any one of these questions, forget about it.  If
> > it survives them, post your results and have someone else verify them.
>
> I'm sorry, your critique is too generel to be useful.

It's not, all the time the argument is not against the assembler code,
but rather against $assembler!=Gas.

John.

^ permalink raw reply	[flat|nested] 54+ messages in thread
* Re: nasm over gas?
@ 2003-09-05 13:57 John Bradford
  2003-09-05 15:39 ` Mehmet Ceyran
  0 siblings, 1 reply; 54+ messages in thread
From: John Bradford @ 2003-09-05 13:57 UTC (permalink / raw)
  To: root; +Cc: linux-kernel

> > > > Are there any buffer overflows or other security holes?
> > > > How can you be sure about it?
> > >
> > > How can you be sure? Mathematical program verification applies quite badly
> > > to assembler.
> >
> > The point is, if somebody does find a bug they will want to
> > re-assemble with Gas after they've fixed it.
> >
> > > > If your code fails on any one of these questions, forget about it.  If
> > > > it survives them, post your results and have someone else verify them.
> > >
> > > I'm sorry, your critique is too generel to be useful.
> >
> > It's not, all the time the argument is not against the assembler code,
> > but rather against $assembler!=Gas.
> >
> > John.
>
> All assemblers suck. However, they are exceeding useful. The
> code ends up being exactly what you write. Usually one only
> needs to learn one assembler per platform. It was a real shock
> for me to have to learn GAS, it was "backwards", seemed to
> think everything was a '68000, and basically sucked. However,
> once I learned how to use it, it became a useful tool.

Not sure whether you're agreeing with me or not, quite possibly
because my last comment used a double negative and was somewhat
ambiguous :-).

What I meant was that if a piece of perfect code exists, (and as you
point out, this can be mathematically _proven_ with assembler code,
not just demonstrated), the requirement for an open source assembler
other than Gas is not so much of a problem, because nobody should need
to touch that code.  If they do, they can translate it to Gas syntax.

If the possibility of bugs exists in the code, relying on
$assembler!=Gas is a bad thing, because there will be fewer people
willing to maintain it.

> The test of code that works in the 'real' world is called
> regression-testing. Basically, you run the stuff. You execute
> all "known" possible execution paths. If it works, it works.
> If it doesn't, you fix it until it does.

I totally agree.

> You need to test procedures as "black-boxes" with
> specified inputs and outputs. You also have to violate the
> input specifications and show that an error, so created, doesn't
> propagate. Such an error need not crash or kill the system, but
> it must be detected so that invalid output doesn't occur.
>
> Error-checkers like Lint, that use a specific langage such as 'C',
> can provide the programmer with a false sense of security. You
> end up with 'perfect' code with all the unwanted return-values
> cast to "void", but the logic remains wrong and will fail once
> the high-bit in an integer is set. So, in some sense, writing
> procedures in assembly is "safer". You know what the code will
> do before you run it. If you don't, stay away from assembly.

This is part of what makes someone a 'real' programmer, in my
opinion.

In my experience, 'Unreal' programmers tend to excessively re-use code
from other applications they've written, and just hack it about until
it works, at times leaving in code for features that are never used in
the new context :-).

John.

^ permalink raw reply	[flat|nested] 54+ messages in thread
[parent not found: <rZQN.83u.21@gated-at.bofh.it>]
[parent not found: <snJB.8dk.25@gated-at.bofh.it>]
[parent not found: <tt0q.6Rc.17@gated-at.bofh.it>]

end of thread, other threads:[~2003-09-13 19:51 UTC | newest]

Thread overview: 54+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-04 10:42 nasm over gas? Fruhwirth Clemens
2003-09-04 12:32 ` Antonio Vargas
2003-09-04 13:44 ` Yann Droneaud
2003-09-04 14:05   ` Richard B. Johnson
2003-09-04 14:21     ` Sean Neakums
2003-09-04 14:33       ` Richard B. Johnson
2003-09-04 15:09         ` Yann Droneaud
2003-09-04 14:55     ` Yann Droneaud
2003-09-05 21:16       ` George Anzinger
2003-09-04 14:57   ` Michael Frank
2003-09-04 15:43     ` Fruhwirth Clemens
2003-09-04 22:28     ` insecure
2003-09-05 12:59       ` Michael Frank
2003-09-05 17:28         ` insecure
2003-09-05 17:45           ` Jörn Engel
2003-09-06 17:18             ` insecure
2003-09-07 18:49           ` Eric W. Biederman
2003-09-07 19:30             ` Jamie Lokier
2003-09-09 21:37               ` insecure
2003-09-09 21:34             ` insecure
2003-09-11 11:07               ` Ricardo Bugalho
2003-09-12 15:26                 ` insecure
2003-09-12 17:27                   ` Ricardo Bugalho
2003-09-12 22:17                     ` Jörn Engel
2003-09-13 19:25                       ` Jamie Lokier
2003-09-13 19:51                         ` Jörn Engel
2003-09-11 14:03               ` Eric W. Biederman
2003-09-11 17:05                 ` Jamie Lokier
2003-09-09 20:56           ` Pavel Machek
2003-09-05 13:27       ` Jesse Pollard
2003-09-05 23:51     ` Aaron Lehmann
2003-09-06  1:41       ` Valdis.Kletnieks
2003-09-04 14:56 ` Yann Droneaud
2003-09-05 11:42 ` Jörn Engel
2003-09-05 12:04   ` Fruhwirth Clemens
2003-09-05 12:37     ` Jörn Engel
2003-09-05 12:21 John Bradford
2003-09-05 12:25 John Bradford
2003-09-05 12:25 ` Fruhwirth Clemens
2003-09-06 22:08   ` Herbert Poetzl
2003-09-07 20:40     ` Fruhwirth Clemens
2003-09-05 13:20 ` Richard B. Johnson
2003-09-05 13:57 John Bradford
2003-09-05 15:39 ` Mehmet Ceyran
2003-09-06 20:24   ` David B. Stevens
     [not found] <rZQN.83u.21@gated-at.bofh.it>
     [not found] ` <saVL.7lR.1@gated-at.bofh.it>
     [not found]   ` <soFo.16a.1@gated-at.bofh.it>
     [not found]     ` <ssJa.6M6.25@gated-at.bofh.it>
     [not found]       ` <tcVB.rs.3@gated-at.bofh.it>
2003-09-08 12:03         ` Ihar 'Philips' Filipau
2003-09-08 13:53           ` Richard B. Johnson
2003-09-08 16:10             ` Jamie Lokier
2003-09-08 16:17           ` Jamie Lokier
2003-09-08 16:45             ` Ihar 'Philips' Filipau
2003-09-08 16:58               ` Jamie Lokier
2003-09-08 17:59           ` William Lee Irwin III
     [not found] <snJB.8dk.25@gated-at.bofh.it>
     [not found] ` <snTm.8qD.41@gated-at.bofh.it>
     [not found]   ` <sTpW.18Z.19@gated-at.bofh.it>
     [not found]     ` <teE5.2XZ.9@gated-at.bofh.it>
2003-09-08 12:07       ` Ihar 'Philips' Filipau
     [not found] <tt0q.6Rc.17@gated-at.bofh.it>
     [not found] ` <tt0r.6Rc.19@gated-at.bofh.it>
     [not found]   ` <tt0r.6Rc.21@gated-at.bofh.it>
     [not found]     ` <tt0r.6Rc.23@gated-at.bofh.it>
     [not found]       ` <tt0r.6Rc.25@gated-at.bofh.it>
     [not found]         ` <tt0q.6Rc.15@gated-at.bofh.it>
     [not found]           ` <tyCN.6RD.13@gated-at.bofh.it>
2003-09-08 20:08             ` Ihar 'Philips' Filipau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).