Sunday, July 25, 2010

"Killed by Code: Software Transparency in Implantable Medical Devices"

The Software Freedom Law Center (SFLC) has recently, July 21, 2010, published an interesting paper: Killed by Code: Software Transparency in Implantable Medical Devices.


SFLC makes a case for why Safety Critical systems should all have their source code available for public review.  They are promoting Free and Open Source Software (FOSS) be mandated for medical devices, and all devices in general; myself I want to see Toyota's source code to look for the race condition [unfortunate terminology in this case] of unintended acceleration that I believe exists.


I covered the issues related to the FDA's promotion of FOSS in medical devices previously: FDA says commercial software kills, but Open Source won't? and 200,000 Infusion Pumps ordered destroyed by FDA, due to software defects and other problems.


Philosophically I agree with SFLC's position, and in Utopia it would work out well that all devices have Free Open Source Code.  However in the real world of cooperate greed where only the bottom line of next quarter is all that maters, I do not see medical device manufactures, or automotive manufactures, giving up what they would consider 'Trade Secrets' so that their competition could use them.  A more workable solution would be an independent auditing agency, which still must be held to the highest standards to prevent such things as cooperate kickbacks.  Nor would we want the agency to be funded by the people that are having their code audited.


Also just because a project is FOSS does not mean it is secure.  One only has to take a look at the recent events of the Unreal IRC Server Project.



"We found out that the Unreal3.2.8.1.tar.gz file on our mirrors has been replaced quite a while ago with a version with a backdoor (Trojan) in it.".


This incident demonstrates that the entire chain of custody from the Source Code to the code on the device must be traceable, so that the code that is really being run, is the code that came from the legitimate sources of the project.


Unreal had this to say about addressing the issue, to give some ideas of what needs to be done:


Posted by Syzop on June 14, 2010, 3:36 pm EDT

After receiving many questions of what we are doing with regards to the hack incident, here's my reply:


First, we now PGP/GPG sign releases. Our GPG key is releases@unrealircd.com (0x9FF03937). When downloading UnrealIRCd you will be given instructions on how to verify the integrity of the file.


Second, we're now isolating/shielding the main site from the rest, and making parts unmodifiable, to prevent catastrophes in case of a break-in.


Third, we added several methods of detection when files and other data is modified.


Fourth, we'll only serve the files from the main site for now. While the mirror admins did not have any blame in this, it does mean we only have to protect our own site(s).


And finally we did some other things which I won't mention here.


In short: we've really tightened security since the break-in to make sure this will never ever happen again. As you may understand, we really can't afford a repeat of this incident.


On an unrelated side note, I find the claims in various media that this security incident indicates that Linux and Open Source cannot be trusted and that Microsoft and closed-software is better really silly. It lacks any foundation. A hacker, once in, could just as easily have inserted the backdoor in Windows software. In fact, it is *THANKS* to it being Open Source that this backdoor got noticed, though - I fully agree - much too late.


Hash Deep is helpful to find development files that have changed unintentionally, due to either simple disk corruption or malicious intent.  On Embedded Devices themselves I run CRC checks of the code.  SRecord is a big help in this area.



Returning back to SLFC's paper.  SFLC points to the case of Riegel v. Medtroni in February 2008, stating:




"Since the FDA is a federal agency, its authority supersedes state law. Based on the concept of preemption, the Supreme Court held that damages actions permitted under state tort law could not be filed against device manufacturers deemed to be in compliance with the FDA, even in the event of gross negligence."...


"It is clear that medical device manufacturers have responsibilities that extend far beyond FDA approval and that many companies have failed to meet their obligations," William H. Maisel said in recent congressional testimony on the Medical Device Reform bill.50 "Yet, the U.S. Supreme Court ruled in their February 2008 decision, Riegel v. Medtronic, that manufacturers could not be sued under state law by patients harmed by product defects from FDA-approved medical devices ... . [C]onsumers are unable to seek compensation from manufacturers for their injuries, lost wages, or health expenses. Most importantly, the Riegel decision eliminates an important consumer safeguard - the threat of manufacturer liability - and will lead to less safe medical devices and an increased number of patient injuries."



Here is part of that actual US Supreme Court Decision, that I took from Cornell:



"The Riegels contend that the duties underlying negligence, strict-liability, and implied-warranty claims are not pre-empted even if they impose " 'requirements,' " because general common-law duties are not requirements maintained " 'with respect to devices.' " Brief for Petitioner 34-36. Again, a majority of this Court suggested otherwise in Lohr. See 518 U. S., at 504-505 (opinion of Breyer, J.); id., at 514 (opinion of O'Connor, J., joined by Rehnquist, C. J., and Scalia and Thomas, JJ.).6 And with good reason. The language of the statute does not bear the Riegels' reading. The MDA provides that no State "may establish or continue in effect with respect to a device ... any requirement" relating to safety or effectiveness that is different from, or in addition to, federal requirements. §360k(a) (emphasis added). The Riegels' suit depends upon New York's "continu[ing] in effect" general tort duties "with respect to " Medtronic's catheter. Nothing in the statutory text suggests that the pre-empted state requirement must apply only to the relevant device, or only to medical devices and not to all products and all actions in general." --- Justice Scalia, Opinion of the Court; RIEGEL v. MEDTRONIC, INC. (No. 06-179)
451 F. 3d 104, affirmed.



Not being a lawyer, it seems to me that the Court just gave medical device manufactures a free pass to make defective products because there is no longer a threat of liability?  We have all seen the End User Licenses Agreements (EULA) for software that all say, using lots of Lawyer Weasel Words, "No mater what this software does to you and yours.  It is not our fault.  To bad for you."  Is this where hardware is now?

Thursday, July 15, 2010

Flawed arguments against Electric Vehicles

I keep hearing the argument about how plug-in electric cars don't save anything because you still have to generate electricity at the power plant. This argument is flawed.

Before getting into that I need to point out that some might consider my view biased. In a past life I designed Coal Mining equipment, and I'm still involved with Mine Safety and Health Administration (MSHA) and the Coal Ming section of CDC/NIOSH. See our A Technology Review of Smart Sensors with Wireless Networks for Applications in Hazardous Work Environments booklet for example. A bit outdated now, written before most people had heard of wireless sensors or energy harvesting. Now with that out of the way, lets move on...

The major design goal of any moving vehicle is to keep its weight down. Right now each and every car out there has to carry the weight of its own pollution control system around. That takes energy in and of itself.

Putting the pollution control system at the power plant has no issues of weight so they can be far more effective. Since the electric car no longer has to consume energy to move around its own pollution system there is an over all savings of resources.

What is more importantly overlooked is the resources consumed in making the pollution control system for every existing gas powered vehicle.

Resources such as Palladium and other metals are used to make Catalytic Converters, which takes significant energy in the manufacturing process. There are may other resources also consumed to manufacture these pollution control systems.

Something else most always over looked in the discussion of hybrid vehicles just moving the pollution form the tail pipe to the smoke stack, is Regenerative Braking.

In both conventional and hybrid/electric vehicles energy is used to get the vehicle moving, in other words the fuel is converted in to kinetic energy. However there is a significant difference in how energy is used to get the respective vehicle types stopped.

A conventional vehicle uses friction heating to dissipate the energy that was used to get the vehicle moving in the first place. Applying the brakes causes the brake pads to engage to slow the vehicle to a stop by dissipating the kinetic energy as heat through friction. That heat goes into the environment, and is totally wasted.

On the other hand, a properly designed hybrid or electric vehicle will use Regenerative Braking to return the kinetic energy back into stored energy in the systems batteries or capacitors. There will be some small amount of energy lost to the environment, due to the system not being 100% efficient.

The bottom line is that the existing vehicles waste nearly 100% of their stopping energy, while a electric vehicle will recover significant amounts of their stopping energy, which will approach 100% recovery as technology advances.

One final thought. Did auto and oil companies gang up to kill the electric car? Check out 2006 documentary film "Who killed the electric car?".

Sunday, July 4, 2010

Alternative Energy Government Funding Seminar in Youngstown on July 8th 2010

Alternative Energy Government Funding Seminar in Youngstown on July 8th

If you happen to be in the Youngstown Ohio area on July 8th 2010, you might want to stop into the seminar being giving on how to get grants from the Government for your high-tech start-up adventure:

"Show Me the Money! Obtaining Government Funds for High-Tech Start-Ups and Small Businesses. Learn innovative ways to pursue pgovernment funding, new rules on earmarks and how they affect small businesses, legislative opportunities to advance your organization, and what agencies are looking for in grant applications."

While I personally would like to see such pork gone, so that we all end up with lower taxes, we might as well take advantage of the supposedly "free" money ("free" in the Orwellian sense that it was taken by force from you and I in the form of taxes), to take advantage of the programs offered, until we can vote their creators out of office.

While in the area you might want to stop by Youngstown State University. YSU recently held their 2010 Sustainable Energy Forum. The areas leaders are hoping to invent a "Tech. Belt", 134 miles long from Cleveland to Pittsburgh. They see Sustainable Energy as a key component. After all when you stop to think about, the key to survival at any level of abstraction is energy, right down to the energy we each get from our food.

They covered the usual suspects:

  • Biofuels
  • Energy Efficiency
  • Fuel Cells and Electric Vehicles
  • General Topics: Liquid Fuels, Advanced Material, etc.
  • Landfill / Digester Gas
  • Wind and Solar

Alas world changing ideas don't come from the mainstream, but from the obscure people working in their workshops, working on ideas that many say would not work at all, ever. Our own industry is a good example. Fellow from IBM once said that there was only the need for a few computers world wide, ever. Unil a few people working in garages and such started to play with the first microprocessors, and we all know how that turned out.

To see what is happening in the fridges of Science take a look at the 17th annual Natural Philosophy Alliance conference recently held in Long Beach California.

The fancy official abstracts can be found here, while a clear summarized version is found here. Click on the icon of the 'glasses' to down load the papers; not real intuitive.

You can get the Conference Proceedings, 650 Pages, to see what is happening on the bleeding edge of Wired Science.

Is all of that valid, not at all likely, will something there change the world, maybe it just might... Our Consensus Reality is made up of what we believe is possible...

Monday, June 28, 2010

Soldering Defect Database: How many ways can a solder joint fail? More than you might think.

The National Physical Laboratory (NPL), in the UK, has opened their Defect Database to the public. Of specific interest to us is the Soldering Defects Database.

When you go to the Soldering Defects Database, you are asked for an email address (not sure why?), once entered a set of pull-down menus is shown, allowing us to narrow the filed of defects that we want to search. If you want to see all of the defects simply hit "Submit Query", without selecting anything. This brings up a long page of pictures of the various types of defects.

NPL is also accepting submissions of solder defects not already covered.

An entry in the IPC Blog Introducing Defect of the Month from NPL and IPC: Toe Fillet Defects, introduces the new Defect of the Month video series; Gimpel Software's Bug of the Month comes to mind.

Steve Ciarcia, of Circuit Cellar Magazine, has been known to say that his favorite programming language was solder. Consider these defects to be the 'compiler errors' of the hardware realm.

Saturday, June 26, 2010

Safe and Secure Systems, Software Symposium - S5; Software survivability: where safety and security converge

This week (June 15th) wrapped up the 2010 Safe & Secure Systems & Software Symposium - S5 sponsored by the Air Force Research Laboratory Control Systems Development and Applications Branch (AFRL/RBCC), located at Wright-Patterson Air Force Base, purported home of Hangar 18.

The Air Force Research Laboratory Control performs basic research, exploratory development, and advanced development of flight control system technologies for highly reliable, fault tolerant vehicle stabilization, and flight path control. Develops concepts, components, criteria, analytical methods, and design tools for flight vehicle applications. Emphasizes development of fault tolerant control system architectures control automations, flight critical hardware and software, such as actuators, sensors and computational elements; and on-board and networked vehicle management systems. Integrates flight control with airframe, avionics, propulsion, utilities, mission, and vehicle flight path management. Conducts full spectrum of development and application activities ranging from initial concept definition through system mechanization, laboratory evaluation, and flight validation.

The AFRL/S5 event brought together industry, academia and government to collaborate on the common goal of improving the airworthiness and assurance certification process of future aerospace flight control systems with both incremental and revolutionary technological innovations in safety and security verification and validation (V&V) techniques that support maintaining cost and risk at acceptable levels.

The executive summary list for the S5 event includes:

  • Improving V&V for flight critical/safety and mission/information security
  • Designing for Airworthiness Certification:
  • Software for Complex Systems
  • Fundamentals for the Future

A good paper to start with, to get the flavor of the event, and to see the relevance to Embedded Systems, is: Software survivability: where safety and security converge by Karen Mercedes Goertzel and Booz Allen Hamilton.

The S5 agenda contains links to all of the presented papers (those are links at that site, but it is not obvious in all browsers).

The Goertzel/Hamilton paper puts particular emphasizes that few of us give much consideration, which is something that we all need to change, that is Threats and Attacks, on our systems. Threats and Attacks "Require human intention and intelligence in planning and execution", which stand in contrast to the normal Hazards that we do consider; the stuff of life that just happens, like lightning strikes, failed components, lead free tin-wiskers.

Today's Adversaries are:

  • Knowledgeable: They know more about our software than we do, including its vulnerabilities.
  • Skill and sophisticated: Not just "script kiddies". Attackers know how to exploit vulnerabilities, how to augment/assist direct attacks with social engineering and surreptitious malware (worms, Trojans, bots, spyware).
  • Quick: "Zero day" is the rule, with new attacks appearing before vulnerabilities are discovered by developers, let alone patched.
  • Motivated and well-resourced: Not just recreational hackers, but organized criminals, nation-state Info Warriors, Cyber Terrorists.

Our adversaries are not motivated by the Next Quarters Bottom Line, unlike our shorted sited corporate leaders. They are motivated by greed (hmm...that makes it sound like our corporate leaders are our adversaries doesn't it?) or the desire to do us harm. The Bad Guys usually have better resources and a single task to accomplish, unlike most Embedded System development groups, and deadlines that are not motivated by trade show schedules. The Bad Guys take advantage of the mantra of "There is never time to do it right now, but there will always be time to do it over someday in the future", that far to many organizations use as their design standard.

Goertzel/Hamilton mention (see Naval Sea Systems Command (NAVSEA)/Naval Ordnance Safety and Support Activity (NOSSA)) one of my pet-peeves "unnecessary functionality" as one of the "Hazards and risks that arise in software". The Creeping Feature Creature can be a powerful taskmaster, that leads to increased time to market and development costs that impact the bottom line, for features that will never be used by a customer, but seem "really cool" to management and developers.

Goertzel/Hamilton do give some recommendations on how to improve Software Safety and Security. Alas not of them seem practical in the corporate world due to time, budget, and size constraints.

Spend some time reading all of the other papers, to see where Safety Critical System development is headed.

Sunday, June 20, 2010

Safety and Security Considerations for Component-Based Engineering of Software-Intensive Systems; Engineering software for survivability intro.

In the document known as the AS is State Report [SIC] from the Navy Software Process Improvement Initiative (SPII), the Assistant Secretary of the Navy for Research, in 2007, stated that all systems are to be considered to be Software Intensive, unless a strong case can be made to the contrary. The Navy has been working with other branches of Government to develop plans related to Software Safety.

The Navy and obscure branch of the Department of Homeland Security known as Build Security In, a project of the Strategic Initiatives Branch of the National Cyber Security Division (NCSD), has released a new draft [June 11th/2010] of Safety and Security Considerations for Component-Based Engineering of Software-Intensive Systems.

The Naval Sea Systems Command (NAVSEA) Composition draft is based on the earlier Department of Defense, Joint Software Systems Safety Engineering Handbook, Draft Version 0.95, 2009.

Specifically, the paper discusses:

  • The types of anomalous, unsafe, and non-secure behaviors that can emerge when components interact in component-based systems;
  • Analysis and assessment techniques that can be used to predict where and how such anomalous behaviors are likely to occur;
  • Architectural engineering countermeasures that can be used by the system's developer to either prevent such behaviors or to contain and minimize their impact, thereby mitigating the risk they pose to the safe, secure operation of the system.
  • Architectural engineering techniques and tools that can be used to mitigate many emergent risks and hazards.

The referenced documents on system and software development alone make the paper worth a look.

"Because properties such as safety and security are not intrinsic to individual components in isolation-these properties emerge from the interactions between components or the interactions between a component and its environment or a human user-individual component testing and analysis (e.g., through static and dynamic analysis, fault injection, fuzzing, etc.) can only provide incomplete and indirect evidence of how the component might behave when interoperating with other components within a component-based system. Emergent properties can only be demonstrated through testing that involves component interactions, e.g., pair-wise component testing and testing of whole component assemblies."

I'm not sure I agree with the papers premises that buffer-overflows should be mitigated by 'sandboxing' areas of code that could have buffer-overflows. That might end up being a really big 'sandbox' in some cases. Why not design the code to not allow buffer overflows?

Other sections I find much easier to stomach, such as:

  • Hazards and risks that arise from composition.
  • Parameter-passing issues.
  • Timing and sequencing issues. Right data at the wrong time; firing your 50mm gun before aiming it is not good.
  • Resource conflicts. Race Conditions and Deadlocks.
  • Unanticipated execution of unused/dormant code. One of my favorites pet-peeves is to see 'dead code' in live products.

Section five gives some guidance on FMEA, FMECA, and Hazard Analysis for Component-Based Software:

"As noted in the Joint Software Systems Safety Engineering Handbook, because software has no physical failure modes, Failure Modes and Effects Analysis (FMEA), Failure Mode, Effects, and Criticality Analysis (FMECA),61 and related analysis can be difficult to apply to software intensive systems. This said, software does have functions that can be implemented incorrectly, operate erroneously, or fail to operate at all for various reasons. For component-based software, FMEA/FMECA that strives to identify the causes and potential severity (or criticality, in FMECA parlance) of failures of software functions needs to consider not just errors within individual software components, but errors that may arise from "mismatches", such as expected but-not-received, unexpected, or incorrectly-formatted input from or output to other components."

The Draft goes on to explain ways of mitigating risks.

Unlike most documents out of the Government and Military Academia, this one at least mentions Embedded Software:

"Embedded Software: Software physically incorporated into a physical system, device, or piece of equipment whose function is not purely data processing, or external but integral to that system/device/equipment. The functionality provided by embedded software is usually calculation in support of sensing, monitoring, or control of some physical element of the equipment, device, or system, e.g., mathematical calculations of distances used in calibrating the targeting mechanisms of a weapon system; interpretation and comparison of heat sensor readings in a nuclear-powered submarine engine against a set of safe temperature thresholds."

Alas they still do not grasp the constrained resources of most Embedded Systems.

Appendix C. "Engineering software for survivability" gives a good, short, synopsis what should be considered when designing any Embedded System that needs to keep running, no mater what.

Saturday, June 19, 2010

I'm Scared

This week I spent a couple of days at regional seminars. At the Texas Instruments Technology Days 2010 in Cleveland, the thing I found most interesting is TI's new Analog Mirror. A single, large, pixel of their already popular DLP technology. Must be something cool we can do with this mirror? Dynamic Signs maybe?

The other seminar this week was sponsored by Atmel, to drum up design wins for their AVR32 family of parts, here in the Pittsburgh market region.

Most of the seminar was showing how to use AVR32 Studio that is based on Eclipse. Alas I probably won't use these parts because the seven year old machine supplied by the IT department would never handle such a large application. Just a fresh reboot of the machine already has 230M+ of the 512Meg of memory used with cooperate bloatware mandated by IT (Makes their jobs easier).

What is relevant to us here today is a comment that the instructor made, paraphrased:

We had to switch to Eclipse because all of the people coming to the Embedded World from the Microsoft World did not know how to write their programs without such a tool.

I find that scary. We'll end up with large, and potentially unsafe, expensive products, because Management assumes any programmer that can write a business application or web app. can design a safe embedded system if they only have the right tool.

Something else I find scary is the article Think it - Draw it - Build it by Mark Saunders, at Embedded.com.

Mark introduces us to the new Cypress Semiconductor PSoC Creator embedded design tool, for Cypress's new PSoC 3 and PSoC 5 programmable system-on-chip architectures. The PSoC 5 parts are something I want to investigate for use in a board test system I'm designing. You don't know what the board under test may need in a test system so a configurable system is the way to go.

However I find the marketing of this product family to be scary:

...You will not need to know the CPU architecture we're using, or how the analog comparator or digital timer components are implemented...

...[PSoC Creator] abstracts away the hardware so you do not need to be an expert on the device you are using or the inner workings of peripherals you program it with...

For the comparator is any overdrive required, how much? Is there any hysteresis to prevent oscillation? What happens when the counter rolls over, does it do The Right Thing? Hopefully some quality time spent with a quality data sheet (sadly far to many data sheets lack any quality) would answers these questions. Would the people using Eclipse from the Microsoft world even know to ask such questions?

Now are you starting to see why I'm scared? I fear that we are heading down the path of Think it - Draw it - Build it - Ship it - So we get paid for it - Doesn't mater if it works right.

How scared are you about the quality of our future Embedded Systems?

"I Code to Spec"

JustFred said something in the thread about how to deal with handling names, that I found to be all to depressing because it is true far to often:

I code to spec. The product and marketing departments write the spec (what little there is); the QA department amends the spec with overly specific test cases. I suggest that the spec is incomplete and won't handle...but I'm told, just code it to spec. I recommend changed, but we don't have time for edge cases. I point out potential problems, but we're unlikely to get any of those. I warn of potential compatibility problems but we don't care. Are you just trying to be difficult? If there's a problem QA will catch it. The project is overdue already, and by the way here are some new requirements that need to make it in, and we can't change the release date because we already promised the stockholders. Why is your code so complicated, my twelve-year-old kid could write this.

It's not my fault. I code to spec.

-- http://slashdot.org/comments.pl?sid=1690138&cid=32609504.

What happens when developers are held liable for their code? Do we become Management's scapegoat for problems that they would not let us fix?