* [PATCH 0/5] 32-bit lseek and /dev/mem fixes/improvements @ 2019-02-04 14:46 Sascha Hauer 2019-02-04 14:46 ` [PATCH 1/5] fs: let truncate take a loff_t argument Sascha Hauer ` (5 more replies) 0 siblings, 6 replies; 9+ messages in thread From: Sascha Hauer @ 2019-02-04 14:46 UTC (permalink / raw) To: Barebox List; +Cc: Andrey Smirnov This series ontop of Andreys series (minus the patches that I have reverted) makes /dev/mem work for the whole 64bit address space without hopefully special casing too much. "fs: set errno in ftruncate()" and "fs: devfs: forbid truncation when cdev has no truncate operation" are not directly related, I stumbled upon these while working on the patches. See the full series in -next. Comments welcome, if somethings wrong with it we can still change. Sascha Sascha Hauer (5): fs: let truncate take a loff_t argument fs: set errno in ftruncate() fs: do not call truncate for FILE_SIZE_STREAM sized files fs: devfs: forbid truncation when cdev has no truncate operation misc: fix /dev/mem size drivers/misc/mem.c | 35 ++++++++++++++++++++++++++++++++--- fs/devfs.c | 8 ++------ fs/efi.c | 2 +- fs/efivarfs.c | 2 +- fs/fat/fat.c | 2 +- fs/fs.c | 7 ++++++- fs/nfs.c | 2 +- fs/omap4_usbbootfs.c | 2 +- fs/ramfs.c | 2 +- fs/ratpfs.c | 2 +- fs/smhfs.c | 2 +- fs/tftp.c | 2 +- include/fs.h | 2 +- 13 files changed, 50 insertions(+), 20 deletions(-) -- 2.20.1 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/5] fs: let truncate take a loff_t argument 2019-02-04 14:46 [PATCH 0/5] 32-bit lseek and /dev/mem fixes/improvements Sascha Hauer @ 2019-02-04 14:46 ` Sascha Hauer 2019-02-04 14:46 ` [PATCH 2/5] fs: set errno in ftruncate() Sascha Hauer ` (4 subsequent siblings) 5 siblings, 0 replies; 9+ messages in thread From: Sascha Hauer @ 2019-02-04 14:46 UTC (permalink / raw) To: Barebox List; +Cc: Andrey Smirnov loff_t is the correct type for file sizes. Use it to allow to truncate to sizes bigger than 32bit. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- fs/devfs.c | 2 +- fs/efi.c | 2 +- fs/efivarfs.c | 2 +- fs/fat/fat.c | 2 +- fs/nfs.c | 2 +- fs/omap4_usbbootfs.c | 2 +- fs/ramfs.c | 2 +- fs/ratpfs.c | 2 +- fs/smhfs.c | 2 +- fs/tftp.c | 2 +- include/fs.h | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/fs/devfs.c b/fs/devfs.c index 007dea96d8..aa44e32613 100644 --- a/fs/devfs.c +++ b/fs/devfs.c @@ -168,7 +168,7 @@ static int devfs_ioctl(struct device_d *_dev, FILE *f, int request, void *buf) return cdev_ioctl(cdev, request, buf); } -static int devfs_truncate(struct device_d *dev, FILE *f, ulong size) +static int devfs_truncate(struct device_d *dev, FILE *f, loff_t size) { struct cdev *cdev = f->priv; diff --git a/fs/efi.c b/fs/efi.c index cd4fee79a1..81c1ffe078 100644 --- a/fs/efi.c +++ b/fs/efi.c @@ -305,7 +305,7 @@ static int efifs_lseek(struct device_d *dev, FILE *f, loff_t pos) return 0; } -static int efifs_truncate(struct device_d *dev, FILE *f, unsigned long size) +static int efifs_truncate(struct device_d *dev, FILE *f, loff_t size) { struct efifs_file *ufile = f->priv; efi_status_t efiret; diff --git a/fs/efivarfs.c b/fs/efivarfs.c index d2615774e3..a911eac3bf 100644 --- a/fs/efivarfs.c +++ b/fs/efivarfs.c @@ -288,7 +288,7 @@ static int efivarfs_write(struct device_d *_dev, FILE *f, const void *buf, size_ return insize; } -static int efivarfs_truncate(struct device_d *dev, FILE *f, ulong size) +static int efivarfs_truncate(struct device_d *dev, FILE *f, loff_t size) { struct efivars_file *efile = f->priv; efi_status_t efiret; diff --git a/fs/fat/fat.c b/fs/fat/fat.c index 1367577723..394c75ffc4 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -177,7 +177,7 @@ static int fat_write(struct device_d *_dev, FILE *f, const void *buf, size_t ins return outsize; } -static int fat_truncate(struct device_d *dev, FILE *f, ulong size) +static int fat_truncate(struct device_d *dev, FILE *f, loff_t size) { FIL *f_file = f->priv; unsigned long lastofs; diff --git a/fs/nfs.c b/fs/nfs.c index c58fca78e5..43476d1c35 100644 --- a/fs/nfs.c +++ b/fs/nfs.c @@ -928,7 +928,7 @@ static void nfs_handler(void *ctx, char *packet, unsigned len) nfs_len = len; } -static int nfs_truncate(struct device_d *dev, FILE *f, ulong size) +static int nfs_truncate(struct device_d *dev, FILE *f, loff_t size) { return -ENOSYS; } diff --git a/fs/omap4_usbbootfs.c b/fs/omap4_usbbootfs.c index cc33287b95..169cde7ddb 100644 --- a/fs/omap4_usbbootfs.c +++ b/fs/omap4_usbbootfs.c @@ -57,7 +57,7 @@ static int omap4_usbbootfs_write( return -ENOSYS; } -static int omap4_usbbootfs_truncate(struct device_d *dev, FILE *f, ulong size) +static int omap4_usbbootfs_truncate(struct device_d *dev, FILE *f, loff_t size) { return -ENOSYS; } diff --git a/fs/ramfs.c b/fs/ramfs.c index 153b9b614b..4fba40d313 100644 --- a/fs/ramfs.c +++ b/fs/ramfs.c @@ -347,7 +347,7 @@ static int ramfs_write(struct device_d *_dev, FILE *f, const void *buf, size_t i return insize; } -static int ramfs_truncate(struct device_d *dev, FILE *f, ulong size) +static int ramfs_truncate(struct device_d *dev, FILE *f, loff_t size) { struct inode *inode = f->f_inode; struct ramfs_inode *node = to_ramfs_inode(inode); diff --git a/fs/ratpfs.c b/fs/ratpfs.c index dffd276541..b6857c6016 100644 --- a/fs/ratpfs.c +++ b/fs/ratpfs.c @@ -77,7 +77,7 @@ static int ratpfs_rm(struct device_d __always_unused *dev, } static int ratpfs_truncate(struct device_d __always_unused *dev, - FILE *f, ulong size) + FILE *f, loff_t size) { int len_tx = 1 /* type */ + 4 /* handle */ diff --git a/fs/smhfs.c b/fs/smhfs.c index 7a6933630c..2e99b05979 100644 --- a/fs/smhfs.c +++ b/fs/smhfs.c @@ -56,7 +56,7 @@ static int smhfs_rm(struct device_d __always_unused *dev, static int smhfs_truncate(struct device_d __always_unused *dev, FILE __always_unused *f, - ulong __always_unused size) + loff_t __always_unused size) { return 0; } diff --git a/fs/tftp.c b/fs/tftp.c index 41f904f29f..43293272d7 100644 --- a/fs/tftp.c +++ b/fs/tftp.c @@ -93,7 +93,7 @@ struct tftp_priv { IPaddr_t server; }; -static int tftp_truncate(struct device_d *dev, FILE *f, ulong size) +static int tftp_truncate(struct device_d *dev, FILE *f, loff_t size) { return 0; } diff --git a/include/fs.h b/include/fs.h index 68b6380bc6..aa23bcc228 100644 --- a/include/fs.h +++ b/include/fs.h @@ -46,7 +46,7 @@ struct fs_driver_d { int (*unlink)(struct device_d *dev, const char *pathname); /* Truncate a file to given size */ - int (*truncate)(struct device_d *dev, FILE *f, ulong size); + int (*truncate)(struct device_d *dev, FILE *f, loff_t size); int (*open)(struct device_d *dev, FILE *f, const char *pathname); int (*close)(struct device_d *dev, FILE *f); -- 2.20.1 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/5] fs: set errno in ftruncate() 2019-02-04 14:46 [PATCH 0/5] 32-bit lseek and /dev/mem fixes/improvements Sascha Hauer 2019-02-04 14:46 ` [PATCH 1/5] fs: let truncate take a loff_t argument Sascha Hauer @ 2019-02-04 14:46 ` Sascha Hauer 2019-02-04 14:46 ` [PATCH 3/5] fs: do not call truncate for FILE_SIZE_STREAM sized files Sascha Hauer ` (3 subsequent siblings) 5 siblings, 0 replies; 9+ messages in thread From: Sascha Hauer @ 2019-02-04 14:46 UTC (permalink / raw) To: Barebox List; +Cc: Andrey Smirnov ftruncate needs to set errno correctly on error. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- fs/fs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/fs.c b/fs/fs.c index 4ec9c7a842..c5b17e158a 100644 --- a/fs/fs.c +++ b/fs/fs.c @@ -216,8 +216,10 @@ int ftruncate(int fd, loff_t length) fsdrv = f->fsdev->driver; ret = fsdrv->truncate(&f->fsdev->dev, f, length); - if (ret) + if (ret) { + errno = -ret; return ret; + } f->size = length; -- 2.20.1 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 3/5] fs: do not call truncate for FILE_SIZE_STREAM sized files 2019-02-04 14:46 [PATCH 0/5] 32-bit lseek and /dev/mem fixes/improvements Sascha Hauer 2019-02-04 14:46 ` [PATCH 1/5] fs: let truncate take a loff_t argument Sascha Hauer 2019-02-04 14:46 ` [PATCH 2/5] fs: set errno in ftruncate() Sascha Hauer @ 2019-02-04 14:46 ` Sascha Hauer 2019-02-04 14:46 ` [PATCH 4/5] fs: devfs: forbid truncation when cdev has no truncate operation Sascha Hauer ` (2 subsequent siblings) 5 siblings, 0 replies; 9+ messages in thread From: Sascha Hauer @ 2019-02-04 14:46 UTC (permalink / raw) To: Barebox List; +Cc: Andrey Smirnov open_and_lseek() increases the file size when the file is opened in write mode and scrolled past the files end. This fails badly on /dev/mem because loff_t which we use for the file size is signed variable, which is used as an unsigned variable in /dev/mem. To catch this case do not try to truncate FILE_SIZE_STREAM sized files. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- fs/fs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/fs.c b/fs/fs.c index c5b17e158a..1374286e62 100644 --- a/fs/fs.c +++ b/fs/fs.c @@ -213,6 +213,9 @@ int ftruncate(int fd, loff_t length) f = &files[fd]; + if (f->size == FILE_SIZE_STREAM) + return 0; + fsdrv = f->fsdev->driver; ret = fsdrv->truncate(&f->fsdev->dev, f, length); -- 2.20.1 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 4/5] fs: devfs: forbid truncation when cdev has no truncate operation 2019-02-04 14:46 [PATCH 0/5] 32-bit lseek and /dev/mem fixes/improvements Sascha Hauer ` (2 preceding siblings ...) 2019-02-04 14:46 ` [PATCH 3/5] fs: do not call truncate for FILE_SIZE_STREAM sized files Sascha Hauer @ 2019-02-04 14:46 ` Sascha Hauer 2019-02-04 14:46 ` [PATCH 5/5] misc: fix /dev/mem size Sascha Hauer 2019-02-05 21:44 ` [PATCH 0/5] 32-bit lseek and /dev/mem fixes/improvements Andrey Smirnov 5 siblings, 0 replies; 9+ messages in thread From: Sascha Hauer @ 2019-02-04 14:46 UTC (permalink / raw) To: Barebox List; +Cc: Andrey Smirnov When a cdev doesn't have a truncate callback then forbid truncation and fail with -EPERM. Before this we had always failed with -ENOSPC in this situation. We checked for f->fsdev->dev.num_resources being nonzero, but this check was absolutely meaningless. It goes back to ancient times when the resources of a device were automatically added to devfs. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- fs/devfs.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/fs/devfs.c b/fs/devfs.c index aa44e32613..a7400df1c5 100644 --- a/fs/devfs.c +++ b/fs/devfs.c @@ -175,11 +175,7 @@ static int devfs_truncate(struct device_d *dev, FILE *f, loff_t size) if (cdev->ops->truncate) return cdev->ops->truncate(cdev, size); - if (f->fsdev->dev.num_resources < 1) - return -ENOSPC; - if (size > resource_size(&f->fsdev->dev.resource[0])) - return -ENOSPC; - return 0; + return -EPERM; } static struct inode *devfs_alloc_inode(struct super_block *sb) -- 2.20.1 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 5/5] misc: fix /dev/mem size 2019-02-04 14:46 [PATCH 0/5] 32-bit lseek and /dev/mem fixes/improvements Sascha Hauer ` (3 preceding siblings ...) 2019-02-04 14:46 ` [PATCH 4/5] fs: devfs: forbid truncation when cdev has no truncate operation Sascha Hauer @ 2019-02-04 14:46 ` Sascha Hauer 2019-02-05 21:44 ` [PATCH 0/5] 32-bit lseek and /dev/mem fixes/improvements Andrey Smirnov 5 siblings, 0 replies; 9+ messages in thread From: Sascha Hauer @ 2019-02-04 14:46 UTC (permalink / raw) To: Barebox List; +Cc: Andrey Smirnov The size of /dev/mem was limited to the lower half of the 64bit address range. This is unfortunate since on some architectures (MIPS64, namely) the upper half contains meaningful addresses. We can't just set /dev/mem to its real size since that's bigger than the maximum loff_t. Set the DEVFS_IS_CHARACTER_DEV flag instead for /dev/mem which will cause the size checks in lseek and friends to be bypassed. Also fix the size the memory device is registered with. We used to set the size to ~0, but the real size is one higher. To do this explicitly register the device with specifying the end address rather than the size. This will make /dev/mem appear with filesize 0, but so does /dev/zero already. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- drivers/misc/mem.c | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/drivers/misc/mem.c b/drivers/misc/mem.c index 60981a3e98..6dd7f687c9 100644 --- a/drivers/misc/mem.c +++ b/drivers/misc/mem.c @@ -21,8 +21,18 @@ static int mem_probe(struct device_d *dev) dev->priv = cdev; cdev->name = (char*)dev->resource[0].name; - cdev->size = min_t(unsigned long long, resource_size(&dev->resource[0]), - S64_MAX); + if (dev->resource[0].start == 0 && dev->resource[0].end == ~0) { + /* + * Special case for /dev/mem. We can't express it's size as it's + * outside of our address range. Set DEVFS_IS_CHARACTER_DEV to + * bypass size checks. + */ + cdev->size = 0; + cdev->flags = DEVFS_IS_CHARACTER_DEV; + } else { + cdev->size = resource_size(&dev->resource[0]); + } + cdev->ops = &memops; cdev->dev = dev; @@ -38,7 +48,26 @@ static struct driver_d mem_drv = { static int mem_init(void) { - add_mem_device("mem", 0, ~0, IORESOURCE_MEM_WRITEABLE); + struct device_d *dev; + struct resource res = { + .start = 0, + .end = ~0, + .flags = IORESOURCE_MEM, + .name = "mem", + }; + int ret; + + dev = device_alloc("mem", DEVICE_ID_DYNAMIC); + if (!dev) + return -ENOMEM; + + dev->resource = xmemdup(&res, sizeof(res)); + dev->num_resources = 1; + + ret = platform_device_register(dev); + if (ret) + return ret; + return platform_driver_register(&mem_drv); } device_initcall(mem_init); -- 2.20.1 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/5] 32-bit lseek and /dev/mem fixes/improvements 2019-02-04 14:46 [PATCH 0/5] 32-bit lseek and /dev/mem fixes/improvements Sascha Hauer ` (4 preceding siblings ...) 2019-02-04 14:46 ` [PATCH 5/5] misc: fix /dev/mem size Sascha Hauer @ 2019-02-05 21:44 ` Andrey Smirnov 2019-02-06 7:33 ` Sascha Hauer 5 siblings, 1 reply; 9+ messages in thread From: Andrey Smirnov @ 2019-02-05 21:44 UTC (permalink / raw) To: Sascha Hauer; +Cc: Barebox List On Mon, Feb 4, 2019 at 6:46 AM Sascha Hauer <s.hauer@pengutronix.de> wrote: > > This series ontop of Andreys series (minus the patches that I have > reverted) makes /dev/mem work for the whole 64bit address space without > hopefully special casing too much. "fs: set errno in ftruncate()" and > "fs: devfs: forbid truncation when cdev has no truncate operation" are > not directly related, I stumbled upon these while working on the > patches. > > See the full series in -next. Comments welcome, if somethings wrong with > it we can still change. > Not sure why, but the following patches: "fs: Report actual data processed by mem_copy()" "fs: Share code between mem_write()/mem_read()" appear to be missing and, as a result: "fs: Avoid division in mem_copy()" doesn't actually have mem_copy() function in it. Did the two patches above just slipped through the cracks or was there a particular reason you dropped them? Thanks, Andrey Smirnov _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/5] 32-bit lseek and /dev/mem fixes/improvements 2019-02-05 21:44 ` [PATCH 0/5] 32-bit lseek and /dev/mem fixes/improvements Andrey Smirnov @ 2019-02-06 7:33 ` Sascha Hauer 2019-02-06 7:37 ` Andrey Smirnov 0 siblings, 1 reply; 9+ messages in thread From: Sascha Hauer @ 2019-02-06 7:33 UTC (permalink / raw) To: Andrey Smirnov; +Cc: Barebox List On Tue, Feb 05, 2019 at 01:44:31PM -0800, Andrey Smirnov wrote: > On Mon, Feb 4, 2019 at 6:46 AM Sascha Hauer <s.hauer@pengutronix.de> wrote: > > > > This series ontop of Andreys series (minus the patches that I have > > reverted) makes /dev/mem work for the whole 64bit address space without > > hopefully special casing too much. "fs: set errno in ftruncate()" and > > "fs: devfs: forbid truncation when cdev has no truncate operation" are > > not directly related, I stumbled upon these while working on the > > patches. > > > > See the full series in -next. Comments welcome, if somethings wrong with > > it we can still change. > > > > Not sure why, but the following patches: > > "fs: Report actual data processed by mem_copy()" > "fs: Share code between mem_write()/mem_read()" I applied these two now (although squashed into a single commit)... > > appear to be missing and, as a result: > > "fs: Avoid division in mem_copy()" ...and rewrote this commit message. > > doesn't actually have mem_copy() function in it. Did the two patches > above just slipped through the cracks or was there a particular reason > you dropped them? I thought they wouldn't apply anymore, but I was mistaken. Indeed they do apply. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/5] 32-bit lseek and /dev/mem fixes/improvements 2019-02-06 7:33 ` Sascha Hauer @ 2019-02-06 7:37 ` Andrey Smirnov 0 siblings, 0 replies; 9+ messages in thread From: Andrey Smirnov @ 2019-02-06 7:37 UTC (permalink / raw) To: Sascha Hauer; +Cc: Barebox List On Tue, Feb 5, 2019 at 11:33 PM Sascha Hauer <s.hauer@pengutronix.de> wrote: > > On Tue, Feb 05, 2019 at 01:44:31PM -0800, Andrey Smirnov wrote: > > On Mon, Feb 4, 2019 at 6:46 AM Sascha Hauer <s.hauer@pengutronix.de> wrote: > > > > > > This series ontop of Andreys series (minus the patches that I have > > > reverted) makes /dev/mem work for the whole 64bit address space without > > > hopefully special casing too much. "fs: set errno in ftruncate()" and > > > "fs: devfs: forbid truncation when cdev has no truncate operation" are > > > not directly related, I stumbled upon these while working on the > > > patches. > > > > > > See the full series in -next. Comments welcome, if somethings wrong with > > > it we can still change. > > > > > > > Not sure why, but the following patches: > > > > "fs: Report actual data processed by mem_copy()" > > "fs: Share code between mem_write()/mem_read()" > > I applied these two now (although squashed into a single commit)... > > > > > appear to be missing and, as a result: > > > > "fs: Avoid division in mem_copy()" > > ...and rewrote this commit message. > > > > > doesn't actually have mem_copy() function in it. Did the two patches > > above just slipped through the cracks or was there a particular reason > > you dropped them? > > I thought they wouldn't apply anymore, but I was mistaken. Indeed they > do apply. OK, cool, good to hear they are back! Thanks, Andrey Smirnov _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2019-02-06 7:37 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2019-02-04 14:46 [PATCH 0/5] 32-bit lseek and /dev/mem fixes/improvements Sascha Hauer 2019-02-04 14:46 ` [PATCH 1/5] fs: let truncate take a loff_t argument Sascha Hauer 2019-02-04 14:46 ` [PATCH 2/5] fs: set errno in ftruncate() Sascha Hauer 2019-02-04 14:46 ` [PATCH 3/5] fs: do not call truncate for FILE_SIZE_STREAM sized files Sascha Hauer 2019-02-04 14:46 ` [PATCH 4/5] fs: devfs: forbid truncation when cdev has no truncate operation Sascha Hauer 2019-02-04 14:46 ` [PATCH 5/5] misc: fix /dev/mem size Sascha Hauer 2019-02-05 21:44 ` [PATCH 0/5] 32-bit lseek and /dev/mem fixes/improvements Andrey Smirnov 2019-02-06 7:33 ` Sascha Hauer 2019-02-06 7:37 ` Andrey Smirnov
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox