SlideShare a Scribd company logo
Sabato 24 Ottobre 2015
#LDROMA15
http://lug.uniroma2.it/ld15/
All'ombra del
Leviatano
https://robertoreale.me/linux-day-2015
File e filesystem
Die Dataien hat der liebe Gott gemacht, alles andere ist
Menschenwerk.
Source: Leopold Kronecker (apocrifo)
file is the new byte
All files are created equal.
Source: Anonimo
Everything is a file.
Source: Anonimo
All file systems are not created equal.
Source: 11th USENIX Symposium on Operating Systems Design and Implementation
(OSDI 14)
Fondazioni
For most users, the filesystem is the most visible
aspect of an operating system.
Source: Silberschatz & Galvin, Operating System Concepts, 7th ed.
The filesystem consists of two distinct parts: a collection
of files, each storing related data, and a directory
structure, which organizes and provides information about
all the files in the system.
Source: Silberschatz & Galvin, Operating System Concepts, 7th ed.
The most important job of UNIX is to provide a filesystem.
Source: Ritchie & Thompson, The UNIX TimeSharing System
A file contains whatever information the user places on it, for
example symbolic or binary (object) programs.
No particular structuring is expected by the
system.
Source: Ritchie & Thompson, The UNIX TimeSharing System
A file does not exist within a particular directory; the directory
entry for a file consists merely of its name and a pointer to the
information actually describing the file.
Source: Ritchie & Thompson, The UNIX TimeSharing System
There is a threefold advantage in treating I/O devices this way:
file and device I/O are as similar as possible; file and device
names have the same syntax and meaning, so that a program
expecting a file name as a parameter can be passed a device
name; finally, special files are subject to the same protection
mechanism as regular files.
Source: Ritchie & Thompson, The UNIX TimeSharing System
Perhaps paradoxically, the success of UNIX is largely due to
the fact that it was not designed to meet any predefined
objectives.
Source: Ritchie & Thompson, The UNIX TimeSharing System
Precisazioni
The whole point with "everything is a file" is not that you have
some random filename, but the fact that you can use
common tools to operate on different things.
Source: Linux Torvalds, 8 giugno 2002
The UNIX philosophy is often quoted as "everything is a file",
but that really means everything is a stream of
bytes.
Source: Linux Torvalds, 8 marzo 2007
It should be just a "read()", and then people can use
general libraries and treat all sources the
same.
Source: Linux Torvalds, 8 marzo 2007
Il paradosso
everything is a file
ma
il perimetro di cosa è un file non è flessible ad libitum
il perimetro di cosa è un file è
fissato dal kernel
la sintassi e la semantica del filesystem sono fissate dal
kernel
Il Leviatano
VFS: oltre 65 mila righe di codice già nel 2008
Source: Galloway et al., Model-Checking the Linux Virtual File System
approccio conservativo
kernel-centrico
debug difficile
l'utente non amministratore semplicemente non può
ecce spes eius frustrabitur eum et videntibus cunctis
praecipitabitur
Source: Iob, 41, 1
VFS
Astrazione
File: modello comune
Strutture dati: superblock, inode, file, dentry
Operazioni
Object-oriented
Implementazione
Disk data structures
Memory data structures
Disk space management
Precursori
Earlier VFS implementations include Sun's VFS (in SunOS
version 2.0, circa 1985) and IBM and Microsoft's "Installable
File System" for IBM OS/2.
Source: M. Tim Jones, Anatomy of the Linux virtual filesystem switch
Altre strade
Synthetic Files
9P: Plan 9 Filesystem Protocol
puffs: Pass-to-Userspace Framework File System su NetBSD
A filesystem is a protocol translator: it interprets incoming
requests and transforms them into a form suitable to store and
retrieve data.
Source: Antti Kantee, Send and Receive of File System Protocols
Hurd translators
A translator is simply a normal program acting as an object
server and participating in the Hurd's distributed virtual
filesystem.
Source: https://www.gnu.org/software/hurd/hurd/translator.html
It is so-called because it typically exports a filesystem
(although need not: cf. auth, proc and pfinet) and thus
translates object invocations into calls appropriate for the
backing store (e.g., ext2 filesystem, nfs server, etc.).
Source: https://www.gnu.org/software/hurd/hurd/translator.html
Another way of putting it is that it translates from one
representation of a data structure into another representation,
for example from the on-disk ext2 data layout to a traditional
filesystem hierarchy, or from a XML file to a virtual
hierarchical manifestation.
Source: https://www.gnu.org/software/hurd/hurd/translator.html
A translator is usually registered with a specific filesystem
node by using the settrans command.
Source: https://www.gnu.org/software/hurd/hurd/translator.html
Translators do not require any special privilege to run. The
privilege they require is simply that to access the indiviudal
resources they use.
Source: https://www.gnu.org/software/hurd/hurd/translator.html
FUSE
Filesystem in
Userspace
With FUSE it is possible to implement a fully functional
filesystem in a userspace program.
Source: http://fuse.sourceforge.net/
Autore Miklos Szeredi
Licenze GPL + LGPL
Features include...
simple library API
simple installation (no need to patch or recompile the kernel)
secure implementation
userspace-kernel interface is very efficient
usable by non privileged users
Source: http://fuse.sourceforge.net/
Interazione attraverso un file (ancora!): /dev/fuse.
FUSE is a userspace filesystem framework. It consists of a
kernel module (fuse.ko), a userspace library (libfuse.*) and a
mount utility (fusermount).
Source: http://fuse.sourceforge.net/doxygen/index.html
One of the most important features of FUSE is allowing
secure, non-privileged mounts. This opens up new possibilities
for the use of filesystems. A good example is sshfs: a secure
network filesystem using the sftp protocol.
Source: http://fuse.sourceforge.net/doxygen/index.html
Since the mount() system call is a privileged operation, a
helper program (fusermount) is needed, which is installed
setuid root.
Source: http://fuse.sourceforge.net/doxygen/index.html
Vocabolario
Userspace filesystem
A filesystem in which data and metadata are provided by an
ordinary userspace process. The filesystem can be accessed
normally through the kernel interface.
Source: http://fuse.sourceforge.net/doxygen/index.html
Filesystem daemon
The process(es) providing the data and metadata of the
filesystem.
Source: http://fuse.sourceforge.net/doxygen/index.html
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 mounting user.
Source: http://fuse.sourceforge.net/doxygen/index.html
Filesystem connection
A connection between the filesystem daemon and the kernel.
The connection exists until either the daemon dies, or the
filesystem is umounted.
Source: http://fuse.sourceforge.net/doxygen/index.html
Mount owner
The user who does the mounting.
Source: http://fuse.sourceforge.net/doxygen/index.html
User
The user who is performing filesystem operations.
Source: http://fuse.sourceforge.net/doxygen/index.html
hello.c
/*
FUSE: Filesystem in Userspace
Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
This program can be distributed under the terms of the GNU GPL.
See the file COPYING.
*/
#define FUSE_USE_VERSION 30
#include <fuse.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
static const char *hello_str = "Hello World!n";
static const char *hello_path = "/hello";
static int hello_getattr(const char *path, struct stat *stbuf)
{
int res = 0;
memset(stbuf, 0, sizeof(struct stat));
if (strcmp(path, "/") == 0) {
stbuf->st_mode = S_IFDIR | 0755;
stbuf->st_nlink = 2;
} else if (strcmp(path, hello_path) == 0) {
stbuf->st_mode = S_IFREG | 0444;
stbuf->st_nlink = 1;
stbuf->st_size = strlen(hello_str);
} else
res = -ENOENT;
return res;
}
static int hello_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
off_t offset, struct fuse_file_info *fi)
{
(void) offset;
(void) fi;
if (strcmp(path, "/") != 0)
return -ENOENT;
filler(buf, ".", NULL, 0);
filler(buf, "..", NULL, 0);
filler(buf, hello_path + 1, NULL, 0);
return 0;
}
static int hello_open(const char *path, struct fuse_file_info *fi)
{
if (strcmp(path, hello_path) != 0)
return -ENOENT;
if ((fi->flags & 3) != O_RDONLY)
return -EACCES;
return 0;
}
static int hello_read(const char *path, char *buf, size_t size, off_t offset,
struct fuse_file_info *fi)
{
size_t len;
(void) fi;
if(strcmp(path, hello_path) != 0)
return -ENOENT;
len = strlen(hello_str);
if (offset < len) {
if (offset + size > len)
size = len - offset;
memcpy(buf, hello_str + offset, size);
} else
size = 0;
return size;
}
static struct fuse_operations hello_oper = {
.getattr = hello_getattr,
.readdir = hello_readdir,
.open = hello_open,
.read = hello_read,
};
int main(int argc, char *argv[])
{
return fuse_main(argc, argv, &hello_oper, NULL);
}
Bestiario
CephFS
FUSE come vivaio, come coltura di giovani filesystem.
CephFS è nel kernel dalla versione 2.6.34.
Couchfuse
Couchfuse is a FUSE filesystem that exposes Couchdb
databases as filesystem folder.
Source: http://narkisr.github.io/couch-fuse/
elfs
A simple (FUSE) filesystem on top of ELF objects.
Autore: Guillaume Leconte
Source: https://github.com/pozdnychev/elfs
$ elfs `which fdup` /tmp/elf
$ ls -l /tmp/elf/
total 0
drw-r--r-- 1 root root 0 Jan 1 1970 header
drw-r--r-- 1 root root 0 Jan 1 1970 libs
drw-r--r-- 1 root root 0 Jan 1 1970 sections
estensione ad altri formati binari
astrazione dal formato
interfaccia verso exec()
etcd-fs
A replicated filesystem on top of etcd.
Autore: Jonathan Leibiusky
Source: https://github.com/xetorthio/etcd-fs
fusepy
Simple ctypes bindings for FUSE.
Autore: Terence Honles
Source: https://github.com/fusepy/fusepy
GlusterFS
GlusterFS is a scalable network filesystem. Using common
off-the-shelf hardware, you can create large, distributed
storage solutions for media streaming, data analysis, and other
data- and bandwidth-intensive tasks.
Source: http://www.gluster.org/
PNGdrive
PNG meets Steganography meets Fuse: the easiest way to have
plausible deniability.
Source: https://code.google.com/p/pngdrive/
WikipediaFS
WikipediaFS is a virtual filesystem which allows users to view
and edit Wikipedia articles as if they were real files on a local
disk drive.
Source: https://en.wikipedia.org/wiki/WikipediaFS
Colofóne
Presentazione composta con vim e Hovercraft! su Ubuntu Saucy.
Featuring Google Fonts: Libre Baskerville, Racing Sans One,
Satisfy.
exit()
Roberto Reale
https://robertoreale.me/linux-day-2015

