Re: How to generate a #SMI?



Lighter wrote:

How to generate a #SMI?


The more important question would be: Once you know how to,
then what?

#SMI being pulled causes the chip set/CPU to open up the SMRAM
areas that are otherwise protected and the System BIOS would
have set the entry point to somewhere in there. Most of the
time, Non-SMM access to that area will be locked and not all
CPUs allow to revector the SMMBASE to an arbitrary address by
means as simple as writing to an MSR (as a rule of thump:
AMD do, Intel don't.)

Thus, short of exploiting common vulnerabilities that exist
in probably all BIOS implementations of an SMM handler, there
is no easy way of taking over control once you figured out how
to generate an SMI.


To my thinking, the current process can use I/O instructions to do
this. Say, the system provides a special I/O port; This port is an
interface of an actual device. Upon the device detectes signal at the
given port, it generates a #SMI.

Am I right?

Right on. There even is a compatible way to generate a software
SMI on any system that supports ACPI.

It comes down to finding the FACP (the ACPI spec has the
algorithm you would need to follow), a table that contains a port
address and a value to write to that port address in order for
an ACPI enabled OS to take over control.

There is another value that does the opposite and one for S4/BIOS,
which is obsolete. Either way, writing _any_ value to that port
will generate an SMI.

On Intel southbridges the software SMI port is always 0xB2, meaning
_any_ value written to that port will cause an SMI.

.



Relevant Pages

  • Re: How to generate a #SMI?
    ... management mode (SMM for short). ... there is only one way to enter SMM, which is through #SMI. ... the system provides a special I/O port; ... only occurs on read or writes for the I/O port. ...
    (comp.lang.asm.x86)
  • Re: [PATCH] x86: provide a DMI based port 0x80 I/O delay override.
    ... That may be an SMI, or perhaps any other kind of interrupt or exception. ... It appears to be the standard POST diagnostic port. ... So the ACPI BIOS thinks it has something to do with debugging. ... There's a little strangeness here, however, because the value sent to the port occasionally has something to do with arguments to the ACPI operations relating to sleep and wakeup ... ...
    (Linux-Kernel)
  • Re: [PATCH] [RESEND] Add Dell laptop backlight brightness display
    ... To do the proper SMI call requires parsing SMBIOS structure 0xDA, ... and getting the SMI index and io port and ...
    (Linux-Kernel)
  • Re: How to generate a #SMI?
    ... management mode (SMM for short). ... there is only one way to enter SMM, which is through #SMI. ... the system provides a special I/O port; ... If there's some process for which the hardware needs a few CPU cycles, no matter in what mode the CPU is running now, then it generates an SMI and the SMI handler does the necessary processing. ...
    (comp.lang.asm.x86)
  • [PATCH] linux-2.4.22_clear-smi-fix_A0
    ... This basically clobbers the SMI, ... able to transition into full ACPI mode. ... we leave the apic entry alone and return. ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)