Fuse

Fuse is an integrated learning platform that delivers world-class training and performance coaching. Together We’re Building the Future of Learning. Fuse offers studio, one-, two-, three-, and four-bedroom floor plans. Each apartment home comes fully furnished in modern design including stainless steel appliances, quartz countertops, hardwood-style floors, and more. Additionally, Fuse offers community amenities unbeatable anywhere else in West Lafayette including a fully equipped gym, yoga.

A fuse is probably the simplest electrical device, but its function is critical in protecting electrical circuits from damage. Fuses are found in every circuit in one form or another in various shapes, sizes, and ratings. In this article, we will learn how a fuse works and about the different types of the fuse.

How does a fuse work?

The primary job of a fuse is to break the circuit if a current higher than desired is drawn by the circuit, thus preventing damage due to short circuits.

The simplest kind of fuse consists of a resistive element, selected carefully for its melting point. When a current passes through this element, a small voltage drop (small enough so the circuit downstream won’t be affected) is created across the element, and some power is dissipated as heat. The temperature of the element thus increases. For normal currents, this temperature increase is not enough to melt the filament. However, if the current draw exceeds the rated current of the fuse, the melting point is quickly reached. The resistive element melts and the circuit is interrupted. The thickness and length of the resistive element determine the rated current.

Fuse elements are made of zinc, copper, silver, aluminium or other alloys to provide predictable trip currents. The element must not oxidize or corrode over time.

Symbol of a Fuse

The standard IEEE/ANSI symbols for the fuse is as follows:

However, the IEC fuse is slightly different:

Types if Fuse

Fuses can be divided into two major categories, AC fuses, and DC fuses. The below block diagram illustrates the different types of the fuse under each category. We will discuss each fuse in brief in our article.

DC Fuses

1.CARTRIGE FUSES

This is the most common type of fuse. The fuse element is encased in a glass envelope that is terminated by metal caps. The fuse is placed in an appropriate holder. Since the glass envelope is clear, it is easy to visually determine if the fuse is blown.

There are many variants of this design, including slow blow fuse and fast blow fuse. Slow blow fuses have a larger element that can handle overcurrent for a relatively short period of time and are unaffected by spikes in the appliance. Fast blow fuses react instantly to current spikes.

Fuse

Some variants of this fuse are encased in ceramic to withstand high temperatures. Fuses for high voltage applications are filled with sand or oil. This is to prevent arcing between the two ends of the fuse after it has blown. SMD variants of cartridge fuses also exist for direct PCB mounting.

2. AUTOMOTIVE FUSES

These fuses are specifically designed for automotive systems that run up to 32V and occasionally 42V. They come in ‘blade’ form (a transparent plastic envelope with flat contacts) and are colour coded according to rated current. Some of these types are also used in other high-power circuits.

3. RESETTABLE FUSES/POLYFUSE

Fuselage

Like their name suggests, these fuses are self-resetting. They contain carbon black particles embedded in organic polymers. Normally, the carbon black makes the mixture conductive. When a large current flows, heat is generated which expands the organic polymer. The carbon black particles are forced apart, and conductivity decreases to the point where no current flows. Conductivity is restored as temperature decreases. Thus, the fuse does not have to be physically replaced. This kind of fuse is also called a PTC, meaning positive temperature coefficient, since resistance increases with temperature.

PTC Fuse is ubiquitous in computer power supplies and phone chargers. They are particularly handy here since replacement is difficult. For the same reason, they are used in aerospace devices.

PTCs are easily identified by their yellow-orange colour and disc (and occasionally rectangular) shape in their through-hole variants. SMD poly fuses usually come in green with white markings or black with gold markings. PTCs are available in virtually every current rating.

4. SEMICONDUCTOR FUSES

The power dissipated by a semiconductor increases exponentially with current flow, and hence semiconductors are used for ultrafast fuses. These fuses are usually used to protect semiconductor switching devices that are sensitive to even small current spikes.