More Related Content

What's hot

Unit 3
Unit  3Unit  3
Unit 3
siddr
 
The Linux Kernel Implementation of Pipes and FIFOs
The Linux Kernel Implementation of Pipes and FIFOsThe Linux Kernel Implementation of Pipes and FIFOs
The Linux Kernel Implementation of Pipes and FIFOs
Divye Kapoor
 
Unit 5 dwqb ans
Unit 5 dwqb ansUnit 5 dwqb ans
Unit 5 dwqb ans
Sowri Rajan
 
Java 7 - short intro to NIO.2
Java 7 - short intro to NIO.2Java 7 - short intro to NIO.2
Java 7 - short intro to NIO.2
Martijn Verburg
 
Unix Basics 04sp
Unix Basics 04spUnix Basics 04sp
Unix Basics 04sp
Dr.Ravi
 
Basic unix commands
Basic unix commandsBasic unix commands
Basic unix commands
srinivas damarla
 
Linux Introduction (Commands)
Linux Introduction (Commands)Linux Introduction (Commands)
Linux Introduction (Commands)
anandvaidya
 
Basic Multithreading using Posix Threads
Basic Multithreading using Posix ThreadsBasic Multithreading using Posix Threads
Basic Multithreading using Posix Threads
Tushar B Kute
 
