Skip to content

Commit

Permalink
shmem: unexport shmem_add_seals()/shmem_get_seals()
Browse files Browse the repository at this point in the history
Patch series "memfd: add sealing to hugetlb-backed memory", v3.

Recently, Mike Kravetz added hugetlbfs support to memfd.  However, he
didn't add sealing support.  One of the reasons to use memfd is to have
shared memory sealing when doing IPC or sharing memory with another
process with some extra safety.  qemu uses shared memory & hugetables
with vhost-user (used by dpdk), so it is reasonable to use memfd now
instead for convenience and security reasons.

This patch (of 9):

The functions are called through shmem_fcntl() only.  And no danger in
removing the EXPORTs as the routines only work with shmem file structs.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Mike Kravetz <[email protected]>
Cc: Andrea Arcangeli <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: David Herrmann <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
elmarco authored and torvalds committed Feb 1, 2018
1 parent ab8928b commit e9d586a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 0 additions & 2 deletions include/linux/shmem_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,6 @@ extern void shmem_uncharge(struct inode *inode, long pages);

#ifdef CONFIG_TMPFS

extern int shmem_add_seals(struct file *file, unsigned int seals);
extern int shmem_get_seals(struct file *file);
extern long shmem_fcntl(struct file *file, unsigned int cmd, unsigned long arg);

#else
Expand Down
6 changes: 2 additions & 4 deletions mm/shmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -2722,7 +2722,7 @@ static int shmem_wait_for_pins(struct address_space *mapping)
F_SEAL_GROW | \
F_SEAL_WRITE)

int shmem_add_seals(struct file *file, unsigned int seals)
static int shmem_add_seals(struct file *file, unsigned int seals)
{
struct inode *inode = file_inode(file);
struct shmem_inode_info *info = SHMEM_I(inode);
Expand Down Expand Up @@ -2791,16 +2791,14 @@ int shmem_add_seals(struct file *file, unsigned int seals)
inode_unlock(inode);
return error;
}
EXPORT_SYMBOL_GPL(shmem_add_seals);

int shmem_get_seals(struct file *file)
static int shmem_get_seals(struct file *file)
{
if (file->f_op != &shmem_file_operations)
return -EINVAL;

return SHMEM_I(file_inode(file))->seals;
}
EXPORT_SYMBOL_GPL(shmem_get_seals);

long shmem_fcntl(struct file *file, unsigned int cmd, unsigned long arg)
{
Expand Down

0 comments on commit e9d586a

Please sign in to comment.