5. OVERVOLTAGE SUPPRESSION

Sometimes voltage spikes can be harmful to circuits too, and often an overvoltage protection device is used with a fuse to protect against both voltage and current spikes.

NTCs (negative temperature coefficient) are placed in parallel with the supply. When the supply voltage spikes, NTC Fuses decrease resistance due to higher current flow and ‘absorb’ spikes.

Metal oxide varistors (MOVs) are semiconductor like devices that bidirectionally absorb voltage spikes. You can learn more about MOV and its working using the linked article.

AC FUSES

HIGH VOLTAGE FUSES:

These fuses are used in high voltage AC transmission lines where voltages can exceed several hundreds of kilovolts.

HRC (High Rupture Current) fuses: HRC fuses are cartridge type fuses consisting of a transparent envelope made of steatite (magnesium silicate). The fuse is filled with quartz powder (and in the case of a liquid-filled HRC fuses, a non-conducting liquid like mineral oil) that acts as an arc extinguishing agent.

These fuses are used for very high fault currents.

Expulsion Fuses: These fuses are filled with chemicals like boric acid that produce gases on heating. These gases extinguish the arc and are expelled from the ends of the fuse. The fuse element is made of copper, tin or silver.

LOW VOLTAGE FUSES:

These fuses are used in the relatively low voltage distribution networks.

Cartridge fuses: They are very similar to cartridge DC fuses. They consist of a transparent envelope surrounding the fuse element. They can be plugged in (blade type) or screwed into a fixture (bolt type).

Drop out fuses: They contain a spring-loaded lever arm that retracts when a fault occurs and must be rewired and put back in place to resume normal operation. They are a type of expulsion fuse.

Rewireable fuses: They are a simple reusable fuse used in homes and offices. They consist of a carrier and a socket. When the fuse is blown, the carrier is taken out, rewired and put back in the socket to resume normal operation. They are somewhat less reliable than HRC fuses.

Striker fuse: These fuses are provided with a spring-loaded striker that can act as a visual indicator that the fuse has blown and also activate other switchgear.

Switch fuse: A handle that is manually operated can connect or disconnect high current fuses.


Definitions¶

Userspace filesystem:
Fuse

A filesystem in which data and metadata are provided by an ordinaryuserspace process. The filesystem can be accessed normally throughthe kernel interface.

Filesystem daemon:

The process(es) providing the data and metadata of the filesystem.

Non-privileged mount (or user mount):

A userspace filesystem mounted by a non-privileged (non-root) user.The filesystem daemon is running with the privileges of the mountinguser. NOTE: this is not the same as mounts allowed with the “user”option in /etc/fstab, which is not discussed here.

Filesystem connection:

A connection between the filesystem daemon and the kernel. Theconnection exists until either the daemon dies, or the filesystem isumounted. Note that detaching (or lazy umounting) the filesystemdoes not break the connection, in this case it will exist untilthe last reference to the filesystem is released.

Mount owner:

The user who does the mounting.

User:

The user who is performing filesystem operations.

What is FUSE?¶

FUSE is a userspace filesystem framework. It consists of a kernelmodule (fuse.ko), a userspace library (libfuse.*) and a mount utility(fusermount).

One of the most important features of FUSE is allowing secure,non-privileged mounts. This opens up new possibilities for the use offilesystems. A good example is sshfs: a secure network filesystemusing the sftp protocol.

The userspace library and utilities are available from theFUSE homepage:

Filesystem type¶

The filesystem type given to mount(2) can be one of the following:

fuse

This is the usual way to mount a FUSE filesystem. The firstargument of the mount system call may contain an arbitrary string,which is not interpreted by the kernel.

fuseblk

The filesystem is block device based. The first argument of themount system call is interpreted as the name of the device.

Mount options¶

fd=N

The file descriptor to use for communication between the userspacefilesystem and the kernel. The file descriptor must have beenobtained by opening the FUSE device (‘/dev/fuse’).