Desktop Forensics: Windows
Desktop Forensics: WindowsDesktop Forensics: Windows
Desktop Forensics: Windows
Gol D Roger
 
Useful linux-commands
Useful linux-commandsUseful linux-commands
Useful linux-commands
Himani Singh
 
Perl Programming - 03 Programming File
Perl Programming - 03 Programming FilePerl Programming - 03 Programming File
Perl Programming - 03 Programming File
Danairat Thanabodithammachari
 
File handling in C
File handling in CFile handling in C
File handling in C
Kamal Acharya
 
Perl for System Automation - 01 Advanced File Processing
Perl for System Automation - 01 Advanced File ProcessingPerl for System Automation - 01 Advanced File Processing
Perl for System Automation - 01 Advanced File Processing
Danairat Thanabodithammachari
 
AOS Lab 2: Hello, xv6!
AOS Lab 2: Hello, xv6!AOS Lab 2: Hello, xv6!
AOS Lab 2: Hello, xv6!
Zubair Nabi
 
AOS Lab 1: Hello, Linux!
AOS Lab 1: Hello, Linux!AOS Lab 1: Hello, Linux!
AOS Lab 1: Hello, Linux!
Zubair Nabi
 
File handling in c
File  handling in cFile  handling in c
File handling in c
thirumalaikumar3
 
Programming in C Session 4
Programming in C Session 4Programming in C Session 4
Programming in C Session 4
Prerna Sharma
 
Concept of file handling in c
Concept of file handling in cConcept of file handling in c
Concept of file handling in c
MugdhaSharma11
 

What's hot (18)

Unit 3
Unit  3Unit  3
Unit 3
 
The Linux Kernel Implementation of Pipes and FIFOs
The Linux Kernel Implementation of Pipes and FIFOsThe Linux Kernel Implementation of Pipes and FIFOs
The Linux Kernel Implementation of Pipes and FIFOs
 
Unit 5 dwqb ans
Unit 5 dwqb ansUnit 5 dwqb ans
Unit 5 dwqb ans
 
Java 7 - short intro to NIO.2
Java 7 - short intro to NIO.2Java 7 - short intro to NIO.2
Java 7 - short intro to NIO.2
 
Unix Basics 04sp
Unix Basics 04spUnix Basics 04sp
Unix Basics 04sp
 
