Confessions: The Soft CPU Upgrade

« Return to Article
  • tchize 2012-05-21 11:09
    I've got to like this :)
  • Zac 2012-05-21 11:10
    And... cue the buffer overflow
  • PiisAWheeL 2012-05-21 11:15
    Awesome Comment Enabled!
  • Larry 2012-05-21 11:15
    Wow! Third! I am so fucking awesome! This never happened to me before in my life. The gods are finally smiling on me. Everyone will have to read my comment.

    Hmm.

    Now if only I had something to say.
  • DonaldK 2012-05-21 11:20
    Larry:
    Wow! Third!


    Third? Your counter must be zero-based.
  • the beholder 2012-05-21 11:20
    We all know that if your app is going slow the obvious solution is to throw more hardware at it. We just never knew what to do if you can't do or exhaust that option. Now we know!
  • ¯\(°_o)/¯ I DUNNO LOL 2012-05-21 11:24
    static char *tdwtfname = "HyperTurbo 256-bit, AwesomeAkismet enabled";
    Oh boy, now we'll be back to five a week!
  • Doctor_of_Ineptitude 2012-05-21 11:32
    A WTH (What The Huhh) framework app running off a 256-bit HyperTurbo CPU with AwesomeCache enabled, what possibly could have slowed it down.

    On the other hand, the WTH frame does suffer from Relative syndrome. Now if only the CPU honoured the UNCLE flag.
  • John Doe 2012-05-21 11:35
    This reminds me of one of my first hacking attempts. It was a multi-user mainframe, and as a student my user ID didn't have what I considered sufficient access rights. But I knew one of the admins, let's say "bill", did. So I wrote a fortran program to deliberately overflow its array boundaries and go tromping through "core" looking for the address where my user ID was stored. When I found it, I tried to overwrite that string with "bill", reasoning I would thereby become bill as far as the system knew. Sorta like a soft CPU upgrade, you see?

    Unfortunately when I tried to write to that memory location I discovered a little feature called hardware enforced access control. It was a read-only address for my process. Drat!

    My second attempt was much more successful. I went over to the DecWriter (a hardcopy terminal) Bill had recently used, tore off the last several pages, and flipped back to where he had logged in. There was a button you could push to turn off echoing while you entered your password, but nobody bothered, because as soon as you hit Return the system would print asterisks and hashes etc. over your password rendering it unreadable.

    Or not.

    It wasn't hard to see that his password was "Jeni", his wife's name.

    Fast forward a couple decades and attacking the system is still a waste of time when it is so easy to hack the user. How little we've learned!
  • Tasty 2012-05-21 11:38
    Doctor_of_Ineptitude:
    A WTH (What The Huhh) framework app running off a 256-bit HyperTurbo CPU with AwesomeCache enabled, what possibly could have slowed it down.

    On the other hand, the WTH frame does suffer from Relative syndrome. Now if only the CPU honoured the UNCLE flag.


    The CPU was saying uncle!
  • Nagesh 2012-05-21 11:46
    This ain't being good solution. If unemploymented, modole is ain't making sence to casual observer, yet is having fer reaching efects for entire system.
  • Se 2012-05-21 11:50
    Zac:
    And... cue the buffer overflow

    From arch/x86/include/asm/processor.h:
    char x86_model_id[64];

    So there's no buffer overflow here :)
  • squidfood 2012-05-21 11:51
    It's good practice. Every optimization should include a placebo.
  • chooks 2012-05-21 12:12

    It's been a while since my C days, so...the real WTF is not using strncpy?
  • PiisAWheeL 2012-05-21 12:50
    chooks:

    It's been a while since my C days, so...the real WTF is not using strncpy?
    Objection: Asked and answered your honor.
    squidfood:
    It's good practice. Every optimization should include a placebo.
  • Dave-Sir 2012-05-21 12:51
    chooks:

    It's been a while since my C days, so...the real WTF is not using strncpy?
    TRWTF is strncpy. Hint: It doesn't terminate the string when you would most want it to.
  • Gazzonyx 2012-05-21 13:03
    john doe:

    This reminds me of one of my first hacking attempts. It was a multi-user mainframe, and as a student my user ID didn't have what I considered sufficient access rights. But I knew one of the admins, let's say "bill", did. So I wrote a fortran program to deliberately overflow its array boundaries and go tromping through "core" looking for the address where my user ID was stored. When I found it, I tried to overwrite that string with "bill", reasoning I would thereby become bill as far as the system knew. Sorta like a soft CPU upgrade, you see?

    Unfortunately when I tried to write to that memory location I discovered a little feature called hardware enforced access control. It was a read-only address for my process. Drat!


    What OS was this? You'd think the OS would segfault when you tried to write to memory outside of your process' allocated memory. Isn't that the usual thing to do?
  • JimboJones 2012-05-21 13:13
    I gotta ask - was that really the CPU ID string used in the solution, or is it an anonymized string used to avoid vendor unhappiness with this site? I just find it a little hard to believe that the Chief Developer could identify an "inferior, off-brand" CPU, but let a completely fictitious CPU slide.

    I think I would have been tempted to request documentary evidence of the performance increase from the Chief Developer, and then revealed the CPU ID switch with an aim to discredit him.
  • TheCPUWizard 2012-05-21 13:26
    ...multi-user mainframe....DecWriter (sic)


    It is DECwriter...made by...wait for it...DEC [Digital Equipment Corp]. The vast majority of these were used for PDP-11 and VAX computers, both of which were considered Mini computers and not mainframes...

    Given that nearly evry mainframe of that time period was EBCDIC based, and the DECwriter was ASCII, it would be extremely suprising to see that combination.

    Since I am involved in historical computing (and a member of a number of Musuems and Rescue organizations), I would be very interested in getting more information about this extremely suprising configuration.
  • Nagesh 2012-05-21 13:26
    This sound like made up fake story to me.
  • F 2012-05-21 13:43
    TheCPUWizard:
    ...multi-user mainframe....DecWriter (sic)


    It is DECwriter...made by...wait for it...DEC [Digital Equipment Corp]. The vast majority of these were used for PDP-11 and VAX computers, both of which were considered Mini computers and not mainframes...

    Given that nearly evry mainframe of that time period was EBCDIC based, and the DECwriter was ASCII, it would be extremely suprising to see that combination.

    Since I am involved in historical computing (and a member of a number of Musuems and Rescue organizations), I would be very interested in getting more information about this extremely suprising configuration.


    He didn't say the DECWriter was connected to the mainframe, only that Bill had just been using it. The likelihood of someone using the same password for both his VAX account and his mainframe account, back then, would have been close to 100%. Especially someone who didn't turn off echo when typing his password.
  • F 2012-05-21 13:44
    Nagesh:
    This sound like made up fake story to me.


    If you're going to have a fake story, it might as well be a made-up one.
  • Matt 2012-05-21 13:47
    Kinda like the time I installed Firefox on a user's PC, put a shortcut on the desktop, renamed the shortcut "Internet Explorer," and give it IE's icon. Whatever gets the job done!
  • n_slash_a 2012-05-21 13:58
    TRWTF is using loff_t i; instead of int i;
  • synp 2012-05-21 14:08
    John Doe:
    Fast forward a couple decades and attacking the system is still a waste of time when it is so easy to hack the user. How little we've learned!


    That's because we're getting new and better systems all the time, but we've been using the same model user for millenia
  • Jim Rees 2012-05-21 14:31
    We had large numbers of ascii terminals connected to our System 360 running MTS at University of Michigan, through a device called a Data Concentrator, which was a pdp-11 with a bunch of rs232 line cards. The ascii terminals included ASR33 teletypes, DECwriters, Tektronix 4014s, Silent 700s, etc. This was a common configuration at the time.

    Also, the DEC-10 was often considered a mainframe, although it was tiny compared to the 360.
  • fizzbuzz 2012-05-21 14:33
    Nagesh:
    This ain't being good solution.


    "Ain't?"

    Nagesh is from South Carolina now? Mississippi, perhaps?
  • Anon 2012-05-21 14:57
    JimboJones:
    I gotta ask - was that really the CPU ID string used in the solution, or is it an anonymized string used to avoid vendor unhappiness with this site? I just find it a little hard to believe that the Chief Developer could identify an "inferior, off-brand" CPU, but let a completely fictitious CPU slide.

    I think I would have been tempted to request documentary evidence of the performance increase from the Chief Developer, and then revealed the CPU ID switch with an aim to discredit him.


    I think you'll find the replacement id was annoymized for comic effect. The original was probably AMD (which must of had a 40% market share at some point in the past).
  • Nickster 2012-05-21 14:58
    It is DECwriter...made by...wait for it...DEC [Digital Equipment Corp]. The vast majority of these were used for PDP-11 and VAX computers, both of which were considered Mini computers and not mainframes...


    I used to use a DECWriter attached to a Harris 400 on campus, which is evidently classified as a "supermini." My guess is the OP was referring to a large, installed, non-portable computer with a beefy OS as the "mainframe" even if it was technically a mini or supermini. It didn't take long for these small (read: refrigerator-sized) computers to surpass the mainframes of yesteryear in computing power. The operating systems they used worked pretty much like mainframe OSes anyway.
  • Jack 2012-05-21 15:02
    fizzbuzz:
    Nagesh:
    This ain't being good solution.


    "Ain't?"

    Nagesh is from South Carolina now? Mississippi, perhaps?

    Last week he "learned" the phrase "If it ain't broke, don't fix it." Ever since then, he's been using "ain't" in every post. It's getting pretty old. But then, the fake Nagesh has been getting old for a long time.
  • Nagesh 2012-05-21 15:46
    Jack:

    Last week he "learned" the phrase "If it ain't broke, don't fix it." Ever since then, he's been using "ain't" in every post. It's getting pretty old. But then, the fake Nagesh has been getting old for a long time.

    We're all getting old.

    Granted, some of us have been at it for longer than others.
  • titanofold 2012-05-21 15:56
    Nope, it's that it didn't follow the GNU style guidelines.

    acsi: I'm no' gonna acsi agun...pick up your room!
  • Nagesh 2012-05-21 15:59
    fizzbuzz:
    Nagesh:
    This ain't being good solution.


    "Ain't?"

    Nagesh is from South Carolina now? Mississippi, perhaps?

    I am Indian only from Hyderabad.
  • Gibbon1 2012-05-21 16:01
    fizzbuzz:

    "Ain't?"

    Nagesh is from South Carolina now? Mississippi, perhaps?


    Nagesh learned English at the Baptist run Gen Lee Missionary School in Hyderabad.
  • vt_mruhlin 2012-05-21 16:08
    Call me crazy, but shouldn't you have just bought 1 HyperTurbo CPU and installed it in a test machine, then ran your load tests to prove that performance still sucked with the new CPU?

    That would be a lot easier and more ethical than lying to your boss, and would carry the added benefit of maybe actually getting the problem fixed.
  • Hexadecima 2012-05-21 16:16
    PDP-10s, PDP-11s, and VAXen were all considered mainframes by the late eighties, when the term no longer meant "the CPU cabinet is the size of a refrigerator" and meant instead "that big box that everyone dials into." This was especially prominent once the microcomputer era began.

    Also, there were still lots of big non-IBM mainframes around when the DECwriter was introduced in the early seventies. :)
  • herby 2012-05-21 16:21
    Doctor_of_Ineptitude:
    A WTH (What The Huhh) framework app running off a 256-bit HyperTurbo CPU with AwesomeCache enabled, what possibly could have slowed it down.

    On the other hand, the WTH frame does suffer from Relative syndrome. Now if only the CPU honoured the UNCLE flag.

    Maybe using the UNCLE flag opened up channel D. You never know.
  • Ken B. 2012-05-21 16:31
    TheCPUWizard:
    ...multi-user mainframe....DecWriter (sic)
    It is DECwriter...made by...wait for it...DEC [Digital Equipment Corp]. The vast majority of these were used for PDP-11 and VAX computers, both of which were considered Mini computers and not mainframes...

    Given that nearly evry mainframe of that time period was EBCDIC based, and the DECwriter was ASCII, it would be extremely suprising to see that combination.

    Since I am involved in historical computing (and a member of a number of Musuems and Rescue organizations), I would be very interested in getting more information about this extremely suprising configuration.
    What would you consider a KL-10 to be? That's what the DecWriters at my college were connected to back in 19(mumble-mumble). Given that it took up numerous cabinets in the computer room (behind the locked sets of doors, but visible through the pane-glass windows), I think "mini" doesn't fit. Sounds like "mainframe" to me.
  • The Great Lobachevsky 2012-05-21 16:59
    KL-10 was a variety of PDP-10

    http://en.wikipedia.org/wiki/PDP-10#KI10_and_KL10
  • AGray 2012-05-21 17:35
    So, lemme get this straight.

    WTF #1: Writing a fictional hardware type to the operating system (provides no performance impact, but prevents insidious ID-10T Runtime errors.) I can buy that.

    WTF #2: The 'improvement' in performance. Was it entirely vapor, or did some refactoring take place behind the scenes?

    CAPTCHA: Transverbero - A word that becomes movement...
  • Mcoder 2012-05-21 17:44
    AGray:
    So, lemme get this straight.

    WTF #2: The 'improvement' in performance. Was it entirely vapor, or did some refactoring take place behind the scenes?


    It is not vapour. Placebo effect is quite real.
  • Anonymous 2012-05-21 18:10
    Matt:
    Kinda like the time I installed Firefox on a user's PC, put a shortcut on the desktop, renamed the shortcut "Internet Explorer," and give it IE's icon. Whatever gets the job done!
    I usually replace iexplore.exe with firefox.exe and get the IE theme just in case.
  • Anonymous 2012-05-21 18:11
    Anonymous:
    Matt:
    Kinda like the time I installed Firefox on a user's PC, put a shortcut on the desktop, renamed the shortcut "Internet Explorer," and give it IE's icon. Whatever gets the job done!
    I usually replace iexplore.exe with firefox.exe and get the IE theme just in case.
    I also edit hosts file to redirect bing.com to google.com
  • facilisis 2012-05-21 18:17
    Jack:
    fizzbuzz:
    Nagesh:
    This ain't being good solution.


    "Ain't?"

    Nagesh is from South Carolina now? Mississippi, perhaps?

    Last week he "learned" the phrase "If it ain't broke, don't fix it." Ever since then, he's been using "ain't" in every post. It's getting pretty old. But then, the fake Nagesh has been getting old for a long time.

    Yes, he's quite old now. Unfortunately even if he dies of old age, he'll probably be reincarnated as an even bigger wtf than he is already.
  • Vanders 2012-05-21 18:20
    fizzbuzz:
    Nagesh:
    This ain't being good solution.


    "Ain't?"

    Nagesh is from South Carolina now? Mississippi, perhaps?


    Nagesh almost becomes funny again if you read every comment in a hick Southern accent.
  • Norman Diamond 2012-05-21 18:51
    TheCPUWizard:
    ...multi-user mainframe....DecWriter (sic)
    It is DECwriter...made by...wait for it...DEC [Digital Equipment Corp]. The vast majority of these were used for PDP-11 and VAX computers, both of which were considered Mini computers and not mainframes...

    Given that nearly evry mainframe of that time period was EBCDIC based, and the DECwriter was ASCII, it would be extremely suprising to see that combination.

    Since I am involved in historical computing (and a member of a number of Musuems and Rescue organizations), I would be very interested in getting more information about this extremely suprising configuration.
    OK, since you're involved in historical computing, you need to acquire some historic IBM manuals. For the 360 and 370, which must be considered mainframes even by yourself, an IBM manual explained the absurd manner in which ASCII values would be transfered from ASCII terminals to the computer's core memory. The parity bit was preserved, affecting the value visible by the user. Each byte had its 8 bits reversed, including 7 bits of ASCII value and 1 bit of parity. The TR instruction didn't care how absurd the translation table was, so it happily converted the input to EBCDIC or converted back to IBMSCII for output.

    Terminals made by IBM used other weird character sets. The 2741 came in two varieties which needed different translation tables. However, the 2741 was good for security. I removed the typeball before typing my password and then put the typeball back on afterwards.

    I don't remember what I did on ASR33 teletypes. Maybe I ripped out the part of the paper where my password had been partly covered up.
  • Friedrice the Great 2012-05-21 19:35
    Jack:
    fizzbuzz:
    Nagesh:
    This ain't being good solution.


    "Ain't?"

    Nagesh is from South Carolina now? Mississippi, perhaps?

    Last week he "learned" the phrase "If it ain't broke, don't fix it." Ever since then, he's been using "ain't" in every post. It's getting pretty old. But then, the fake Nagesh has been getting old for a long time.


    Old enough to retire yet? Please?
  • Coyne 2012-05-21 19:36
    Norman Diamond:
    For the 360 and 370, which must be considered mainframes even by yourself, an IBM manual explained the absurd manner in which ASCII values would be transfered from ASCII terminals to the computer's core memory. The parity bit was preserved, affecting the value visible by the user. Each byte had its 8 bits reversed, including 7 bits of ASCII value and 1 bit of parity. The TR instruction didn't care how absurd the translation table was, so it happily converted the input to EBCDIC or converted back to IBMSCII for output.


    The reversal of bits was a requirement of RS-232, which transmits bits in LSB-first order, by standard. So a "C" character, normally considered 0100 0011 in ASCII was sent with a start bit of 0 and a stop bit of 1, as 0 1100 0010 1. (An idle line was normally mark or 1 and so if you could consider the idle line as a series of ones, a single C would be sent as ...1111101100001011111111...)

    For ASCII, the parity bit was normally in the MSB position of the 8 bits, because the ASCII code assignments in that era actually used only the lower 7 bits (of 8). Parity would not typically be visible on the terminal (though it might indicate an error if the parity was wrong). But, yes, one would be able to TR ASCII-with-parity into normal EBCDIC characters or vice-versa, since both were 8 bits.

    Rumor had it that the exact translation table from ASCII to EBCDIC was an IBM trade secret that was actually kept on paper in a vault for safekeeping. And one would guess it still is since I have seen (and been frustrated) by multiple, but slightly different, translation tables.
  • Computer Clown 2012-05-21 20:31
    It smells suspiciously like Honeywell GCOS, which allowed such tomfoolery. Back in the day, you could do some very (nasty|cool) things, like deliberately cause a system program to fail, and specify the file that the coredump went to. Ok, it involved rumaging through the object code, but you could patch it, and send it on it's way, altered to your specification.
  • Computer Clown 2012-05-21 20:35
    John Doe:
    This reminds me of one of my first hacking attempts. It was a multi-user mainframe, and as a student my user ID didn't have what I considered sufficient access rights. But I knew one of the admins, let's say "bill", did. So I wrote a fortran program to deliberately overflow its array boundaries and go tromping through "core" looking for the address where my user ID was stored. When I found it, I tried to overwrite that string with "bill", reasoning I would thereby become bill as far as the system knew. Sorta like a soft CPU upgrade, you see?

    Unfortunately when I tried to write to that memory location I discovered a little feature called hardware enforced access control. It was a read-only address for my process. Drat!

    My second attempt was much more successful. I went over to the DecWriter (a hardcopy terminal) Bill had recently used, tore off the last several pages, and flipped back to where he had logged in. There was a button you could push to turn off echoing while you entered your password, but nobody bothered, because as soon as you hit Return the system would print asterisks and hashes etc. over your password rendering it unreadable.

    Or not.

    It wasn't hard to see that his password was "Jeni", his wife's name.

    Fast forward a couple decades and attacking the system is still a waste of time when it is so easy to hack the user. How little we've learned!


    It smells suspiciously like Honeywell GCOS, which allowed such tomfoolery. Back in the day, you could do some very (nasty|cool) things, like deliberately cause a system program to fail, and specify the file that the coredump went to. Ok, it involved rumaging through the object code, but you could patch it, and send it on it's way, altered to your specification.
  • Jeremy Friesner 2012-05-22 00:30
    Mcoder:
    It is not vapour. Placebo effect is quite real.

    I prefer the darker explanation -- that somewhere deep in the operating system, Intel had paid to have this logic inserted:

    if (cpu_id != genuine_intel) run_everything_50_percent_slower();

  • x 2012-05-22 01:21
    Anonymous:
    Matt:
    Kinda like the time I installed Firefox on a user's PC, put a shortcut on the desktop, renamed the shortcut "Internet Explorer," and give it IE's icon. Whatever gets the job done!
    I usually replace iexplore.exe with firefox.exe and get the IE theme just in case.

    Ralph, to whom target="_blank" represents an evil rivaled only perhaps by the Holocaust itself, will be along shortly to conduct your reeducation.

  • Nerr 2012-05-22 01:40
    Strncpy isn't much safer than strcpy in reality. It won't write more than N characters, but if your source exceeds N it won't null terminate you target either. It's not intended be a safer strcpy, just another strcpy.
  • OOLCAY ITAY 2012-05-22 02:03
    John Doe:
    Unfortunately when I tried to write to that memory location I discovered a little feature called hardware enforced access control. It was a read-only address for my process. Drat!


    You obviously didn't try hard enough. Read "The Adolescence of P-1."
  • Jimbo 2012-05-22 02:37
    Nagesh:
    This sound like made up fake story to me.
    It ain't
  • Humph 2012-05-22 02:38
    synp:
    John Doe:
    Fast forward a couple decades and attacking the system is still a waste of time when it is so easy to hack the user. How little we've learned!


    That's because we're getting new and better systems all the time, but we've been using the same model user for millenia
    Me find fire cook bear
  • EggNoggesh 2012-05-22 02:43
    Nagesh:
    Jack:

    Last week he "learned" the phrase "If it ain't broke, don't fix it." Ever since then, he's been using "ain't" in every post. It's getting pretty old. But then, the fake Nagesh has been getting old for a long time.

    We're all getting old.

    Granted, some of us have been at it for longer than others.
    Birthdays maybe good for you. Studies show those who have the most die the oldest. Some scientists claim the opposite, citing the clear corelation between how many you have left at any time in your life and your proximity to death, however these claims have generally been disimissed as scaremongering.
  • TheRider 2012-05-22 02:50
    Coyne:
    Rumor had it that the exact translation table from ASCII to EBCDIC was an IBM trade secret that was actually kept on paper in a vault for safekeeping. And one would guess it still is since I have seen (and been frustrated) by multiple, but slightly different, translation tables.
    Well, there are EBCDIC-based codepages just like there are ASCII-based codepages. This link lists several dozens of them:
    http://www-03.ibm.com/systems/i/software/globalization/codepages.html
  • L. 2012-05-22 03:07
    Jeremy Friesner:
    Mcoder:
    It is not vapour. Placebo effect is quite real.

    I prefer the darker explanation -- that somewhere deep in the operating system, Intel had paid to have this logic inserted:

    if (cpu_id != genuine_intel) run_everything_50_percent_slower();



    Hey that looks like the Intel C compiler !
  • Steve The Cynic 2012-05-22 03:10
    OOLCAY ITAY:
    John Doe:
    Unfortunately when I tried to write to that memory location I discovered a little feature called hardware enforced access control. It was a read-only address for my process. Drat!


    You obviously didn't try hard enough. Read "The Adolescence of P-1."

    Call Gregory?
  • Steve The Cynic 2012-05-22 03:15
    TheCPUWizard:
    ...multi-user mainframe....DecWriter (sic)


    It is DECwriter...made by...wait for it...DEC [Digital Equipment Corp]. The vast majority of these were used for PDP-11 and VAX computers, both of which were considered Mini computers and not mainframes...

    Given that nearly evry mainframe of that time period was EBCDIC based, and the DECwriter was ASCII, it would be extremely suprising to see that combination.

    Since I am involved in historical computing (and a member of a number of Musuems and Rescue organizations), I would be very interested in getting more information about this extremely suprising configuration.

    Go back and study your history a bit more, then.

    I clearly recall logging in to MTS running on an IBM 3081D (dual processor machine, commonly referred to as "Sybil") via a VT-100 (also an ASCII terminal, and from DEC) on the RPI campus back in 1985...
  • wtf 2012-05-22 03:22
    the real wtf is not using const char* for string constants
  • TheSHEEEP 2012-05-22 03:57
    wtf:
    the real wtf is not using const char* for string constants


    That's because the value might change in a newer version to an even newer CPU system! Tss... that was not so hard.
  • pjt33 2012-05-22 04:22
    AGray:
    So, lemme get this straight.

    WTF #1: Writing a fictional hardware type to the operating system (provides no performance impact, but prevents insidious ID-10T Runtime errors.) I can buy that.

    WTF #2: The 'improvement' in performance. Was it entirely vapor, or did some refactoring take place behind the scenes?

    Saving face. Chief Developer claims that the performance problem isn't due to his WTF software architecture but to subpar hardware. When presented with evidence that the hardware has been upgraded, and lacking the necessary knowledge to even suspect that it's a fraud, he can either admit that his architecture is a WTF or claim that the performance problem is now fixed.
  • Marc 2012-05-22 05:00
    Just because the snippet uses strcpy instead of strncpy, that doesn't mean there's a buffer overflow. It's copying a static, compiled-in string, which is automatically zero-terminated by the compiler... not some user-provided input.
  • Peter 2012-05-22 07:00
    TheCPUWizard:
    ...multi-user mainframe....DecWriter (sic)


    It is DECwriter...made by...wait for it...DEC [Digital Equipment Corp]. The vast majority of these were used for PDP-11 and VAX computers, both of which were considered Mini computers and not mainframes...

    Given that nearly evry mainframe of that time period was EBCDIC based, and the DECwriter was ASCII, it would be extremely suprising to see that combination.

    Since I am involved in historical computing (and a member of a number of Musuems and Rescue organizations), I would be very interested in getting more information about this extremely suprising configuration.


    At UMASS/Amherst, in the late 70s, we had a CDC Cyber 74 mainframe. It had, IIRC, a "Tempo" minicomputer (based on a Perkin-Elmer mini?), which was used as a front end processor. Along with multiplexing all the terminal lines, it was also used to convert ASCII to EBCDIC (or whatever 6-bit code CDC used). We had Teletypes, Selectrics, Diablo daisywheels, DECwriters and an assortment of CRTs, all hooked to the mainframe (via the Tempo) through dial-up and hardwire. Everything but the Selectrics used ASCII, and the Selectrics identified themselves by you pressing a different key after dialing in and getting a carrier.
  • PedanticCurmudgeon 2012-05-22 08:32
    Vanders:
    fizzbuzz:
    Nagesh:
    This ain't being good solution.


    "Ain't?"

    Nagesh is from South Carolina now? Mississippi, perhaps?


    Nagesh almost becomes funny again if you read every comment in a hick Southern accent.
    It would be really funny if it turned out that fake Nagesh was really from Mississippi and that was really how he talked.
  • Steve The Cynic 2012-05-22 09:02
    Peter:
    At UMASS/Amherst, in the late 70s, we had a CDC Cyber 74 mainframe. It had, IIRC, a "Tempo" minicomputer (based on a Perkin-Elmer mini?), which was used as a front end processor. Along with multiplexing all the terminal lines, it was also used to convert ASCII to EBCDIC (or whatever 6-bit code CDC used). We had Teletypes, Selectrics, Diablo daisywheels, DECwriters and an assortment of CRTs, all hooked to the mainframe (via the Tempo) through dial-up and hardwire. Everything but the Selectrics used ASCII, and the Selectrics identified themselves by you pressing a different key after dialing in and getting a carrier.

    The 6-bit code was CDC Display Code (yes, you could abbreviate it as CDCDC, I suppose). It had the oddity of not having lower case letters, and a related oddity: '\000' == ':' was true.

    EBCDIC is an 8 bit code (Extended BCDIC) that was baked into the System/360 (well, S/370 certainly) instruction set. (Seriously - the EDIT instruction formatted a 32-bit int into an EBCDIC character field.)

    Pedantry: there were various versions of EBCDIC, but all of them shared an interesting feature: a for-loop from 'A' to 'Z' was more than 26 iterations, because the letters were in three separate ranges. I'd like to think that the origins of this are lost in the mists of time, but the clue is "punch cards"...
  • immitto 2012-05-22 09:08
    PedanticCurmudgeon:
    Vanders:
    fizzbuzz:
    Nagesh:
    This ain't being good solution.


    "Ain't?"

    Nagesh is from South Carolina now? Mississippi, perhaps?


    Nagesh almost becomes funny again if you read every comment in a hick Southern accent.
    It would be really funny if it turned out that fake Nagesh was really from Mississippi and that was really how he talked.

    I think he's from "Missippibad", it's in South India. Built up around the Ganges Delta, they're famous for their Curry Creole in those parts.
  • Ken B. 2012-05-22 09:26
    Mcoder:
    AGray:
    So, lemme get this straight.

    WTF #2: The 'improvement' in performance. Was it entirely vapor, or did some refactoring take place behind the scenes?
    It is not vapour. Placebo effect is quite real.
    Either that, or the "chief developer" saw no improvement, yet claimed his tests showed there was, in order to protect his own claim that it was the "inferior, off-brand" CPU which was the cause.
  • Kivi 2012-05-22 09:40
    Friedrice the Great:
    Jack:

    The fake Nagesh has been getting old for a long time.

    Old enough to retire yet? Please?

    I think he's funny. Even the "real Nagesh"/"fake Nagesh" thing has its moments.
  • Geoff 2012-05-22 09:56
    Hard and fast rules are stupid. There is no need to use strncpy to move a string that is constant you yourself just created. You know for sure its terminated and you know how many bytes it is.

    The never ever ever use strcpy crowd is mindless.
  • @Deprecated 2012-05-22 10:15
    Jeremy Friesner:
    Mcoder:
    It is not vapour. Placebo effect is quite real.

    I prefer the darker explanation -- that somewhere deep in the operating system, Intel had paid to have this logic inserted:

    if (cpu_id != genuine_intel) run_everything_50_percent_slower();


    It's not at the operating system level.

    Quite a while ago, I had some purchased programs that used the Intel compiler and libraries.

    The Intel compiler generated code to check the CPU string, and if it's not 'genuineintel' then it runs the slowest version of many algorithms. (Maybe it doesn't do that any more?)

    So I patched the application's libraries to search for "authenticamd" instead of "genuineintel" and poof, they started running faster! What a coincidence that both of those strings have the exact same number of characters.

    http://www.agner.org/optimize/blog/read.php?i=49#49


    True story!
  • He's Dead Jim 2012-05-22 12:14
    Steve The Cynic:
    there were various versions of EBCDIC, but all of them shared an interesting feature: a for-loop from 'A' to 'Z' was more than 26 iterations, because the letters were in three separate ranges. I'd like to think that the origins of this are lost in the mists of time, but the clue is "punch cards"...
    Indeed.

    EBCDIC was perhaps the original WTF, or certainly a contender. If you sort a bunch of stuff (not just alpha chars) it would end up something like a, b, c, d, e, f, g, h, i, a bunch of weird garbage, j, k, l... so you had to add code to set the crap to one side and gather the alphabet together. And this was back in the day when your penis size was basically 100 minus the number of bytes in your compiled code, so adding code for silly reasons was Not Good.
  • Shinobu 2012-05-22 12:54
    I hate model-view-controller. Not because it's bad architecture, which for the intended use case it isn't.
    I hate it because it's easy to remember and the name rolls of the tongue (even though it's wrong, it should be view-controller-model) and this makes a certain class of programmer think ‘model-view-controller’ no matter what.
    I've seen someone stack a model-view-controller on top of a component that was designed to take the burden of writing it off your shoulders. And then later use (a proxy for) the view as the model in another model-view-controller layer somewhere else in the code.
    You get greeted by a seemingly endless tower of stacked model-view-controllers, that do essentially nothing but waste CPU time. And programmer time when something goes wrong and it's time to debug the bloody contraption.
  • purchase approval ? 2012-05-22 13:00
    Wouldn't the CTO have to approve the purchase of new equipment ?
    I'm guessing that it would have been a significant cost that could not have been overlooked.
  • Hangin' in the hot reader room 2012-05-22 13:40
    John Doe:
    When I found it, I tried to overwrite that string with "bill", reasoning I would thereby become bill as far as the system knew. Sorta like a soft CPU upgrade, you see?


    Meh. It was easier to just rummage through the wastebasket looking for discarded username/password cards.
  • Mark 2012-05-22 14:12
    TheCPUWizard:
    ...multi-user mainframe....DecWriter (sic)


    It is DECwriter...made by...wait for it...DEC [Digital Equipment Corp]. The vast majority of these were used for PDP-11 and VAX computers, both of which were considered Mini computers and not mainframes...

    Given that nearly evry mainframe of that time period was EBCDIC based, and the DECwriter was ASCII, it would be extremely suprising to see that combination.

    Since I am involved in historical computing (and a member of a number of Musuems and Rescue organizations), I would be very interested in getting more information about this extremely suprising configuration.


    "extremely surprising" doesn't sound right to me. In that time period, it was not remarkable to interface equipment that used different character encodings.

    The ALGOL 60 compiler on the DECSystem 10 could support strings of 6, 7, 8 or 9 bit bytes, all in the same program. They were automatically converted from one size/encoding to another, or not, depending what you were doing. I suppose there must have been 5 bit characters too (for teletypes that use BAUDOT), and of course there was the RADIX-50 encoding used to store file names on the PDP-11 node controllers. I don't think I ever saw EBCDIC on a DEC-10 -- it had a card reader, but I don't know if the mainframe received EBCDIC, ASCII, or just 12 bit Hollerith codes when it was reading cards. It was ASCII by the time it got to my program.

    The Burroughs mainframes used EBCDIC internally, but I only ever used ASCII terminals (including a DECWriter) and punched cards to talk to it. (Unless you count the printing terminal attached to the RJE station, but it could only list the job queue.)

    You could buy a box that would make an IBM 370 think that your ASCII serial terminals were 3270s. You couldn't run XEDIT on a printing terminal, but I seem to remember some sort of hacky way you could do simple things like directory listings. I was working computer support at the time, so I must have used it -- on a DECWriter, because those were the only printing terminals we had.

  • Anonymous 2012-05-22 15:10
    static const *char, and what about checking boundaries of x86_model_id?
  • Remy Martin 2012-05-22 16:26
    I've got some bad news guys.

    My friend and lover, Alex, has suddenly and unexpectedly passed, and we are currently trying to evaluate how this site is going to operate in his absence. I know that during his tenure, he has never failed to post an article, and I'm sorry that we have to break that perfect streak. To be honest, I don't even know if we are going to keep this sight going knowing where he is right now.

    Keep him and me in your prayers for sure.
  • Tom 2012-05-22 16:53
    Remy Martin:
    I've got some bad news guys.

    My friend and lover, Alex, has suddenly and unexpectedly passed, and we are currently trying to evaluate how this site is going to operate in his absence.
    Probably undetectable difference from how it was before.
    Remy Martin:
    I don't even know if we are going to keep this sight going

    It isn't a sight, it is a site! Site! SITE!!! Puh-leease.

    Kindly follow Alex off whatever cliff he dove. Thank you.
  • Jay 2012-05-22 17:17
    [quote user="TheCPUWizard"]
    It is DECwriter...made by...wait for it...DEC [Digital Equipment Corp]. The vast majority of these were used for PDP-11 and VAX computers, both of which were considered Mini computers and not mainframes...
    [/quote]

    The majority of women are under 5' 10". Therefore, if someone tells you that a woman he knows is 5' 11", he must be lying. Umm, no. If there is one exception in the world, then the person may be referring to that exception. I question if it's even true that the "vast majority" of DecWriters were connected to PDP-11s and VAXes. I used DecWriters with PDP-10s and PDP-20s back then. Which, by the way, I think would be called mainframes. At least, they were big boxes that served a large number of users.

    [quote user="TheCPUWizard"]
    Given that nearly evry mainframe of that time period was EBCDIC based ...[/quote]

    I have heard rumors that there used to be companies other than IBM. Remember Sperry, Univac, Burroughs? Okay, Amdahl used EBCDIC.
    [/quote]
  • Se 2012-05-22 17:24
    Anonymous:
    static const *char, and what about checking boundaries of x86_model_id?

    You can check the boundaries yourself. It's open source.

    arch/x86/include/asm/processor.h:
    char x86_model_id[64];

    It fits.
  • Mischief 2012-05-22 17:34
    Then you bitch about not having enough budget to make the app work properly. Just like the gov't set out to do something that everyone else thinks will fail, then when it fails, say it's because you didn't have enough money/power, then increase budget and repeat.
  • Maurits 2012-05-22 17:47
    (Deleting this comment failed for some reason)
  • Maurits 2012-05-22 17:49
    TRWTF is the use of (&foo)->bar instead of foo.bar

    (&cpu_data(i))->x86_model_id
  • Norman Diamond 2012-05-22 19:33
    He's Dead Jim:
    Steve The Cynic:
    there were various versions of EBCDIC, but all of them shared an interesting feature: a for-loop from 'A' to 'Z' was more than 26 iterations, because the letters were in three separate ranges.
    EBCDIC was perhaps the original WTF, or certainly a contender. If you sort a bunch of stuff (not just alpha chars) it would end up something like a, b, c, d, e, f, g, h, i, a bunch of weird garbage, j, k, l... so you had to add code to set the crap to one side and gather the alphabet together.
    Just like today, where letters like Á, b, ç, Z, ï, ñ, ß, and æ have to be gathered together.

    Oops wait, I just remembered, there's only one country in the world. Well, that country has ñ and á.
  • Nickster 2012-05-22 19:42
    The never ever ever use strcpy crowd is mindless.


    Yep. You have to know the rules before you break them. The whole point is to be in control of your code. If you're defining the string constant yourself, you're in control of it. Know why the rule exists.

    For n00bs who don't know the strcpy/strncpy issue, here's the lowdown:

    * if you use strcpy with a null-terminated source string and the it is longer than your destination buffer (or worse, isn't actually null-terminated at all) you will overrun your buffer because strcpy will happily keep copying from the source to the destination 'til the cows come home.

    * If you know the size of your destination buffer (you should), it doesn't matter whether the source string terminates before the end of the buffer, because you can specify you want to copy n bytes into a buffer of size n. Then set the last byte of the buffer to null, and you're done. Safe as houses!
  • Meep 2012-05-22 22:25
    Gazzonyx:
    What OS was this? You'd think the OS would segfault when you tried to write to memory outside of your process' allocated memory. Isn't that the usual thing to do?


    Thank you Captain Tautological, Defender of the Infinitely Likely Truth!
  • Meep 2012-05-22 22:30
    Nickster:
    The never ever ever use strcpy crowd is mindless.


    Yep. You have to know the rules before you break them. The whole point is to be in control of your code. If you're defining the string constant yourself, you're in control of it. Know why the rule exists.

    For n00bs who don't know the strcpy/strncpy issue, here's the lowdown:

    Stick with PHP.


    FTFY.
  • Herr Otto Flick 2012-05-23 07:59
    Gazzonyx:
    john doe:

    This reminds me of one of my first hacking attempts. It was a multi-user mainframe, and as a student my user ID didn't have what I considered sufficient access rights. But I knew one of the admins, let's say "bill", did. So I wrote a fortran program to deliberately overflow its array boundaries and go tromping through "core" looking for the address where my user ID was stored. When I found it, I tried to overwrite that string with "bill", reasoning I would thereby become bill as far as the system knew. Sorta like a soft CPU upgrade, you see?

    Unfortunately when I tried to write to that memory location I discovered a little feature called hardware enforced access control. It was a read-only address for my process. Drat!


    What OS was this? You'd think the OS would segfault when you tried to write to memory outside of your process' allocated memory. Isn't that the usual thing to do?


    Older computers/OS do not have this ridiculous security protections. Its your computer, your OS, your software, if you want to "POKE 47196, 201", that's your business.

    Incidentally, I've actually used the first hacking approach mentioned by john doe on a BBC Micro/Econet network to change the network address of my computer to that of the administrator, which allowed me to access quota related commands to up my shared disk quota to a whole 48k. You had to keep the administrator occupied and away from their desk, Econet didn't play very well with two machines declaring the same id, which kind of gave the game away.
  • A Guy 2012-05-23 08:10
    Remy Martin:
    I've got some bad news guys.

    My friend and lover, Alex, has suddenly and unexpectedly passed, and we are currently trying to evaluate how this site is going to operate in his absence. I know that during his tenure, he has never failed to post an article, and I'm sorry that we have to break that perfect streak. To be honest, I don't even know if we are going to keep this sight going knowing where he is right now.

    Keep him and me in your prayers for sure.

    I hope you guys are in Massachusetts. Otherwise, good luck collecting on your inheritance.
  • Shinobu 2012-05-23 08:56
    Norman Diamond:
    This junk has a long history. Even Charles Babbage was vilified for trying to remove bugs from tables of logarithms.
    It was well known in his time that these tables contained errors, and he did want to fix them, but to the best of my knowledge he wasn't vilified for that. However, he did make an interesting find: the same errors showed up in almost all tables, proving that almost everyone had been copying Vlacq.
  • bad_management 2012-05-23 14:41
    TRWTF is that it doesn't compile on Linux. Of course no specific version was specified, so I tried RHEL 5.4 and SLES 9, which were the most convenient test boxes that I had access to.


    [root@testbox2][/root]# cc -c wtf.c
    wtf.c:1:26: error: linux/module.h: No such file or directory
    wtf.c:3:23: error: linux/smp.h: No such file or directory
    wtf.c: In function 'init_module':
    wtf.c:9: error: 'loff_t' undeclared (first use in this function)
    wtf.c:9: error: (Each undeclared identifier is reported only once
    wtf.c:9: error: for each function it appears in.)
    wtf.c:9: error: expected ';' before 'i'
    wtf.c:11: error: 'i' undeclared (first use in this function)
    wtf.c:11: error: 'nr_cpu_ids' undeclared (first use in this function)
    wtf.c:12: warning: incompatible implicit declaration of built-in function 'strcpy'
    wtf.c:12: error: invalid lvalue in unary '&'
  • Nickster 2012-05-23 15:18
    Meep:
    Nickster:
    For n00bs who don't know the strcpy/strncpy issue, here's the lowdown:

    Stick with PHP.


    FTFY.


    Right... because you knew everything on your first day of learning C, right?
  • Norman Diamond 2012-05-23 20:13
    Shinobu:
    Norman Diamond:
    This junk has a long history. Even Charles Babbage was vilified for trying to remove bugs from tables of logarithms.
    It was well known in his time that these tables contained errors, and he did want to fix them, but to the best of my knowledge he wasn't vilified for that. However, he did make an interesting find: the same errors showed up in almost all tables, proving that almost everyone had been copying Vlacq.
    How did that get here? Oh I know. These threads must have got mixed up when they stomped on each other's memory.

    The Science Museum, London, had an exhibit on Charles Babbage in 1999. That's where I read that he was vilified for trying to fix bugs in tables of logarithms.
  • MG 2012-05-23 23:46
    bad_management:
    TRWTF is that it doesn't compile on Linux. Of course no specific version was specified, so I tried RHEL 5.4 and SLES 9, which were the most convenient test boxes that I had access to.


    [root@testbox2][/root]# cc -c wtf.c
    wtf.c:1:26: error: linux/module.h: No such file or directory
    wtf.c:3:23: error: linux/smp.h: No such file or directory
    wtf.c: In function 'init_module':
    wtf.c:9: error: 'loff_t' undeclared (first use in this function)
    wtf.c:9: error: (Each undeclared identifier is reported only once
    wtf.c:9: error: for each function it appears in.)
    wtf.c:9: error: expected ';' before 'i'
    wtf.c:11: error: 'i' undeclared (first use in this function)
    wtf.c:11: error: 'nr_cpu_ids' undeclared (first use in this function)
    wtf.c:12: warning: incompatible implicit declaration of built-in function 'strcpy'
    wtf.c:12: error: invalid lvalue in unary '&'


    It doesn't take that much massaging to make it compile. I did it at work today on my Fedora box.

    Google for 'linux kernel module example' and it's pretty clear that adding about 5 lines and creating a simple Makefile will do it.
  • ais523 2012-05-24 07:09
    TRWTF is that it doesn't compile on Linux. Of course no specific version was specified, so I tried RHEL 5.4 and SLES 9, which were the most convenient test boxes that I had access to.


    Looks like there's a dependency on kernel headers (which would normally be in the makefile, but it isn't part of the submission). Compiling a kernel module isn't quite the same as compiling a user-space application. (And I'd be very surprised if this trick were possible outside the kernel…)
  • Steve Wahl 2012-05-24 14:54
    TheCPUWizard:
    ...multi-user mainframe....DecWriter (sic)


    Given that nearly evry mainframe of that time period was EBCDIC based, and the DECwriter was ASCII, it would be extremely suprising to see that combination.


    If you're truly interested in historical configurations, I'm not the original poster but at the school I went to (1984-1988), we had IBM mainframes, a DEC VAX running BSD, and some other timesharing systems. In addition to 3270 terminals scattered around campus, we had ASCII terminals including decwriters, ADM 3a's, PCs with terminal emulation, etc. The ASCII side of the house was mostly connected to a Gandalf PACX, which let you choose which computer you connected to. The IBM mainframe included a front end (once a 7171, I think, but upgraded while I was there) that made the mainframe think you were coming from a 3270 terminal when in fact you were using an ascii terminal.

  • Lee 2012-05-25 10:56
    I know I'm late to the party with this comment, but I used to travel to Temple University in Philadelphia with a few friends after high school let out for the day to hack their CDC 6600 mainframe. Though it accepted puch card jobs (handed to an operator as well as submitted remotely via CDC 200 User Terminals via dedicated lines using a primitive 9600 baud modem), there were a few DECwriters hooked up, as well. I think that CDC definitely qualifies as a mainframe.
  • Shinobu 2012-05-28 06:30
    Norman Diamond:
    The Science Museum, London, had an exhibit on Charles Babbage in 1999. That's where I read that he was vilified for trying to fix bugs in tables of logarithms.
    Ooh, that's interesting. Their website doesn't mention it though. Still, it would be very interesting if it were to turn out there were some truth to it, and I'd love to read more about it.
  • Norman Diamond 2012-05-28 23:00
    Shinobu:
    Norman Diamond:
    The Science Museum, London, had an exhibit on Charles Babbage in 1999. That's where I read that he was vilified for trying to fix bugs in tables of logarithms.
    Ooh, that's interesting. Their website www.sciencemuseum.org.uk onlinestuff stories babbage.aspx doesn't mention it[/url] though. Still, it would be very interesting if it were to turn out there were some truth to it, and I'd love to read more about it.
    You're right, it's too bad their web site doesn't mention it.

    The quotes below are relatively innocuous. They are NOT the droids that I'm looking for.

    www.computerhistory.org babbage dionysiuslardner
    "Here Lardner again trumpeted the danger of tabular errors, and this at the expense of the mathematical potential of the machines. His focus on errors was a well-intentioned attempt to publicize the engines. But in overemphasizing errors he did Babbage's interests near-fatal damage as experts disagreed whether errors in tables were a serious problem at all."

    www.computerhistory.org babbage georgeairy
    "In 1842 he advised the Treasury that the engines were 'useless' and that Babbage's project should be abandoned. The Government axed the project shortly after. Airy was not alone in his opposition. Astronomers in Sweden and France also rejected the utility of the machines."

    Akismet says that computer history is spam.

    Akismet still says that computer history is spam.

    Maybe a moderator can put the URLs back together, since no one's going to moderate Akismet.
  • Spoe 2012-05-30 10:28
    TheCPUWizard:
    ...multi-user mainframe....DecWriter (sic)


    It is DECwriter...made by...wait for it...DEC [Digital Equipment Corp]. The vast majority of these were used for PDP-11 and VAX computers, both of which were considered Mini computers and not mainframes...


    I remember those. The company I worked for in the nineties sold those to farms (the agricultural kind) so they could dial in to our VAXen to run reports. I think we stopped selling them in the eighties, but they were still in use (and we had to support them) in to the naughties (2000s).