rootmode=M

The file mode of the filesystem’s root in octal representation.

user_id=N

The numeric user id of the mount owner.

group_id=N

The numeric group id of the mount owner.

default_permissions

By default FUSE doesn’t check file access permissions, thefilesystem is free to implement its access policy or leave it tothe underlying file access mechanism (e.g. in case of networkfilesystems). This option enables permission checking, restrictingaccess based on file mode. It is usually useful together with the‘allow_other’ mount option.

allow_other

This option overrides the security measure restricting file accessto the user mounting the filesystem. This option is by default onlyallowed to root, but this restriction can be removed with a(userspace) configuration option.

max_read=N

With this option the maximum size of read operations can be set.The default is infinite. Note that the size of read requests islimited anyway to 32 pages (which is 128kbyte on i386).

blksize=N

Fuse.net

Set the block size for the filesystem. The default is 512. Thisoption is only valid for ‘fuseblk’ type mounts.

Control filesystem¶

There’s a control filesystem for FUSE, which can be mounted by:

Mounting it under the ‘/sys/fs/fuse/connections’ directory makes itbackwards compatible with earlier versions.

Under the fuse control filesystem each connection has a directorynamed by a unique number.

For each connection the following files exist within this directory:

waiting

The number of requests which are waiting to be transferred touserspace or being processed by the filesystem daemon. If there isno filesystem activity and ‘waiting’ is non-zero, then thefilesystem is hung or deadlocked.

abort

Writing anything into this file will abort the filesystemconnection. This means that all waiting requests will be aborted anerror returned for all aborted and new requests.

Only the owner of the mount may read or write these files.

Interrupting filesystem operations¶

If a process issuing a FUSE filesystem request is interrupted, thefollowing will happen:

  • If the request is not yet sent to userspace AND the signal isfatal (SIGKILL or unhandled fatal signal), then the request isdequeued and returns immediately.

  • If the request is not yet sent to userspace AND the signal is notfatal, then an interrupted flag is set for the request. Whenthe request has been successfully transferred to userspace andthis flag is set, an INTERRUPT request is queued.

  • If the request is already sent to userspace, then an INTERRUPTrequest is queued.

INTERRUPT requests take precedence over other requests, so theuserspace filesystem will receive queued INTERRUPTs before any others.

Fuse

The userspace filesystem may ignore the INTERRUPT requests entirely,or may honor them by sending a reply to the original request, withthe error set to EINTR.

It is also possible that there’s a race between processing theoriginal request and its INTERRUPT request. There are two possibilities:

  1. The INTERRUPT request is processed before the original request isprocessed

  2. The INTERRUPT request is processed after the original request hasbeen answered

Fuse

If the filesystem cannot find the original request, it should wait forsome timeout and/or a number of new requests to arrive, after which itshould reply to the INTERRUPT request with an EAGAIN error. In case1) the INTERRUPT request will be requeued. In case 2) the INTERRUPTreply will be ignored.

Aborting a filesystem connection¶

It is possible to get into certain situations where the filesystem isnot responding. Reasons for this may be:

  1. Broken userspace filesystem implementation

  2. Network connection down

  3. Accidental deadlock

  4. Malicious deadlock

(For more on c) and d) see later sections)

In either of these cases it may be useful to abort the connection tothe filesystem. There are several ways to do this:

  • Kill the filesystem daemon. Works in case of a) and b)

  • Kill the filesystem daemon and all users of the filesystem. Worksin all cases except some malicious deadlocks

  • Use forced umount (umount -f). Works in all cases but only iffilesystem is still attached (it hasn’t been lazy unmounted)

  • Abort filesystem through the FUSE control filesystem. Mostpowerful method, always works.

How do non-privileged mounts work?¶

Since the mount() system call is a privileged operation, a helperprogram (fusermount) is needed, which is installed setuid root.