Basic unix commands
Basic unix commandsBasic unix commands
Basic unix commands
 
Linux Introduction (Commands)
Linux Introduction (Commands)Linux Introduction (Commands)
Linux Introduction (Commands)
 
Basic Multithreading using Posix Threads
Basic Multithreading using Posix ThreadsBasic Multithreading using Posix Threads
Basic Multithreading using Posix Threads
 
Desktop Forensics: Windows
Desktop Forensics: WindowsDesktop Forensics: Windows
Desktop Forensics: Windows
 
Useful linux-commands
Useful linux-commandsUseful linux-commands
Useful linux-commands
 
Perl Programming - 03 Programming File
Perl Programming - 03 Programming FilePerl Programming - 03 Programming File
Perl Programming - 03 Programming File
 
File handling in C
File handling in CFile handling in C
File handling in C
 
Perl for System Automation - 01 Advanced File Processing
Perl for System Automation - 01 Advanced File ProcessingPerl for System Automation - 01 Advanced File Processing
Perl for System Automation - 01 Advanced File Processing
 
AOS Lab 2: Hello, xv6!
AOS Lab 2: Hello, xv6!AOS Lab 2: Hello, xv6!
AOS Lab 2: Hello, xv6!
 
AOS Lab 1: Hello, Linux!
AOS Lab 1: Hello, Linux!AOS Lab 1: Hello, Linux!
AOS Lab 1: Hello, Linux!
 
File handling in c
File  handling in cFile  handling in c
File handling in c
 
Programming in C Session 4
Programming in C Session 4Programming in C Session 4
Programming in C Session 4
 
Concept of file handling in c
Concept of file handling in cConcept of file handling in c
Concept of file handling in c
 

Similar to All'ombra del Leviatano: Filesystem in Userspace

Unix-module3.pptx
Unix-module3.pptxUnix-module3.pptx
Unix-module3.pptx
ssuser8594b8
 
Unix operating system architecture with file structure
Unix operating system architecture with file structure Unix operating system architecture with file structure
Unix operating system architecture with file structure
amol_chavan
 
Lesson 2 Understanding Linux File System
Lesson 2 Understanding Linux File SystemLesson 2 Understanding Linux File System
Lesson 2 Understanding Linux File System
Sadia Bashir
 
Linux filesystemhierarchy
Linux filesystemhierarchyLinux filesystemhierarchy
Linux filesystemhierarchy
Dr. C.V. Suresh Babu
 
Host security
Host securityHost security
Host security
Nguyen Tam
 
Host security
Host securityHost security
Host security
Nguyen Tam
 
MODULE 3.1 updated-18cs56.pptx
MODULE 3.1 updated-18cs56.pptxMODULE 3.1 updated-18cs56.pptx
MODULE 3.1 updated-18cs56.pptx
ManasaPJ1
 
File management
File managementFile management
File management
Mohammed Sikander
 
18CS56-UP-Module 3.pptx
18CS56-UP-Module 3.pptx18CS56-UP-Module 3.pptx
18CS56-UP-Module 3.pptx
ChenamPawan
 
Linux fundamentals
Linux fundamentalsLinux fundamentals
Linux fundamentals
Raghu nath
 
Operating system
Operating systemOperating system
Operating system
HarshithaAllu
 
Introduction to Unix-like systems (Part I-IV)
Introduction to Unix-like systems (Part I-IV)Introduction to Unix-like systems (Part I-IV)
Introduction to Unix-like systems (Part I-IV)
hildenjohannes
 
brief intro to Linux device drivers
brief intro to Linux device driversbrief intro to Linux device drivers
brief intro to Linux device drivers
Alexandre Moreno
 
Tutorial 2
Tutorial 2Tutorial 2
Tutorial 2
tech2click
 
Linux
LinuxLinux
Linux introduction-commands2338
Linux introduction-commands2338Linux introduction-commands2338
Linux introduction-commands2338
Cam YP Co., Ltd
 
Linux introduction-commands2338
Linux introduction-commands2338Linux introduction-commands2338
Linux introduction-commands2338
Cam YP Co., Ltd
 
Linux file system
Linux file systemLinux file system
Linux file system
Md. Tanvir Hossain
 
linuxfilesystem-180727181106 (1).pdf
linuxfilesystem-180727181106 (1).pdflinuxfilesystem-180727181106 (1).pdf
linuxfilesystem-180727181106 (1).pdf
ShaswatSurya
 
Linux Systems Programming: File Handling
Linux Systems Programming: File HandlingLinux Systems Programming: File Handling
Linux Systems Programming: File Handling
RashidFaridChishti
 

Similar to All'ombra del Leviatano: Filesystem in Userspace (20)

Unix-module3.pptx
Unix-module3.pptxUnix-module3.pptx
Unix-module3.pptx
 
Unix operating system architecture with file structure
Unix operating system architecture with file structure Unix operating system architecture with file structure
Unix operating system architecture with file structure
 
Lesson 2 Understanding Linux File System
Lesson 2 Understanding Linux File SystemLesson 2 Understanding Linux File System
Lesson 2 Understanding Linux File System
 
Linux filesystemhierarchy
Linux filesystemhierarchyLinux filesystemhierarchy
Linux filesystemhierarchy
 
Host security
Host securityHost security
Host security
 
Host security
Host securityHost security
Host security
 
MODULE 3.1 updated-18cs56.pptx
MODULE 3.1 updated-18cs56.pptxMODULE 3.1 updated-18cs56.pptx
MODULE 3.1 updated-18cs56.pptx
 
File management
File managementFile management
File management
 
18CS56-UP-Module 3.pptx
18CS56-UP-Module 3.pptx18CS56-UP-Module 3.pptx
18CS56-UP-Module 3.pptx
 
Linux fundamentals
Linux fundamentalsLinux fundamentals
Linux fundamentals
 
Operating system
Operating systemOperating system
Operating system
 
Introduction to Unix-like systems (Part I-IV)
Introduction to Unix-like systems (Part I-IV)Introduction to Unix-like systems (Part I-IV)
Introduction to Unix-like systems (Part I-IV)
 
brief intro to Linux device drivers
brief intro to Linux device driversbrief intro to Linux device drivers
brief intro to Linux device drivers
 
Tutorial 2
Tutorial 2Tutorial 2
Tutorial 2
 
Linux
LinuxLinux
Linux
 
Linux introduction-commands2338
Linux introduction-commands2338Linux introduction-commands2338
Linux introduction-commands2338
 
Linux introduction-commands2338
Linux introduction-commands2338Linux introduction-commands2338
Linux introduction-commands2338
 
Linux file system
Linux file systemLinux file system
Linux file system
 
linuxfilesystem-180727181106 (1).pdf
linuxfilesystem-180727181106 (1).pdflinuxfilesystem-180727181106 (1).pdf
linuxfilesystem-180727181106 (1).pdf
 
Linux Systems Programming: File Handling
Linux Systems Programming: File HandlingLinux Systems Programming: File Handling
Linux Systems Programming: File Handling
 

More from Roberto Reale

eInvoicing adoption in Italy & CEF projects
eInvoicing adoption in Italy & CEF projectseInvoicing adoption in Italy & CEF projects
eInvoicing adoption in Italy & CEF projects
Roberto Reale
 
eProcurement governance: i nodi da sciogliere
eProcurement governance: i nodi da sciogliereeProcurement governance: i nodi da sciogliere
eProcurement governance: i nodi da sciogliere
Roberto Reale
 
Governing Information Security
Governing Information SecurityGoverning Information Security
Governing Information Security
Roberto Reale
 
Società Civile: diritto di accesso e sicurezza in rete
Società Civile: diritto di accesso e sicurezza in reteSocietà Civile: diritto di accesso e sicurezza in rete
Società Civile: diritto di accesso e sicurezza in rete
Roberto Reale
 
Tecnologie emergenti: opportunità, sfide, governance
Tecnologie emergenti: opportunità, sfide, governanceTecnologie emergenti: opportunità, sfide, governance
Tecnologie emergenti: opportunità, sfide, governance
Roberto Reale
 
Blockchain for Business
Blockchain for BusinessBlockchain for Business
Blockchain for Business
Roberto Reale
 
Politically correct. Sentiment analysis of Italian political texts
Politically correct. Sentiment analysis of Italian political textsPolitically correct. Sentiment analysis of Italian political texts
Politically correct. Sentiment analysis of Italian political texts
Roberto Reale
 
Beyond relational: «neural» DBMS?
Beyond relational: «neural» DBMS?Beyond relational: «neural» DBMS?
Beyond relational: «neural» DBMS?
Roberto Reale
 
La Strategia per la Crescita Digitale 2014-2020
La Strategia per la Crescita Digitale 2014-2020La Strategia per la Crescita Digitale 2014-2020
La Strategia per la Crescita Digitale 2014-2020
Roberto Reale
 
Homo Digitalis: Metamorfosi dell'identità
Homo Digitalis: Metamorfosi dell'identitàHomo Digitalis: Metamorfosi dell'identità
Homo Digitalis: Metamorfosi dell'identità
Roberto Reale
 
The History of Technological Anxiety and the Future of Economic Growth: Is Th...
The History of Technological Anxiety and the Future of Economic Growth: Is Th...The History of Technological Anxiety and the Future of Economic Growth: Is Th...
The History of Technological Anxiety and the Future of Economic Growth: Is Th...
Roberto Reale
 
Fog and the City: an urbanist's perspective
Fog and the City: an urbanist's perspectiveFog and the City: an urbanist's perspective
Fog and the City: an urbanist's perspective
Roberto Reale
 
The Unbearable Lightness: Extending the Bash shell
The Unbearable Lightness: Extending the Bash shellThe Unbearable Lightness: Extending the Bash shell
The Unbearable Lightness: Extending the Bash shell
Roberto Reale
 

More from Roberto Reale (13)

eInvoicing adoption in Italy & CEF projects
eInvoicing adoption in Italy & CEF projectseInvoicing adoption in Italy & CEF projects
eInvoicing adoption in Italy & CEF projects
 
eProcurement governance: i nodi da sciogliere
eProcurement governance: i nodi da sciogliereeProcurement governance: i nodi da sciogliere
eProcurement governance: i nodi da sciogliere
 
Governing Information Security
Governing Information SecurityGoverning Information Security
Governing Information Security
 
Società Civile: diritto di accesso e sicurezza in rete
Società Civile: diritto di accesso e sicurezza in reteSocietà Civile: diritto di accesso e sicurezza in rete
Società Civile: diritto di accesso e sicurezza in rete
 
Tecnologie emergenti: opportunità, sfide, governance
Tecnologie emergenti: opportunità, sfide, governanceTecnologie emergenti: opportunità, sfide, governance
Tecnologie emergenti: opportunità, sfide, governance
 
Blockchain for Business
Blockchain for BusinessBlockchain for Business
Blockchain for Business
 
Politically correct. Sentiment analysis of Italian political texts
Politically correct. Sentiment analysis of Italian political textsPolitically correct. Sentiment analysis of Italian political texts
Politically correct. Sentiment analysis of Italian political texts
 
Beyond relational: «neural» DBMS?
Beyond relational: «neural» DBMS?Beyond relational: «neural» DBMS?
Beyond relational: «neural» DBMS?
 
La Strategia per la Crescita Digitale 2014-2020
La Strategia per la Crescita Digitale 2014-2020La Strategia per la Crescita Digitale 2014-2020
La Strategia per la Crescita Digitale 2014-2020
 
Homo Digitalis: Metamorfosi dell'identità
Homo Digitalis: Metamorfosi dell'identitàHomo Digitalis: Metamorfosi dell'identità
Homo Digitalis: Metamorfosi dell'identità
 
The History of Technological Anxiety and the Future of Economic Growth: Is Th...
The History of Technological Anxiety and the Future of Economic Growth: Is Th...The History of Technological Anxiety and the Future of Economic Growth: Is Th...
The History of Technological Anxiety and the Future of Economic Growth: Is Th...
 
Fog and the City: an urbanist's perspective
Fog and the City: an urbanist's perspectiveFog and the City: an urbanist's perspective
Fog and the City: an urbanist's perspective
 
The Unbearable Lightness: Extending the Bash shell
The Unbearable Lightness: Extending the Bash shellThe Unbearable Lightness: Extending the Bash shell
The Unbearable Lightness: Extending the Bash shell
 

Recently uploaded

Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
Sven Peters
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
Rakesh Kumar R
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
Green Software Development
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 
What is Augmented Reality Image Tracking
What is Augmented Reality Image TrackingWhat is Augmented Reality Image Tracking
What is Augmented Reality Image Tracking
pavan998932
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
ICS
 
SMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API ServiceSMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API Service
Yara Milbes
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
kalichargn70th171
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise EditionWhy Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Envertis Software Solutions
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
TheSMSPoint
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
Hornet Dynamics
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
Ayan Halder
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
Remote DBA Services
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 

Recently uploaded (20)

Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 
What is Augmented Reality Image Tracking
What is Augmented Reality Image TrackingWhat is Augmented Reality Image Tracking
What is Augmented Reality Image Tracking
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
 
SMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API ServiceSMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API Service
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise EditionWhy Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 