The implication of providing non-privileged mounts is that the mountowner must not be able to use this capability to compromise thesystem. Obvious requirements arising from this are:

  1. mount owner should not be able to get elevated privileges with thehelp of the mounted filesystem

  2. mount owner should not get illegitimate access to information fromother users’ and the super user’s processes

  3. mount owner should not be able to induce undesired behavior inother users’ or the super user’s processes

How are requirements fulfilled?¶

Fuse
  1. The mount owner could gain elevated privileges by either:

    1. creating a filesystem containing a device file, then opening this device

    2. creating a filesystem containing a suid or sgid application, then executing this application

    The solution is not to allow opening device files and ignoresetuid and setgid bits when executing programs. To ensure thisfusermount always adds “nosuid” and “nodev” to the mount optionsfor non-privileged mounts.

  2. If another user is accessing files or directories in thefilesystem, the filesystem daemon serving requests can record theexact sequence and timing of operations performed. Thisinformation is otherwise inaccessible to the mount owner, so thiscounts as an information leak.

    The solution to this problem will be presented in point 2) of C).

  3. There are several ways in which the mount owner can induceundesired behavior in other users’ processes, such as:

    1. mounting a filesystem over a file or directory which the mountowner could otherwise not be able to modify (or could onlymake limited modifications).

      This is solved in fusermount, by checking the accesspermissions on the mountpoint and only allowing the mount ifthe mount owner can do unlimited modification (has writeaccess to the mountpoint, and mountpoint is not a “sticky”directory)

    2. Even if 1) is solved the mount owner can change the behaviorof other users’ processes.

      1. It can slow down or indefinitely delay the execution of afilesystem operation creating a DoS against the user or thewhole system. For example a suid application locking asystem file, and then accessing a file on the mount owner’sfilesystem could be stopped, and thus causing the systemfile to be locked forever.

      2. It can present files or directories of unlimited length, ordirectory structures of unlimited depth, possibly causing asystem process to eat up diskspace, memory or otherresources, again causing DoS.

      The solution to this as well as B) is not to allow processesto access the filesystem, which could otherwise not bemonitored or manipulated by the mount owner. Since if themount owner can ptrace a process, it can do all of the abovewithout using a FUSE mount, the same criteria as used inptrace can be used to check if a process is allowed to accessthe filesystem or not.

      Note that the ptrace check is not strictly necessary toprevent B/2/i, it is enough to check if mount owner has enoughprivilege to send signal to the process accessing thefilesystem, since SIGSTOP can be used to get a similar effect.

I think these limitations are unacceptable?¶

If a sysadmin trusts the users enough, or can ensure through othermeasures, that system processes will never enter non-privilegedmounts, it can relax the last limitation with a ‘user_allow_other’config option. If this config option is set, the mounting user canadd the ‘allow_other’ mount option which disables the check for otherusers’ processes.

Kernel - userspace interface¶

The following diagram shows how a filesystem operation (in thisexample unlink) is performed in FUSE.

Note

Everything in the description above is greatly simplified

There are a couple of ways in which to deadlock a FUSE filesystem.Since we are talking about unprivileged userspace programs,something must be done about these.

Scenario 1 - Simple deadlock:

The solution for this is to allow the filesystem to be aborted.

Scenario 2 - Tricky deadlock

Fused Glass

This one needs a carefully crafted filesystem. It’s a variation onthe above, only the call back to the filesystem is not explicit,but is caused by a pagefault.

Fuse Apex Legends

The solution is basically the same as above.

Fuse Stock

An additional problem is that while the write buffer is being copiedto the request, the request must not be interrupted/aborted. This isbecause the destination address of the copy may not be valid after therequest has returned.

This is solved with doing the copy atomically, and allowing abortwhile the page(s) belonging to the write buffer are faulted withget_user_pages(). The ‘req->locked’ flag indicates when the copy istaking place, and abort is delayed until this flag is unset.