All'ombra del Leviatano: Filesystem in Userspace

  • 1. Sabato 24 Ottobre 2015 #LDROMA15 http://lug.uniroma2.it/ld15/
  • 5. Die Dataien hat der liebe Gott gemacht, alles andere ist Menschenwerk. Source: Leopold Kronecker (apocrifo)
  • 6. file is the new byte
  • 7. All files are created equal. Source: Anonimo
  • 8. Everything is a file. Source: Anonimo
  • 9. All file systems are not created equal. Source: 11th USENIX Symposium on Operating Systems Design and Implementation (OSDI 14)
  • 11. For most users, the filesystem is the most visible aspect of an operating system. Source: Silberschatz & Galvin, Operating System Concepts, 7th ed.
  • 12. The filesystem consists of two distinct parts: a collection of files, each storing related data, and a directory structure, which organizes and provides information about all the files in the system. Source: Silberschatz & Galvin, Operating System Concepts, 7th ed.
  • 13. The most important job of UNIX is to provide a filesystem. Source: Ritchie & Thompson, The UNIX TimeSharing System
  • 14. A file contains whatever information the user places on it, for example symbolic or binary (object) programs. No particular structuring is expected by the system. Source: Ritchie & Thompson, The UNIX TimeSharing System
  • 15. A file does not exist within a particular directory; the directory entry for a file consists merely of its name and a pointer to the information actually describing the file. Source: Ritchie & Thompson, The UNIX TimeSharing System
  • 16. There is a threefold advantage in treating I/O devices this way: file and device I/O are as similar as possible; file and device names have the same syntax and meaning, so that a program expecting a file name as a parameter can be passed a device name; finally, special files are subject to the same protection mechanism as regular files. Source: Ritchie & Thompson, The UNIX TimeSharing System
  • 17. Perhaps paradoxically, the success of UNIX is largely due to the fact that it was not designed to meet any predefined objectives. Source: Ritchie & Thompson, The UNIX TimeSharing System
  • 19. The whole point with "everything is a file" is not that you have some random filename, but the fact that you can use common tools to operate on different things. Source: Linux Torvalds, 8 giugno 2002
  • 20. The UNIX philosophy is often quoted as "everything is a file", but that really means everything is a stream of bytes. Source: Linux Torvalds, 8 marzo 2007
  • 21. It should be just a "read()", and then people can use general libraries and treat all sources the same. Source: Linux Torvalds, 8 marzo 2007
  • 23. everything is a file ma il perimetro di cosa è un file non è flessible ad libitum
  • 24. il perimetro di cosa è un file è fissato dal kernel
  • 25. la sintassi e la semantica del filesystem sono fissate dal kernel
  • 27. VFS: oltre 65 mila righe di codice già nel 2008 Source: Galloway et al., Model-Checking the Linux Virtual File System
  • 30. l'utente non amministratore semplicemente non può
  • 31. ecce spes eius frustrabitur eum et videntibus cunctis praecipitabitur Source: Iob, 41, 1
  • 32. VFS
  • 33. Astrazione File: modello comune Strutture dati: superblock, inode, file, dentry Operazioni Object-oriented
  • 34. Implementazione Disk data structures Memory data structures Disk space management
  • 35. Precursori Earlier VFS implementations include Sun's VFS (in SunOS version 2.0, circa 1985) and IBM and Microsoft's "Installable File System" for IBM OS/2. Source: M. Tim Jones, Anatomy of the Linux virtual filesystem switch
  • 38. 9P: Plan 9 Filesystem Protocol
  • 39. puffs: Pass-to-Userspace Framework File System su NetBSD
  • 40. A filesystem is a protocol translator: it interprets incoming requests and transforms them into a form suitable to store and retrieve data. Source: Antti Kantee, Send and Receive of File System Protocols
  • 42. A translator is simply a normal program acting as an object server and participating in the Hurd's distributed virtual filesystem. Source: https://www.gnu.org/software/hurd/hurd/translator.html
  • 43. It is so-called because it typically exports a filesystem (although need not: cf. auth, proc and pfinet) and thus translates object invocations into calls appropriate for the backing store (e.g., ext2 filesystem, nfs server, etc.). Source: https://www.gnu.org/software/hurd/hurd/translator.html
  • 44. Another way of putting it is that it translates from one representation of a data structure into another representation, for example from the on-disk ext2 data layout to a traditional filesystem hierarchy, or from a XML file to a virtual hierarchical manifestation. Source: https://www.gnu.org/software/hurd/hurd/translator.html
  • 45. A translator is usually registered with a specific filesystem node by using the settrans command. Source: https://www.gnu.org/software/hurd/hurd/translator.html
  • 46. Translators do not require any special privilege to run. The privilege they require is simply that to access the indiviudal resources they use. Source: https://www.gnu.org/software/hurd/hurd/translator.html
  • 48.
  • 49. With FUSE it is possible to implement a fully functional filesystem in a userspace program. Source: http://fuse.sourceforge.net/
  • 53. simple installation (no need to patch or recompile the kernel)
  • 56. usable by non privileged users Source: http://fuse.sourceforge.net/
  • 57. Interazione attraverso un file (ancora!): /dev/fuse.
  • 58. FUSE is a userspace filesystem framework. It consists of a kernel module (fuse.ko), a userspace library (libfuse.*) and a mount utility (fusermount). Source: http://fuse.sourceforge.net/doxygen/index.html
  • 59. One of the most important features of FUSE is allowing secure, non-privileged mounts. This opens up new possibilities for the use of filesystems. A good example is sshfs: a secure network filesystem using the sftp protocol. Source: http://fuse.sourceforge.net/doxygen/index.html
  • 60. Since the mount() system call is a privileged operation, a helper program (fusermount) is needed, which is installed setuid root. Source: http://fuse.sourceforge.net/doxygen/index.html
  • 62. Userspace filesystem A filesystem in which data and metadata are provided by an ordinary userspace process. The filesystem can be accessed normally through the kernel interface. Source: http://fuse.sourceforge.net/doxygen/index.html
  • 63. Filesystem daemon The process(es) providing the data and metadata of the filesystem. Source: http://fuse.sourceforge.net/doxygen/index.html
  • 64. 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 mounting user. Source: http://fuse.sourceforge.net/doxygen/index.html
  • 65. Filesystem connection A connection between the filesystem daemon and the kernel. The connection exists until either the daemon dies, or the filesystem is umounted. Source: http://fuse.sourceforge.net/doxygen/index.html
  • 66. Mount owner The user who does the mounting. Source: http://fuse.sourceforge.net/doxygen/index.html
  • 67. User The user who is performing filesystem operations. Source: http://fuse.sourceforge.net/doxygen/index.html
  • 69. /* FUSE: Filesystem in Userspace Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu> This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #define FUSE_USE_VERSION 30 #include <fuse.h> #include <stdio.h> #include <string.h> #include <errno.h> #include <fcntl.h> static const char *hello_str = "Hello World!n"; static const char *hello_path = "/hello";
  • 70. static int hello_getattr(const char *path, struct stat *stbuf) { int res = 0; memset(stbuf, 0, sizeof(struct stat)); if (strcmp(path, "/") == 0) { stbuf->st_mode = S_IFDIR | 0755; stbuf->st_nlink = 2; } else if (strcmp(path, hello_path) == 0) { stbuf->st_mode = S_IFREG | 0444; stbuf->st_nlink = 1; stbuf->st_size = strlen(hello_str); } else res = -ENOENT; return res; }
  • 71. static int hello_readdir(const char *path, void *buf, fuse_fill_dir_t filler, off_t offset, struct fuse_file_info *fi) { (void) offset; (void) fi; if (strcmp(path, "/") != 0) return -ENOENT; filler(buf, ".", NULL, 0); filler(buf, "..", NULL, 0); filler(buf, hello_path + 1, NULL, 0); return 0; }
  • 72. static int hello_open(const char *path, struct fuse_file_info *fi) { if (strcmp(path, hello_path) != 0) return -ENOENT; if ((fi->flags & 3) != O_RDONLY) return -EACCES; return 0; }
  • 73. static int hello_read(const char *path, char *buf, size_t size, off_t offset, struct fuse_file_info *fi) { size_t len; (void) fi; if(strcmp(path, hello_path) != 0) return -ENOENT; len = strlen(hello_str); if (offset < len) { if (offset + size > len) size = len - offset; memcpy(buf, hello_str + offset, size); } else size = 0; return size; }
  • 74. static struct fuse_operations hello_oper = { .getattr = hello_getattr, .readdir = hello_readdir, .open = hello_open, .read = hello_read, };
  • 75. int main(int argc, char *argv[]) { return fuse_main(argc, argv, &hello_oper, NULL); }
  • 77. CephFS FUSE come vivaio, come coltura di giovani filesystem. CephFS è nel kernel dalla versione 2.6.34.
  • 78. Couchfuse Couchfuse is a FUSE filesystem that exposes Couchdb databases as filesystem folder. Source: http://narkisr.github.io/couch-fuse/
  • 79. elfs A simple (FUSE) filesystem on top of ELF objects. Autore: Guillaume Leconte Source: https://github.com/pozdnychev/elfs
  • 80. $ elfs `which fdup` /tmp/elf $ ls -l /tmp/elf/ total 0 drw-r--r-- 1 root root 0 Jan 1 1970 header drw-r--r-- 1 root root 0 Jan 1 1970 libs drw-r--r-- 1 root root 0 Jan 1 1970 sections
  • 81. estensione ad altri formati binari astrazione dal formato interfaccia verso exec()
  • 82. etcd-fs A replicated filesystem on top of etcd. Autore: Jonathan Leibiusky Source: https://github.com/xetorthio/etcd-fs
  • 83. fusepy Simple ctypes bindings for FUSE. Autore: Terence Honles Source: https://github.com/fusepy/fusepy
  • 84. GlusterFS GlusterFS is a scalable network filesystem. Using common off-the-shelf hardware, you can create large, distributed storage solutions for media streaming, data analysis, and other data- and bandwidth-intensive tasks. Source: http://www.gluster.org/
  • 85. PNGdrive PNG meets Steganography meets Fuse: the easiest way to have plausible deniability. Source: https://code.google.com/p/pngdrive/
  • 86. WikipediaFS WikipediaFS is a virtual filesystem which allows users to view and edit Wikipedia articles as if they were real files on a local disk drive. Source: https://en.wikipedia.org/wiki/WikipediaFS
  • 87. Colofóne Presentazione composta con vim e Hovercraft! su Ubuntu Saucy. Featuring Google Fonts: Libre Baskerville, Racing Sans One, Satisfy.