VFS: turn no_llseek into the default
Subsystems (28)
Arnd Bergmann
maintainercover VFS: turn no_llseek into the default
As I promised to Christoph Hellwig, this series changes the default action for sys_llseek from the traditional default_llseek to no_llseek, disallowing users to seek files without a seek operation, which is much more logical.
At the same time, this series makes it obvious that the remaining users of the now explicitly used default_llseek function do not require the big kernel lock and we can consequently replace it with i_mutex.
The bulk of the necessary changes is adding a .llseek pointer to each and every file_operation in the kernel using a coccinelle semantic patch (patch 16 here). The semantic patch only changes those cases that it can prove to have an obviously correct replacement operation, see the patch description for the detailed rules it uses.
The remaining patches here are for the cases that the semantic patch did not have an answer for or that it did not find because it was hidden in macros or in unexpected coding style.
I am confident that I have covered all users in the current mainline kernel, but new file_operations are already part of linux-next, so the same semantic patch needs to be applied to those.
The diffstat below intentionally covers only the changes I did manually, leaving out patch 16.
Arnd
Arnd Bergmann (18):
drm: use noop_llseek
net/wireless: use generic_file_llseek in debugfs
lkdtm: use generic_file_llseek in debugfs ib/qib: use generic_file_llseek arm/omap: use generic_file_llseek in iommu_debug
spufs: use llseek in all file operations
staging: use llseek in all file operations
selinux: use generic_file_llseek
tracing: use generic_file_llseek for debugfs
ibmasmfs: use generic_file_llseek
oprofile: make event buffer nonseekable
raw: use explicit llseek file operations ima: use generic_file_llseek for securityfs irda/irnet: use noop_llseek viotape: use noop_llseek llseek: automatically add .llseek fop vfs: don't use BKL in default_llseek vfs: make no_llseek the default
Documentation/DocBook/drm.tmpl | 1 arch/arm/plat-omap/iommu-debug.c | 2 arch/powerpc/platforms/cell/spufs/file.c | 24 ++++++++-- drivers/char/raw.c | 2 drivers/char/viotape.c | 1 drivers/gpu/drm/i810/i810_drv.c | 1 drivers/gpu/drm/i830/i830_drv.c | 1 drivers/gpu/drm/i915/i915_drv.c | 1 drivers/gpu/drm/mga/mga_drv.c | 1 drivers/gpu/drm/nouveau/nouveau_drv.c | 1 drivers/gpu/drm/r128/r128_drv.c | 1 drivers/gpu/drm/radeon/radeon_drv.c | 1 drivers/gpu/drm/savage/savage_drv.c | 1 drivers/gpu/drm/sis/sis_drv.c | 1 drivers/gpu/drm/tdfx/tdfx_drv.c | 1 drivers/gpu/drm/via/via_drv.c | 1 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 1 drivers/infiniband/hw/qib/qib_fs.c | 18 +++---- drivers/misc/ibmasm/ibmasmfs.c | 4 + drivers/misc/iwmc3200top/debugfs.c | 3 + drivers/misc/lkdtm.c | 9 +++ drivers/net/wireless/b43/debugfs.c | 1 drivers/net/wireless/b43legacy/debugfs.c | 1 drivers/net/wireless/iwlwifi/iwl-debugfs.c | 3 + drivers/net/wireless/libertas/debugfs.c | 1 drivers/net/wireless/rt2x00/rt2x00debug.c | 1 drivers/net/wireless/wl12xx/wl1251_debugfs.c | 2 drivers/net/wireless/wl12xx/wl1271_debugfs.c | 2 drivers/oprofile/event_buffer.c | 3 - drivers/staging/msm/mdp4_debugfs.c | 10 ---- drivers/staging/panel/panel.c | 3 - fs/read_write.c | 5 -- kernel/trace/trace.c | 15 ++++++ net/irda/irnet/irnet_ppp.h | 1 net/mac80211/debugfs.c | 2 net/mac80211/debugfs_key.c | 2 net/mac80211/debugfs_netdev.c | 1 net/mac80211/debugfs_sta.c | 2 net/wireless/debugfs.c | 1 security/integrity/ima/ima_fs.c | 9 ++- security/selinux/selinuxfs.c | 16 ++++++ 41 files changed, 129 insertions(+), 28 deletions(-)
Arnd Bergmann
maintainerPATCH 1/18 drm: use noop_llseek
The drm device drivers currently allow seeking on the character device but never care about the actual file position.
When we change the default llseek operation to be no_llseek, calling llseek on a drm device would return an error condition, which is an API change.
Explicitly setting noop_llseek lets us keep the current API.
--- Documentation/DocBook/drm.tmpl | 1 + drivers/gpu/drm/i810/i810_drv.c | 1 + drivers/gpu/drm/i830/i830_drv.c | 1 + drivers/gpu/drm/i915/i915_drv.c | 1 + drivers/gpu/drm/mga/mga_drv.c | 1 + drivers/gpu/drm/nouveau/nouveau_drv.c | 1 + drivers/gpu/drm/r128/r128_drv.c | 1 + drivers/gpu/drm/radeon/radeon_drv.c | 1 + drivers/gpu/drm/savage/savage_drv.c | 1 + drivers/gpu/drm/sis/sis_drv.c | 1 + drivers/gpu/drm/tdfx/tdfx_drv.c | 1 + drivers/gpu/drm/via/via_drv.c | 1 + drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 1 + 13 files changed, 13 insertions(+), 0 deletions(-)
Documentation/DocBook/drm.tmpl +1 -0
@@ -136,6 +136,7 @@ #ifdef CONFIG_COMPAT .compat_ioctl = i915_compat_ioctl, #endif + .llseek = noop_llseek, }, .pci_driver = { .name = DRIVER_NAME,
drivers/gpu/drm/i810/i810_drv.c +1 -0
@@ -63,6 +63,7 @@ static struct drm_driver driver = { .mmap = drm_mmap, .poll = drm_poll, .fasync = drm_fasync, + .llseek = noop_llseek, }, .pci_driver = {
drivers/gpu/drm/i830/i830_drv.c +1 -0
@@ -74,6 +74,7 @@ static struct drm_driver driver = { .mmap = drm_mmap, .poll = drm_poll, .fasync = drm_fasync, + .llseek = noop_llseek, }, .pci_driver = {
drivers/gpu/drm/i915/i915_drv.c +1 -0
@@ -547,6 +547,7 @@ static struct drm_driver driver = {#ifdef CONFIG_COMPAT .compat_ioctl = i915_compat_ioctl, #endif + .llseek = noop_llseek, }, .pci_driver = {
drivers/gpu/drm/mga/mga_drv.c +1 -0
@@ -75,6 +75,7 @@ static struct drm_driver driver = { #ifdef CONFIG_COMPAT .compat_ioctl = mga_compat_ioctl, #endif + .llseek = noop_llseek, }, .pci_driver = { .name = DRIVER_NAME,
drivers/gpu/drm/nouveau/nouveau_drv.c +1 -0
@@ -400,6 +400,7 @@ static struct drm_driver driver = { #if defined(CONFIG_COMPAT) .compat_ioctl = nouveau_compat_ioctl, #endif + .llseek = noop_llseek, }, .pci_driver = { .name = DRIVER_NAME,
drivers/gpu/drm/r128/r128_drv.c +1 -0
@@ -71,6 +71,7 @@ static struct drm_driver driver = { #ifdef CONFIG_COMPAT .compat_ioctl = r128_compat_ioctl, #endif + .llseek = noop_llseek, }, .pci_driver = { .name = DRIVER_NAME,
drivers/gpu/drm/radeon/radeon_drv.c +1 -0
@@ -218,6 +218,7 @@ static struct drm_driver driver_old = {#ifdef CONFIG_COMPAT .compat_ioctl = radeon_compat_ioctl, #endif + .llseek = noop_llseek, }, .pci_driver = {
drivers/gpu/drm/savage/savage_drv.c +1 -0
@@ -54,6 +54,7 @@ static struct drm_driver driver = { .mmap = drm_mmap, .poll = drm_poll, .fasync = drm_fasync, + .llseek = noop_llseek, }, .pci_driver = {
drivers/gpu/drm/sis/sis_drv.c +1 -0
@@ -84,6 +84,7 @@ static struct drm_driver driver = { .mmap = drm_mmap, .poll = drm_poll, .fasync = drm_fasync, + .llseek = noop_llseek, }, .pci_driver = { .name = DRIVER_NAME,
drivers/gpu/drm/tdfx/tdfx_drv.c +1 -0
@@ -52,6 +52,7 @@ static struct drm_driver driver = { .mmap = drm_mmap, .poll = drm_poll, .fasync = drm_fasync, + .llseek = noop_llseek, }, .pci_driver = { .name = DRIVER_NAME,
drivers/gpu/drm/via/via_drv.c +1 -0
@@ -62,6 +62,7 @@ static struct drm_driver driver = { .mmap = drm_mmap, .poll = drm_poll, .fasync = drm_fasync, + .llseek = noop_llseek, }, .pci_driver = { .name = DRIVER_NAME,
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +1 -0
@@ -745,6 +745,7 @@ static struct drm_driver driver = { #if defined(CONFIG_COMPAT) .compat_ioctl = drm_compat_ioctl, #endif + .llseek = noop_llseek, }, .pci_driver = { .name = VMWGFX_DRIVER_NAME,
Signature · 1 line
1.7.1
Arnd Bergmann
maintainerPATCH 2/18 net/wireless: use generic_file_llseek in debugfs
In reply to Arnd BergmannThe default llseek operation is changing from default_llseek to no_llseek, so all code relying on the current behaviour needs to make that explicit.
The wireless driver infrastructure and some of the drivers make use of generated debugfs files, so they cannot be converted by our script that automatically determines the right operation.
All these files use debugfs and they typically rely on simple_read_from_buffer, so the best llseek operation here is generic_file_llseek.
--- drivers/misc/iwmc3200top/debugfs.c | 3 +++ drivers/net/wireless/b43/debugfs.c | 1 + drivers/net/wireless/b43legacy/debugfs.c | 1 + drivers/net/wireless/iwlwifi/iwl-debugfs.c | 3 +++ drivers/net/wireless/libertas/debugfs.c | 1 + drivers/net/wireless/rt2x00/rt2x00debug.c | 1 + drivers/net/wireless/wl12xx/wl1251_debugfs.c | 2 ++ drivers/net/wireless/wl12xx/wl1271_debugfs.c | 2 ++ net/mac80211/debugfs.c | 2 ++ net/mac80211/debugfs_key.c | 2 ++ net/mac80211/debugfs_netdev.c | 1 + net/mac80211/debugfs_sta.c | 2 ++ net/wireless/debugfs.c | 1 + 13 files changed, 22 insertions(+), 0 deletions(-)
drivers/misc/iwmc3200top/debugfs.c +3 -0
@@ -71,6 +71,7 @@ ssize_t iwmct_dbgfs_##name##_write(struct file *file, \ static const struct file_operations iwmct_dbgfs_##name##_ops = { \ .read = iwmct_dbgfs_##name##_read, \ .open = iwmct_dbgfs_open_file_generic, \ + .llseek = generic_file_llseek, \ };#define DEBUGFS_WRITE_FILE_OPS (name) \
@@ -78,6 +79,7 @@ ssize_t iwmct_dbgfs_##name##_write(struct file *file, \ static const struct file_operations iwmct_dbgfs_##name##_ops = { \ .write = iwmct_dbgfs_##name##_write, \ .open = iwmct_dbgfs_open_file_generic, \ + .llseek = generic_file_llseek, \ };#define DEBUGFS_READ_WRITE_FILE_OPS (name) \
@@ -87,6 +89,7 @@ ssize_t iwmct_dbgfs_##name##_write(struct file *file, \ .write = iwmct_dbgfs_##name##_write, \ .read = iwmct_dbgfs_##name##_read, \ .open = iwmct_dbgfs_open_file_generic, \ + .llseek = generic_file_llseek, \ };
drivers/net/wireless/b43/debugfs.c +1 -0
@@ -627,6 +627,7 @@ out_unlock: .open = b43_debugfs_open, \ .read = b43_debugfs_read, \ .write = b43_debugfs_write, \ + .llseek = generic_file_llseek, \ }, \ .file_struct_offset = offsetof(struct b43_dfsentry, \ file_##name), \
drivers/net/wireless/b43legacy/debugfs.c +1 -0
@@ -334,6 +334,7 @@ out_unlock: .open = b43legacy_debugfs_open, \ .read = b43legacy_debugfs_read, \ .write = b43legacy_debugfs_write, \ + .llseek = generic_file_llseek, \ }, \ .file_struct_offset = offsetof(struct b43legacy_dfsentry, \ file_##name), \
drivers/net/wireless/iwlwifi/iwl-debugfs.c +3 -0
@@ -87,6 +87,7 @@ static int iwl_dbgfs_open_file_generic(struct inode *inode, struct file *file) static const struct file_operations iwl_dbgfs_##name##_ops = { \ .read = iwl_dbgfs_##name##_read, \ .open = iwl_dbgfs_open_file_generic, \ + .llseek = generic_file_llseek, \ };#define DEBUGFS_WRITE_FILE_OPS (name) \
@@ -94,6 +95,7 @@ static const struct file_operations iwl_dbgfs_##name##_ops = { \ static const struct file_operations iwl_dbgfs_##name##_ops = { \ .write = iwl_dbgfs_##name##_write, \ .open = iwl_dbgfs_open_file_generic, \ + .llseek = generic_file_llseek, \ };
@@ -104,6 +106,7 @@ static const struct file_operations iwl_dbgfs_##name##_ops = { \ .write = iwl_dbgfs_##name##_write, \ .read = iwl_dbgfs_##name##_read, \ .open = iwl_dbgfs_open_file_generic, \ + .llseek = generic_file_llseek, \ };int iwl_dbgfs_statistics_flag (struct iwl_priv *priv,char *buf,int bufsz)
drivers/net/wireless/libertas/debugfs.c +1 -0
@@ -713,6 +713,7 @@ out_unlock: .open = open_file_generic, \ .read = (fread), \ .write = (fwrite), \ + .llseek = generic_file_llseek, \ }struct lbs_debugfs_files {
drivers/net/wireless/rt2x00/rt2x00debug.c +1 -0
@@ -508,6 +508,7 @@ static const struct file_operations rt2x00debug_fop_##__name = {\ .write = rt2x00debug_write_##__name, \ .open = rt2x00debug_file_open, \ .release = rt2x00debug_file_release, \ + .llseek = generic_file_llseek, \ };RT2X00DEBUGFS_OPS (csr,"0x%.8x\n" , u32);
drivers/net/wireless/wl12xx/wl1251_debugfs.c +2 -0
@@ -50,6 +50,7 @@ static ssize_t name## _read(struct file *file, char __user *userbuf, \ static const struct file_operations name## _ops = { \ .read = name## _read, \ .open = wl1251_open_file_generic, \ + .llseek = generic_file_llseek, \ };#define DEBUGFS_ADD (name, parent) \
@@ -86,6 +87,7 @@ static ssize_t sub## _ ##name## _read(struct file *file, \ static const struct file_operations sub## _ ##name## _ops = { \ .read = sub## _ ##name## _read, \ .open = wl1251_open_file_generic, \ + .llseek = generic_file_llseek, \ };#define DEBUGFS_FWSTATS_ADD (sub, name) \
drivers/net/wireless/wl12xx/wl1271_debugfs.c +2 -0
@@ -51,6 +51,7 @@ static ssize_t name## _read(struct file *file, char __user *userbuf, \ static const struct file_operations name## _ops = { \ .read = name## _read, \ .open = wl1271_open_file_generic, \ + .llseek = generic_file_llseek, \ };#define DEBUGFS_ADD (name, parent) \
@@ -87,6 +88,7 @@ static ssize_t sub## _ ##name## _read(struct file *file, \ static const struct file_operations sub## _ ##name## _ops = { \ .read = sub## _ ##name## _read, \ .open = wl1271_open_file_generic, \ + .llseek = generic_file_llseek, \ };#define DEBUGFS_FWSTATS_ADD (sub, name) \
net/mac80211/debugfs.c +2 -0
@@ -36,6 +36,7 @@ static ssize_t name## _read(struct file *file, char __user *userbuf, \ static const struct file_operations name## _ops = { \ .read = name## _read, \ .open = mac80211_open_file_generic, \ + .llseek = generic_file_llseek, \ };#define DEBUGFS_ADD (name) \
@@ -349,6 +350,7 @@ static ssize_t stats_ ##name## _read(struct file *file, \ static const struct file_operations stats_ ##name## _ops = { \ .read = stats_ ##name## _read, \ .open = mac80211_open_file_generic, \ + .llseek = generic_file_llseek, \ };#define DEBUGFS_STATS_ADD (name) \
net/mac80211/debugfs_key.c +2 -0
@@ -32,6 +32,7 @@ static ssize_t key_##name##_read(struct file *file, \ static const struct file_operations key_ ##name## _ops = { \ .read = key_##name##_read, \ .open = mac80211_open_file_generic, \ + .llseek = generic_file_llseek, \ }#define KEY_FILE (name, format) \
@@ -46,6 +47,7 @@ static const struct file_operations key_ ##name## _ops = { \ static const struct file_operations key_ ##name## _ops = { \ .read = key_conf_##name##_read, \ .open = mac80211_open_file_generic, \ + .llseek = generic_file_llseek, \ }#define KEY_CONF_FILE (name, format) \
net/mac80211/debugfs_netdev.c +1 -0
@@ -121,6 +121,7 @@ static const struct file_operations name##_ops = { \ .read = ieee80211_if_read_##name, \ .write = (_write), \ .open = mac80211_open_file_generic, \ + .llseek = generic_file_llseek, \ }#define __IEEE80211_IF_FILE_W (name) \
net/mac80211/debugfs_sta.c +2 -0
@@ -37,6 +37,7 @@ static ssize_t sta_ ##name## _read(struct file *file, \ static const struct file_operations sta_ ##name## _ops = { \ .read = sta_##name##_read, \ .open = mac80211_open_file_generic, \ + .llseek = generic_file_llseek, \ }#define STA_OPS_RW (name) \
@@ -44,6 +45,7 @@ static const struct file_operations sta_ ##name## _ops = { \ .read = sta_##name##_read, \ .write = sta_##name##_write, \ .open = mac80211_open_file_generic, \ + .llseek = generic_file_llseek, \ }#define STA_FILE (name, field, format) \
net/wireless/debugfs.c +1 -0
@@ -34,6 +34,7 @@ static ssize_t name## _read(struct file *file, char __user *userbuf, \ static const struct file_operations name## _ops = { \ .read = name## _read, \ .open = cfg80211_open_file_generic, \ + .llseek = generic_file_llseek, \ }; DEBUGFS_READONLY_FILE(rts_threshold, 20, "%d",
Signature · 1 line
1.7.1
Arnd Bergmann
maintainerPATCH 3/18 lkdtm: use generic_file_llseek in debugfs
In reply to Arnd BergmannWhen the default llseek behavior gets changed to not allowing seek, all file operations that rely on the current behaviour need to use an explicit .llseek operation.
The files that lkdtm uses in debugfs are regular files and they get read using simple_read_from_buffer, so generic_file_llseek is the right operation.
--- drivers/misc/lkdtm.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
drivers/misc/lkdtm.c +9 -0
@@ -575,30 +575,39 @@ struct crash_entry {static const struct crash_entry crash_entries[] = { {"DIRECT" , {.read = lkdtm_debugfs_read, + .llseek = generic_file_llseek, .open = lkdtm_debugfs_open, .write = direct_entry} }, {"INT_HARDWARE_ENTRY" , {.read = lkdtm_debugfs_read, + .llseek = generic_file_llseek, .open = lkdtm_debugfs_open, .write = int_hardware_entry} }, {"INT_HW_IRQ_EN" , {.read = lkdtm_debugfs_read, + .llseek = generic_file_llseek, .open = lkdtm_debugfs_open, .write = int_hw_irq_en} }, {"INT_TASKLET_ENTRY" , {.read = lkdtm_debugfs_read, + .llseek = generic_file_llseek, .open = lkdtm_debugfs_open, .write = int_tasklet_entry} }, {"FS_DEVRW" , {.read = lkdtm_debugfs_read, + .llseek = generic_file_llseek, .open = lkdtm_debugfs_open, .write = fs_devrw_entry} }, {"MEM_SWAPOUT" , {.read = lkdtm_debugfs_read, + .llseek = generic_file_llseek, .open = lkdtm_debugfs_open, .write = mem_swapout_entry} }, {"TIMERADD" , {.read = lkdtm_debugfs_read, + .llseek = generic_file_llseek, .open = lkdtm_debugfs_open, .write = timeradd_entry} }, {"SCSI_DISPATCH_CMD" , {.read = lkdtm_debugfs_read, + .llseek = generic_file_llseek, .open = lkdtm_debugfs_open, .write = scsi_dispatch_cmd_entry} }, {"IDE_CORE_CP" , {.read = lkdtm_debugfs_read, + .llseek = generic_file_llseek, .open = lkdtm_debugfs_open, .write = ide_core_cp_entry} }, };
Signature · 1 line
1.7.1
Frederic Weisbecker
AppliedRe: [PATCH 03/18] lkdtm: use generic_file_llseek in debugfs
Quoted 11 lines · Arnd Bergmann
When the default llseek behavior gets changed to not allowing seek, all file operations that rely on the current behaviour need to use an explicit .llseek operation.
The files that lkdtm uses in debugfs are regular files and they get read using
simple_read_from_buffer, sogeneric_file_llseekis the right operation.Signed-off-by Arnd Bergmann <[email protected]>---
Applied, thanks.
Arnd Bergmann
maintainerPATCH 4/18 ib/qib: use generic_file_llseek
In reply to Arnd BergmannWhen the default llseek action gets changed tono_llseek, all file systems relying on the
current behaviour need to set explicit .llseek
operations.
In case of qib_fs, we want the files to be
seekable, so generic_file_llseek fits best.
--- drivers/infiniband/hw/qib/qib_fs.c | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-)
drivers/infiniband/hw/qib/qib_fs.c +9 -9
@@ -135,8 +135,8 @@ static ssize_t driver_names_read(struct file *file, char __user *buf, }static const struct file_operations driver_ops[] = { - { .read = driver_stats_read, }, - { .read = driver_names_read, }, + { .read = driver_stats_read, .llseek = generic_file_llseek, }, + { .read = driver_names_read, .llseek = generic_file_llseek, }, };/* read the per-device counters */
@@ -164,8 +164,8 @@ static ssize_t dev_names_read(struct file *file, char __user *buf, }static const struct file_operations cntr_ops[] = { - { .read = dev_counters_read, }, - { .read = dev_names_read, }, + { .read = dev_counters_read, .llseek = generic_file_llseek, }, + { .read = dev_names_read, .llseek = generic_file_llseek, }, };/*
@@ -210,9 +210,9 @@ static ssize_t portcntrs_2_read(struct file *file, char __user *buf, }static const struct file_operations portcntr_ops[] = { - { .read = portnames_read, }, - { .read = portcntrs_1_read, }, - { .read = portcntrs_2_read, }, + { .read = portnames_read, .llseek = generic_file_llseek, }, + { .read = portcntrs_1_read, .llseek = generic_file_llseek, }, + { .read = portcntrs_2_read, .llseek = generic_file_llseek, }, };/*
@@ -261,8 +261,8 @@ static ssize_t qsfp_2_read(struct file *file, char __user *buf, }static const struct file_operations qsfp_ops[] = { - { .read = qsfp_1_read, }, - { .read = qsfp_2_read, }, + { .read = qsfp_1_read, .llseek = generic_file_llseek, }, + { .read = qsfp_2_read, .llseek = generic_file_llseek, }, }; static ssize_t flash_read(struct file *file, char __user *buf,
Signature · 6 lines
1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Roland Dreier
AppliedRe: [PATCH 04/18] ib/qib: use generic_file_llseek
thanks, applied
Signature · 6 lines
Roland Dreier <[email protected]> || For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/index.html -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Arnd Bergmann
maintainerPATCH 5/18 arm/omap: use generic_file_llseek in iommu_debug
In reply to Arnd BergmannIn future kernels, debugfs files need to specify the llseek operation explicitly to allow seeking. This sets the llseek operation in the omap iommu debugfs files to generic_file_llseek, which is appropriate for files using simple_read_from_buffer.
--- arch/arm/plat-omap/iommu-debug.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/plat-omap/iommu-debug.c +2 -0
@@ -328,12 +328,14 @@ static int debug_open_generic(struct inode *inode, struct file *file) .open = debug_open_generic, \ .read = debug_read_##name, \ .write = debug_write_##name, \ + .llseek = generic_file_llseek, \ };#define DEBUG_FOPS_RO (name) \ static const struct file_operations debug_##name##_fops = { \ .open = debug_open_generic, \ .read = debug_read_##name, \ + .llseek = generic_file_llseek, \ };DEBUG_FOPS_RO (ver);
Signature · 1 line
1.7.1
Arnd Bergmann
maintainerPATCH 6/18 spufs: use llseek in all file operations
In reply to Arnd BergmannThe default for llseek is changing, so we need
explicit operations everywhere.
--- arch/powerpc/platforms/cell/spufs/file.c | 24 +++++++++++++++++++++--- 1 files changed, 21 insertions(+), 3 deletions(-)
arch/powerpc/platforms/cell/spufs/file.c +21 -3
@@ -154,6 +154,7 @@ static const struct file_operations __fops = { \ .release = spufs_attr_release, \ .read = spufs_attr_read, \ .write = spufs_attr_write, \ + .llseek = generic_file_llseek, \ };
@@ -521,6 +522,7 @@ static const struct file_operations spufs_cntl_fops = { .release = spufs_cntl_release, .read = simple_attr_read, .write = simple_attr_write, + .llseek = generic_file_llseek, .mmap = spufs_cntl_mmap, };
@@ -714,6 +716,7 @@ static ssize_t spufs_mbox_read(struct file *file, char __user *buf,static const struct file_operations spufs_mbox_fops = { .open = spufs_pipe_open, .read = spufs_mbox_read, + .llseek = no_llseek, }; static ssize_t spufs_mbox_stat_read(struct file *file, char __user *buf,
@@ -743,6 +746,7 @@ static ssize_t spufs_mbox_stat_read(struct file *file, char __user *buf,static const struct file_operations spufs_mbox_stat_fops = { .open = spufs_pipe_open, .read = spufs_mbox_stat_read, + .llseek = no_llseek, };/* low-level ibox access function */
@@ -863,6 +867,7 @@ static const struct file_operations spufs_ibox_fops = { .read = spufs_ibox_read, .poll = spufs_ibox_poll, .fasync = spufs_ibox_fasync, + .llseek = no_llseek, }; static ssize_t spufs_ibox_stat_read(struct file *file, char __user *buf,
@@ -890,6 +895,7 @@ static ssize_t spufs_ibox_stat_read(struct file *file, char __user *buf,static const struct file_operations spufs_ibox_stat_fops = { .open = spufs_pipe_open, .read = spufs_ibox_stat_read, + .llseek = no_llseek, };/* low-level mailbox write */
@@ -1011,6 +1017,7 @@ static const struct file_operations spufs_wbox_fops = { .write = spufs_wbox_write, .poll = spufs_wbox_poll, .fasync = spufs_wbox_fasync, + .llseek = no_llseek, }; static ssize_t spufs_wbox_stat_read(struct file *file, char __user *buf,
@@ -1038,6 +1045,7 @@ static ssize_t spufs_wbox_stat_read(struct file *file, char __user *buf,static const struct file_operations spufs_wbox_stat_fops = { .open = spufs_pipe_open, .read = spufs_wbox_stat_read, + .llseek = no_llseek, };static int spufs_signal1_open (struct inode *inode,struct file *file)
@@ -1166,6 +1174,7 @@ static const struct file_operations spufs_signal1_fops = { .read = spufs_signal1_read, .write = spufs_signal1_write, .mmap = spufs_signal1_mmap, + .llseek = no_llseek, };static const struct file_operations spufs_signal1_nosched_fops = {
@@ -1173,6 +1182,7 @@ static const struct file_operations spufs_signal1_nosched_fops = { .release = spufs_signal1_release, .write = spufs_signal1_write, .mmap = spufs_signal1_mmap, + .llseek = no_llseek, };static int spufs_signal2_open (struct inode *inode,struct file *file)
@@ -1305,6 +1315,7 @@ static const struct file_operations spufs_signal2_fops = { .read = spufs_signal2_read, .write = spufs_signal2_write, .mmap = spufs_signal2_mmap, + .llseek = no_llseek, };static const struct file_operations spufs_signal2_nosched_fops = {
@@ -1312,6 +1323,7 @@ static const struct file_operations spufs_signal2_nosched_fops = { .release = spufs_signal2_release, .write = spufs_signal2_write, .mmap = spufs_signal2_mmap, + .llseek = no_llseek, };/*
@@ -1451,6 +1463,7 @@ static const struct file_operations spufs_mss_fops = { .open = spufs_mss_open, .release = spufs_mss_release, .mmap = spufs_mss_mmap, + .llseek = no_llseek, }; static int
@@ -1508,6 +1521,7 @@ static const struct file_operations spufs_psmap_fops = { .open = spufs_psmap_open, .release = spufs_psmap_release, .mmap = spufs_psmap_mmap, + .llseek = no_llseek, };
@@ -1871,6 +1885,7 @@ static const struct file_operations spufs_mfc_fops = { .fsync = spufs_mfc_fsync, .fasync = spufs_mfc_fasync, .mmap = spufs_mfc_mmap, + .llseek = no_llseek, };static int spufs_npc_set (void *data,u64 val)
@@ -2111,7 +2126,7 @@ static ssize_t spufs_mbox_info_read(struct file *file, char __user *buf,static const struct file_operations spufs_mbox_info_fops = { .open = spufs_info_open, .read = spufs_mbox_info_read, - .llseek = generic_file_llseek, + .llseek = no_llseek, }; static ssize_t __spufs_ibox_info_read(struct spu_context *ctx,
@@ -2151,7 +2166,7 @@ static ssize_t spufs_ibox_info_read(struct file *file, char __user *buf,static const struct file_operations spufs_ibox_info_fops = { .open = spufs_info_open, .read = spufs_ibox_info_read, - .llseek = generic_file_llseek, + .llseek = no_llseek, }; static ssize_t __spufs_wbox_info_read(struct spu_context *ctx,
@@ -2194,7 +2209,7 @@ static ssize_t spufs_wbox_info_read(struct file *file, char __user *buf,static const struct file_operations spufs_wbox_info_fops = { .open = spufs_info_open, .read = spufs_wbox_info_read, - .llseek = generic_file_llseek, + .llseek = no_llseek, }; static ssize_t __spufs_dma_info_read(struct spu_context *ctx,
@@ -2246,6 +2261,7 @@ static ssize_t spufs_dma_info_read(struct file *file, char __user *buf,static const struct file_operations spufs_dma_info_fops = { .open = spufs_info_open, .read = spufs_dma_info_read, + .llseek = no_llseek, }; static ssize_t __spufs_proxydma_info_read(struct spu_context *ctx,
@@ -2299,6 +2315,7 @@ static ssize_t spufs_proxydma_info_read(struct file *file, char __user *buf,static const struct file_operations spufs_proxydma_info_fops = { .open = spufs_info_open, .read = spufs_proxydma_info_read, + .llseek = no_llseek, };static int spufs_show_tid (struct seq_file *s,void *private)
@@ -2585,6 +2602,7 @@ static const struct file_operations spufs_switch_log_fops = { .read = spufs_switch_log_read, .poll = spufs_switch_log_poll, .release = spufs_switch_log_release, + .llseek = no_llseek, };/**
Signature · 1 line
1.7.1
Re: [PATCH 06/18] spufs: use llseek in all file operations
Hi Arnd,
Quoted 2 lines
The default for llseek is changing, so we need
explicit operations everywhere.
Looks good, but:
Quoted 10 lines
arch/powerpc/platforms/cell/spufs/file.c +1
-1@@ -2151,7 +2166,7 @@ static ssize_t spufs_ibox_info_read(struct file *file, char __user *buf,static const struct file_operations spufs_ibox_info_fops = { .open = spufs_info_open, .read = spufs_ibox_info_read, - .llseek = generic_file_llseek, + .llseek = no_llseek, }; static ssize_t __spufs_wbox_info_read(struct spu_context *ctx,
arch/powerpc/platforms/cell/spufs/file.c static ssize_t spufs_wbox_info_read(struct file *file, char __user *buf, · line 2214
Quoted 7 lines
arch/powerpc/platforms/cell/spufs/file.c +1
-1@@ -2194,7 +2209,7 @@ static ssize_t spufs_wbox_info_read(struct file *file, char __user *buf,static const struct file_operations spufs_wbox_info_fops = { .open = spufs_info_open, .read = spufs_wbox_info_read, - .llseek = generic_file_llseek, + .llseek = no_llseek, };
Why the change in behaviour for the mbox info files?
Cheers,
Jeremy
Arnd Bergmann
maintainerRe: [PATCH 06/18] spufs: use llseek in all file operations
Quoted 8 lines · Jeremy Kerr
Quoted 8 lines
arch/powerpc/platforms/cell/spufs/file.c +1
-1@@ -2151,7 +2166,7 @@ static ssize_t spufs_ibox_info_read(struct file *file, char __user *buf,static const struct file_operations spufs_ibox_info_fops = { .open = spufs_info_open, .read = spufs_ibox_info_read, - .llseek = generic_file_llseek, + .llseek = no_llseek, };
Quoted 12 lines
arch/powerpc/platforms/cell/spufs/file.c static ssize_t spufs_wbox_info_read(struct file *file, char __user *buf, · line 2214
Quoted 9 lines
arch/powerpc/platforms/cell/spufs/file.c +1
-1static ssize_t __spufs_wbox_info_read(struct spu_context *ctx,@@ -2194,7 +2209,7 @@ static ssize_t spufs_wbox_info_read(struct file *file, char __user *buf,static const struct file_operations spufs_wbox_info_fops = { .open = spufs_info_open, .read = spufs_wbox_info_read, - .llseek = generic_file_llseek, + .llseek = no_llseek, };Why the change in behaviour for the mbox info files?
D'oh, that wasn't intentional. I guess what must have happened is that I first added generic_file_llseek to all file_operations in spufs and then made up my mind and chose what I thought was correct in each case, which broke these. Of course, these *_info_fops should be seekable.
Arnd
Arnd Bergmann
maintainerPATCH v2 1/1 spufs: use llseek in all file operations
The default for llseek is changing, so we need
explicit operations everywhere.
---
Same as previous version, but no longer breaking the existing llseek operation in spufs_*box_info_fops. Pushed out to my bkl/llseek branch.
arch/powerpc/platforms/cell/spufs/file.c +18 -0
@@ -154,6 +154,7 @@ static const struct file_operations __fops = { \ .release = spufs_attr_release, \ .read = spufs_attr_read, \ .write = spufs_attr_write, \ + .llseek = generic_file_llseek, \ };
@@ -521,6 +522,7 @@ static const struct file_operations spufs_cntl_fops = { .release = spufs_cntl_release, .read = simple_attr_read, .write = simple_attr_write, + .llseek = generic_file_llseek, .mmap = spufs_cntl_mmap, };
@@ -714,6 +716,7 @@ static ssize_t spufs_mbox_read(struct file *file, char __user *buf,static const struct file_operations spufs_mbox_fops = { .open = spufs_pipe_open, .read = spufs_mbox_read, + .llseek = no_llseek, }; static ssize_t spufs_mbox_stat_read(struct file *file, char __user *buf,
@@ -743,6 +746,7 @@ static ssize_t spufs_mbox_stat_read(struct file *file, char __user *buf,static const struct file_operations spufs_mbox_stat_fops = { .open = spufs_pipe_open, .read = spufs_mbox_stat_read, + .llseek = no_llseek, };/* low-level ibox access function */
@@ -863,6 +867,7 @@ static const struct file_operations spufs_ibox_fops = { .read = spufs_ibox_read, .poll = spufs_ibox_poll, .fasync = spufs_ibox_fasync, + .llseek = no_llseek, }; static ssize_t spufs_ibox_stat_read(struct file *file, char __user *buf,
@@ -890,6 +895,7 @@ static ssize_t spufs_ibox_stat_read(struct file *file, char __user *buf,static const struct file_operations spufs_ibox_stat_fops = { .open = spufs_pipe_open, .read = spufs_ibox_stat_read, + .llseek = no_llseek, };/* low-level mailbox write */
@@ -1011,6 +1017,7 @@ static const struct file_operations spufs_wbox_fops = { .write = spufs_wbox_write, .poll = spufs_wbox_poll, .fasync = spufs_wbox_fasync, + .llseek = no_llseek, }; static ssize_t spufs_wbox_stat_read(struct file *file, char __user *buf,
@@ -1038,6 +1045,7 @@ static ssize_t spufs_wbox_stat_read(struct file *file, char __user *buf,static const struct file_operations spufs_wbox_stat_fops = { .open = spufs_pipe_open, .read = spufs_wbox_stat_read, + .llseek = no_llseek, };static int spufs_signal1_open (struct inode *inode,struct file *file)
@@ -1166,6 +1174,7 @@ static const struct file_operations spufs_signal1_fops = { .read = spufs_signal1_read, .write = spufs_signal1_write, .mmap = spufs_signal1_mmap, + .llseek = no_llseek, };static const struct file_operations spufs_signal1_nosched_fops = {
@@ -1173,6 +1182,7 @@ static const struct file_operations spufs_signal1_nosched_fops = { .release = spufs_signal1_release, .write = spufs_signal1_write, .mmap = spufs_signal1_mmap, + .llseek = no_llseek, };static int spufs_signal2_open (struct inode *inode,struct file *file)
@@ -1305,6 +1315,7 @@ static const struct file_operations spufs_signal2_fops = { .read = spufs_signal2_read, .write = spufs_signal2_write, .mmap = spufs_signal2_mmap, + .llseek = no_llseek, };static const struct file_operations spufs_signal2_nosched_fops = {
@@ -1312,6 +1323,7 @@ static const struct file_operations spufs_signal2_nosched_fops = { .release = spufs_signal2_release, .write = spufs_signal2_write, .mmap = spufs_signal2_mmap, + .llseek = no_llseek, };/*
@@ -1451,6 +1463,7 @@ static const struct file_operations spufs_mss_fops = { .open = spufs_mss_open, .release = spufs_mss_release, .mmap = spufs_mss_mmap, + .llseek = no_llseek, }; static int
@@ -1508,6 +1521,7 @@ static const struct file_operations spufs_psmap_fops = { .open = spufs_psmap_open, .release = spufs_psmap_release, .mmap = spufs_psmap_mmap, + .llseek = no_llseek, };
@@ -1871,6 +1885,7 @@ static const struct file_operations spufs_mfc_fops = { .fsync = spufs_mfc_fsync, .fasync = spufs_mfc_fasync, .mmap = spufs_mfc_mmap, + .llseek = no_llseek, };static int spufs_npc_set (void *data,u64 val)
@@ -2246,6 +2261,7 @@ static ssize_t spufs_dma_info_read(struct file *file, char __user *buf,static const struct file_operations spufs_dma_info_fops = { .open = spufs_info_open, .read = spufs_dma_info_read, + .llseek = no_llseek, }; static ssize_t __spufs_proxydma_info_read(struct spu_context *ctx,
@@ -2299,6 +2315,7 @@ static ssize_t spufs_proxydma_info_read(struct file *file, char __user *buf,static const struct file_operations spufs_proxydma_info_fops = { .open = spufs_info_open, .read = spufs_proxydma_info_read, + .llseek = no_llseek, };static int spufs_show_tid (struct seq_file *s,void *private)
@@ -2585,6 +2602,7 @@ static const struct file_operations spufs_switch_log_fops = { .read = spufs_switch_log_read, .poll = spufs_switch_log_poll, .release = spufs_switch_log_release, + .llseek = no_llseek, };/**
Arnd Bergmann
maintainerPATCH 7/18 staging: use llseek in all file operations
In reply to Arnd BergmannThese could not be detected by the semantic patch.
--- drivers/staging/msm/mdp4_debugfs.c | 10 ++-------- drivers/staging/panel/panel.c | 3 ++- 2 files changed, 4 insertions(+), 9 deletions(-)
drivers/staging/msm/mdp4_debugfs.c +2 -8
@@ -63,13 +63,6 @@ DEFINE_SIMPLE_ATTRIBUTE( "%llx\n"); -static int mdp4_debugfs_open (struct inode *inode,struct file *file) -{ -/* non-seekable */ - file->f_mode &= ~(FMODE_LSEEK |FMODE_PREAD |FMODE_PWRITE ); -return 0 ; -} -static int mdp4_debugfs_release (struct inode *inode,struct file *file) {return 0 ;
@@ -144,10 +137,11 @@ static ssize_t mdp4_debugfs_read( }static const struct file_operations mdp4_debugfs_fops = { - .open = mdp4_debugfs_open, + .open = nonseekable_open, .release = mdp4_debugfs_release, .read = mdp4_debugfs_read, .write = mdp4_debugfs_write, + .llseek = no_llseek, };int mdp4_debugfs_init (void )
drivers/staging/panel/panel.c +2 -1
@@ -1295,7 +1295,7 @@ static int lcd_open(struct inode *inode, struct file *file) lcd_must_clear =0 ; } lcd_open_cnt++; -return 0 ; +return nonseekable_open (inode, file); }static int lcd_release (struct inode *inode,struct file *file)
@@ -1308,6 +1308,7 @@ static struct file_operations lcd_fops = { .write = lcd_write, .open = lcd_open, .release = lcd_release, + .llseek = no_llseek, };static struct miscdevice lcd_dev = {
Signature · 1 line
1.7.1
Arnd Bergmann
maintainerPATCH 8/18 selinux: use generic_file_llseek
In reply to Arnd BergmannThe default for llseek will change to no_llseek, so selinuxfs needs to add explicit .llseek assignments. Since we're dealing with regular files from a VFS perspective, use generic_file_llseek.
--- security/selinux/selinuxfs.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-)
security/selinux/selinuxfs.c +16 -0
@@ -184,6 +184,7 @@ out:static const struct file_operations sel_enforce_ops = { .read = sel_read_enforce, .write = sel_write_enforce, + .llseek = generic_file_llseek, }; static ssize_t sel_read_handle_unknown(struct file *filp, char __user *buf,
@@ -201,6 +202,7 @@ static ssize_t sel_read_handle_unknown(struct file *filp, char __user *buf,static const struct file_operations sel_handle_unknown_ops = { .read = sel_read_handle_unknown, + .llseek = generic_file_llseek, };#ifdef CONFIG_SECURITY_SELINUX_DISABLE
@@ -251,6 +253,7 @@ out:static const struct file_operations sel_disable_ops = { .write = sel_write_disable, + .llseek = generic_file_llseek, }; static ssize_t sel_read_policyvers(struct file *filp, char __user *buf,
@@ -265,6 +268,7 @@ static ssize_t sel_read_policyvers(struct file *filp, char __user *buf,static const struct file_operations sel_policyvers_ops = { .read = sel_read_policyvers, + .llseek = generic_file_llseek, };/* declaration for sel_write_load */
@@ -289,6 +293,7 @@ static ssize_t sel_read_mls(struct file *filp, char __user *buf,static const struct file_operations sel_mls_ops = { .read = sel_read_mls, + .llseek = generic_file_llseek, }; static ssize_t sel_write_load(struct file *file, const char __user *buf,
@@ -356,6 +361,7 @@ out:static const struct file_operations sel_load_ops = { .write = sel_write_load, + .llseek = generic_file_llseek, };static ssize_t sel_write_context (struct file *file,char *buf,size_t size)
@@ -437,6 +443,7 @@ out:static const struct file_operations sel_checkreqprot_ops = { .read = sel_read_checkreqprot, .write = sel_write_checkreqprot, + .llseek = generic_file_llseek, };/*
@@ -482,6 +489,7 @@ static const struct file_operations transaction_ops = { .write = selinux_transaction_write, .read = simple_transaction_read, .release = simple_transaction_release, + .llseek = generic_file_llseek, };/*
@@ -883,6 +891,7 @@ out:static const struct file_operations sel_bool_ops = { .read = sel_read_bool, .write = sel_write_bool, + .llseek = generic_file_llseek, }; static ssize_t sel_commit_bools_write(struct file *filep,
@@ -935,6 +944,7 @@ out:static const struct file_operations sel_commit_bools_ops = { .write = sel_commit_bools_write, + .llseek = generic_file_llseek, };static void sel_remove_entries (struct dentry *de)
@@ -1127,10 +1137,12 @@ out:static const struct file_operations sel_avc_cache_threshold_ops = { .read = sel_read_avc_cache_threshold, .write = sel_write_avc_cache_threshold, + .llseek = generic_file_llseek, };static const struct file_operations sel_avc_hash_stats_ops = { .read = sel_read_avc_hash_stats, + .llseek = generic_file_llseek, };#ifdef CONFIG_SECURITY_SELINUX_AVC_STATS
@@ -1255,6 +1267,7 @@ static ssize_t sel_read_initcon(struct file *file, char __user *buf,static const struct file_operations sel_initcon_ops = { .read = sel_read_initcon, + .llseek = generic_file_llseek, };static int sel_make_initcon_files (struct dentry *dir)
@@ -1330,6 +1343,7 @@ out:static const struct file_operations sel_class_ops = { .read = sel_read_class, + .llseek = generic_file_llseek, }; static ssize_t sel_read_perm(struct file *file, char __user *buf,
@@ -1354,6 +1368,7 @@ out:static const struct file_operations sel_perm_ops = { .read = sel_read_perm, + .llseek = generic_file_llseek, }; static ssize_t sel_read_policycap(struct file *file, char __user *buf,
@@ -1372,6 +1387,7 @@ static ssize_t sel_read_policycap(struct file *file, char __user *buf,static const struct file_operations sel_policycap_ops = { .read = sel_read_policycap, + .llseek = generic_file_llseek, }; static int sel_make_perm_files(char *objclass, int classvalue,
Signature · 1 line
1.7.1
Re: [PATCH 08/18] selinux: use generic_file_llseek
Quoted 10 lines · Arnd Bergmann
The default for llseek will change to
no_llseek, so selinuxfs needs to add explicit .llseek assignments. Since we're dealing with regular files from a VFS perspective, usegeneric_file_llseek.Signed-off-by Arnd Bergmann <[email protected]>Cc Stephen Smalley <[email protected]>Cc James Morris <[email protected]>Cc Eric Paris <[email protected]>
I'm ok with the patch as is since the .read handlers are ok with it, but we probably should convert some of them to no_llseek. I'll try to remember take a look, but if I forget I have no problem with this patch going in....
-Eric
Quoted 133 lines
--- security/selinux/selinuxfs.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-)security/selinux/selinuxfs.c +16
-0@@ -184,6 +184,7 @@ out:static const struct file_operations sel_enforce_ops = { .read = sel_read_enforce, .write = sel_write_enforce, + .llseek = generic_file_llseek, }; static ssize_t sel_read_handle_unknown(struct file *filp, char __user *buf,@@ -201,6 +202,7 @@ static ssize_t sel_read_handle_unknown(struct file *filp, char __user *buf,static const struct file_operations sel_handle_unknown_ops = { .read = sel_read_handle_unknown, + .llseek = generic_file_llseek, };#ifdef CONFIG_SECURITY_SELINUX_DISABLE @@ -251,6 +253,7 @@ out:static const struct file_operations sel_disable_ops = { .write = sel_write_disable, + .llseek = generic_file_llseek, }; static ssize_t sel_read_policyvers(struct file *filp, char __user *buf,@@ -265,6 +268,7 @@ static ssize_t sel_read_policyvers(struct file *filp, char __user *buf,static const struct file_operations sel_policyvers_ops = { .read = sel_read_policyvers, + .llseek = generic_file_llseek, };/* declaration for sel_write_load */ @@ -289,6 +293,7 @@ static ssize_t sel_read_mls(struct file *filp, char __user *buf,static const struct file_operations sel_mls_ops = { .read = sel_read_mls, + .llseek = generic_file_llseek, }; static ssize_t sel_write_load(struct file *file, const char __user *buf,@@ -356,6 +361,7 @@ out:static const struct file_operations sel_load_ops = { .write = sel_write_load, + .llseek = generic_file_llseek, };static ssize_t sel_write_context (struct file *file,char *buf,size_t size)@@ -437,6 +443,7 @@ out:static const struct file_operations sel_checkreqprot_ops = { .read = sel_read_checkreqprot, .write = sel_write_checkreqprot, + .llseek = generic_file_llseek, };/* @@ -482,6 +489,7 @@ static const struct file_operations transaction_ops = { .write = selinux_transaction_write, .read = simple_transaction_read, .release = simple_transaction_release, + .llseek = generic_file_llseek, };/* @@ -883,6 +891,7 @@ out:static const struct file_operations sel_bool_ops = { .read = sel_read_bool, .write = sel_write_bool, + .llseek = generic_file_llseek, }; static ssize_t sel_commit_bools_write(struct file *filep,@@ -935,6 +944,7 @@ out:static const struct file_operations sel_commit_bools_ops = { .write = sel_commit_bools_write, + .llseek = generic_file_llseek, };static void sel_remove_entries (struct dentry *de)@@ -1127,10 +1137,12 @@ out:static const struct file_operations sel_avc_cache_threshold_ops = { .read = sel_read_avc_cache_threshold, .write = sel_write_avc_cache_threshold, + .llseek = generic_file_llseek, };static const struct file_operations sel_avc_hash_stats_ops = { .read = sel_read_avc_hash_stats, + .llseek = generic_file_llseek, };#ifdef CONFIG_SECURITY_SELINUX_AVC_STATS @@ -1255,6 +1267,7 @@ static ssize_t sel_read_initcon(struct file *file, char __user *buf,static const struct file_operations sel_initcon_ops = { .read = sel_read_initcon, + .llseek = generic_file_llseek, };static int sel_make_initcon_files (struct dentry *dir)@@ -1330,6 +1343,7 @@ out:static const struct file_operations sel_class_ops = { .read = sel_read_class, + .llseek = generic_file_llseek, }; static ssize_t sel_read_perm(struct file *file, char __user *buf,@@ -1354,6 +1368,7 @@ out:static const struct file_operations sel_perm_ops = { .read = sel_read_perm, + .llseek = generic_file_llseek, }; static ssize_t sel_read_policycap(struct file *file, char __user *buf,@@ -1372,6 +1387,7 @@ static ssize_t sel_read_policycap(struct file *file, char __user *buf,static const struct file_operations sel_policycap_ops = { .read = sel_read_policycap, + .llseek = generic_file_llseek, }; static int sel_make_perm_files(char *objclass, int classvalue,
James Morris
maintainerRe: [PATCH 08/18] selinux: use generic_file_llseek
In reply to Arnd BergmannQuoted 10 lines · Arnd Bergmann
The default for llseek will change to
no_llseek, so selinuxfs needs to add explicit .llseek assignments. Since we're dealing with regular files from a VFS perspective, usegeneric_file_llseek.Signed-off-by Arnd Bergmann <[email protected]>Cc Stephen Smalley <[email protected]>Cc James Morris <[email protected]>Cc Eric Paris <[email protected]>
Applied togit://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6#next
Signature · 2 lines
James Morris <[email protected]>
Arnd Bergmann
maintainerPATCH 9/18 tracing: use generic_file_llseek for debugfs
In reply to Arnd BergmannThe default for llseek will change to no_llseek, so the tracing debugfs files need to add explicit .llseek assignments. Since we're dealing with regular files from a VFS perspective, use generic_file_llseek.
--- kernel/trace/trace.c | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-)
kernel/trace/trace.c +15 -0
@@ -2394,6 +2394,7 @@ static const struct file_operations show_traces_fops = { .open = show_traces_open, .read = seq_read, .release = seq_release, + .llseek = seq_lseek, };/*
@@ -2487,6 +2488,7 @@ static const struct file_operations tracing_cpumask_fops = { .open = tracing_open_generic, .read = tracing_cpumask_read, .write = tracing_cpumask_write, + .llseek = generic_file_llseek, };static int tracing_trace_options_show (struct seq_file *m,void *v)
@@ -2653,6 +2655,7 @@ tracing_readme_read(struct file *filp, char __user *ubuf,static const struct file_operations tracing_readme_fops = { .open = tracing_open_generic, .read = tracing_readme_read, + .llseek = generic_file_llseek, }; static ssize_t
@@ -2703,6 +2706,7 @@ tracing_saved_cmdlines_read(struct file *file, char __user *ubuf,static const struct file_operations tracing_saved_cmdlines_fops = { .open = tracing_open_generic, .read = tracing_saved_cmdlines_read, + .llseek = generic_file_llseek, }; static ssize_t
@@ -3032,6 +3036,7 @@ static int tracing_open_pipe(struct inode *inode, struct file *filp)if (iter->trace->pipe_open) iter->trace->pipe_open (iter); +nonseekable_open (inode, filp); out:mutex_unlock (&trace_types_lock);return ret;
@@ -3590,18 +3595,21 @@ static const struct file_operations tracing_max_lat_fops = { .open = tracing_open_generic, .read = tracing_max_lat_read, .write = tracing_max_lat_write, + .llseek = generic_file_llseek, };static const struct file_operations tracing_ctrl_fops = { .open = tracing_open_generic, .read = tracing_ctrl_read, .write = tracing_ctrl_write, + .llseek = generic_file_llseek, };static const struct file_operations set_tracer_fops = { .open = tracing_open_generic, .read = tracing_set_trace_read, .write = tracing_set_trace_write, + .llseek = generic_file_llseek, };static const struct file_operations tracing_pipe_fops = {
@@ -3610,17 +3618,20 @@ static const struct file_operations tracing_pipe_fops = { .read = tracing_read_pipe, .splice_read = tracing_splice_read_pipe, .release = tracing_release_pipe, + .llseek = no_llseek, };static const struct file_operations tracing_entries_fops = { .open = tracing_open_generic, .read = tracing_entries_read, .write = tracing_entries_write, + .llseek = generic_file_llseek, };static const struct file_operations tracing_mark_fops = { .open = tracing_open_generic, .write = tracing_mark_write, + .llseek = generic_file_llseek, };static const struct file_operations trace_clock_fops = {
@@ -3926,6 +3937,7 @@ tracing_stats_read(struct file *filp, char __user *ubuf,static const struct file_operations tracing_stats_fops = { .open = tracing_open_generic, .read = tracing_stats_read, + .llseek = generic_file_llseek, };#ifdef CONFIG_DYNAMIC_FTRACE
@@ -3962,6 +3974,7 @@ tracing_read_dyn_info(struct file *filp, char __user *ubuf,static const struct file_operations tracing_dyn_info_fops = { .open = tracing_open_generic, .read = tracing_read_dyn_info, + .llseek = generic_file_llseek, };#endif
@@ -4115,6 +4128,7 @@ static const struct file_operations trace_options_fops = { .open = tracing_open_generic, .read = trace_options_read, .write = trace_options_write, + .llseek = generic_file_llseek, }; static ssize_t
@@ -4166,6 +4180,7 @@ static const struct file_operations trace_options_core_fops = { .open = tracing_open_generic, .read = trace_options_core_read, .write = trace_options_core_write, + .llseek = generic_file_llseek, }; struct dentry *trace_create_file(const char *name,
Signature · 1 line
1.7.1
Frederic Weisbecker
AppliedRe: [PATCH 09/18] tracing: use generic_file_llseek for debugfs
Quoted 80 lines · Arnd Bergmann
The default for llseek will change to
no_llseek, so the tracing debugfs files need to add explicit .llseek assignments. Since we're dealing with regular files from a VFS perspective, usegeneric_file_llseek.Signed-off-by Arnd Bergmann <[email protected]>Cc Steven Rostedt <[email protected]>Cc Frederic Weisbecker <[email protected]>Cc Ingo Molnar <[email protected]>--- kernel/trace/trace.c | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-)kernel/trace/trace.c +8
-0@@ -2394,6 +2394,7 @@ static const struct file_operations show_traces_fops = { .open = show_traces_open, .read = seq_read, .release = seq_release, + .llseek = seq_lseek, };/* @@ -2487,6 +2488,7 @@ static const struct file_operations tracing_cpumask_fops = { .open = tracing_open_generic, .read = tracing_cpumask_read, .write = tracing_cpumask_write, + .llseek = generic_file_llseek, };static int tracing_trace_options_show (struct seq_file *m,void *v)@@ -2653,6 +2655,7 @@ tracing_readme_read(struct file *filp, char __user *ubuf,static const struct file_operations tracing_readme_fops = { .open = tracing_open_generic, .read = tracing_readme_read, + .llseek = generic_file_llseek, }; static ssize_t@@ -2703,6 +2706,7 @@ tracing_saved_cmdlines_read(struct file *file, char __user *ubuf,static const struct file_operations tracing_saved_cmdlines_fops = { .open = tracing_open_generic, .read = tracing_saved_cmdlines_read, + .llseek = generic_file_llseek, }; static ssize_t@@ -3032,6 +3036,7 @@ static int tracing_open_pipe(struct inode *inode, struct file *filp)if (iter->trace->pipe_open) iter->trace->pipe_open (iter); +nonseekable_open (inode, filp); out:mutex_unlock (&trace_types_lock);return ret;@@ -3590,18 +3595,21 @@ static const struct file_operations tracing_max_lat_fops = { .open = tracing_open_generic, .read = tracing_max_lat_read, .write = tracing_max_lat_write, + .llseek = generic_file_llseek, };static const struct file_operations tracing_ctrl_fops = { .open = tracing_open_generic, .read = tracing_ctrl_read, .write = tracing_ctrl_write, + .llseek = generic_file_llseek, };static const struct file_operations set_tracer_fops = { .open = tracing_open_generic, .read = tracing_set_trace_read, .write = tracing_set_trace_write, + .llseek = generic_file_llseek, };static const struct file_operations tracing_pipe_fops = {
kernel/trace/trace.c static const struct file_operations tracing_pipe_fops = { · line 3621
Quoted 4 lines
kernel/trace/trace.c +1
-0@@ -3610,17 +3618,20 @@ static const struct file_operations tracing_pipe_fops = { .read = tracing_read_pipe, .splice_read = tracing_splice_read_pipe, .release = tracing_release_pipe, + .llseek = no_llseek,
If you use nonseekable_open you don't need no_llseek there. That said I'm all for keeping this as it's easier to grep fops that lack a proper llseek callback with that.
Quoted 51 lines
kernel/trace/trace.c +6
-0};static const struct file_operations tracing_entries_fops = { .open = tracing_open_generic, .read = tracing_entries_read, .write = tracing_entries_write, + .llseek = generic_file_llseek, };static const struct file_operations tracing_mark_fops = { .open = tracing_open_generic, .write = tracing_mark_write, + .llseek = generic_file_llseek, };static const struct file_operations trace_clock_fops = {@@ -3926,6 +3937,7 @@ tracing_stats_read(struct file *filp, char __user *ubuf,static const struct file_operations tracing_stats_fops = { .open = tracing_open_generic, .read = tracing_stats_read, + .llseek = generic_file_llseek, };#ifdef CONFIG_DYNAMIC_FTRACE @@ -3962,6 +3974,7 @@ tracing_read_dyn_info(struct file *filp, char __user *ubuf,static const struct file_operations tracing_dyn_info_fops = { .open = tracing_open_generic, .read = tracing_read_dyn_info, + .llseek = generic_file_llseek, };#endif @@ -4115,6 +4128,7 @@ static const struct file_operations trace_options_fops = { .open = tracing_open_generic, .read = trace_options_read, .write = trace_options_write, + .llseek = generic_file_llseek, }; static ssize_t@@ -4166,6 +4180,7 @@ static const struct file_operations trace_options_core_fops = { .open = tracing_open_generic, .read = trace_options_core_read, .write = trace_options_core_write, + .llseek = generic_file_llseek, }; struct dentry *trace_create_file(const char *name,Signature · 1 line
1.7.1
Applied, thanks Arnd!
tip-bot for Arnd Bergmann
maintainer[tip:perf/core] tracing: Use generic_file_llseek for debugfs
In reply to Arnd BergmannCommit-ID: b444786f1a797a7f84e2561346a670649f9c7b3c Gitweb: http://git.kernel.org/tip/b444786f1a797a7f84e2561346a670649f9c7b3c Author: Arnd Bergmann <[email protected]> AuthorDate: Wed, 7 Jul 2010 23:40:11 +0200 Committer: Frederic Weisbecker <[email protected]> CommitDate: Tue, 20 Jul 2010 14:31:24 +0200
tracing: Use generic_file_llseek for debugfs
The default for llseek will change to no_llseek, so the tracing debugfs files need to add explicit .llseek assignments. Since we're dealing with regular files from a VFS perspective, use generic_file_llseek.
LKML-Reference: <[email protected]>
--- kernel/trace/trace.c | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-)
kernel/trace/trace.c +15 -0
@@ -2338,6 +2338,7 @@ static const struct file_operations show_traces_fops = { .open = show_traces_open, .read = seq_read, .release = seq_release, + .llseek = seq_lseek, };/*
@@ -2431,6 +2432,7 @@ static const struct file_operations tracing_cpumask_fops = { .open = tracing_open_generic, .read = tracing_cpumask_read, .write = tracing_cpumask_write, + .llseek = generic_file_llseek, };static int tracing_trace_options_show (struct seq_file *m,void *v)
@@ -2597,6 +2599,7 @@ tracing_readme_read(struct file *filp, char __user *ubuf,static const struct file_operations tracing_readme_fops = { .open = tracing_open_generic, .read = tracing_readme_read, + .llseek = generic_file_llseek, }; static ssize_t
@@ -2647,6 +2650,7 @@ tracing_saved_cmdlines_read(struct file *file, char __user *ubuf,static const struct file_operations tracing_saved_cmdlines_fops = { .open = tracing_open_generic, .read = tracing_saved_cmdlines_read, + .llseek = generic_file_llseek, }; static ssize_t
@@ -2976,6 +2980,7 @@ static int tracing_open_pipe(struct inode *inode, struct file *filp)if (iter->trace->pipe_open) iter->trace->pipe_open (iter); +nonseekable_open (inode, filp); out:mutex_unlock (&trace_types_lock);return ret;
@@ -3534,18 +3539,21 @@ static const struct file_operations tracing_max_lat_fops = { .open = tracing_open_generic, .read = tracing_max_lat_read, .write = tracing_max_lat_write, + .llseek = generic_file_llseek, };static const struct file_operations tracing_ctrl_fops = { .open = tracing_open_generic, .read = tracing_ctrl_read, .write = tracing_ctrl_write, + .llseek = generic_file_llseek, };static const struct file_operations set_tracer_fops = { .open = tracing_open_generic, .read = tracing_set_trace_read, .write = tracing_set_trace_write, + .llseek = generic_file_llseek, };static const struct file_operations tracing_pipe_fops = {
@@ -3554,17 +3562,20 @@ static const struct file_operations tracing_pipe_fops = { .read = tracing_read_pipe, .splice_read = tracing_splice_read_pipe, .release = tracing_release_pipe, + .llseek = no_llseek, };static const struct file_operations tracing_entries_fops = { .open = tracing_open_generic, .read = tracing_entries_read, .write = tracing_entries_write, + .llseek = generic_file_llseek, };static const struct file_operations tracing_mark_fops = { .open = tracing_open_generic, .write = tracing_mark_write, + .llseek = generic_file_llseek, };static const struct file_operations trace_clock_fops = {
@@ -3870,6 +3881,7 @@ tracing_stats_read(struct file *filp, char __user *ubuf,static const struct file_operations tracing_stats_fops = { .open = tracing_open_generic, .read = tracing_stats_read, + .llseek = generic_file_llseek, };#ifdef CONFIG_DYNAMIC_FTRACE
@@ -3906,6 +3918,7 @@ tracing_read_dyn_info(struct file *filp, char __user *ubuf,static const struct file_operations tracing_dyn_info_fops = { .open = tracing_open_generic, .read = tracing_read_dyn_info, + .llseek = generic_file_llseek, };#endif
@@ -4059,6 +4072,7 @@ static const struct file_operations trace_options_fops = { .open = tracing_open_generic, .read = trace_options_read, .write = trace_options_write, + .llseek = generic_file_llseek, }; static ssize_t
@@ -4110,6 +4124,7 @@ static const struct file_operations trace_options_core_fops = { .open = tracing_open_generic, .read = trace_options_core_read, .write = trace_options_core_write, + .llseek = generic_file_llseek, }; struct dentry *trace_create_file(const char *name,
Arnd Bergmann
maintainerPATCH 10/18 ibmasmfs: use generic_file_llseek
In reply to Arnd BergmannThe default for llseek will change to no_llseek, so ibmasmfs needs to add explicit .llseek assignments. Since we're dealing with regular files from a VFS perspective, use generic_file_llseek.
--- drivers/misc/ibmasm/ibmasmfs.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/misc/ibmasm/ibmasmfs.c +4 -0
@@ -584,6 +584,7 @@ static const struct file_operations command_fops = { .release = command_file_close, .read = command_file_read, .write = command_file_write, + .llseek = generic_file_llseek, };static const struct file_operations event_fops = {
@@ -591,6 +592,7 @@ static const struct file_operations event_fops = { .release = event_file_close, .read = event_file_read, .write = event_file_write, + .llseek = generic_file_llseek, };static const struct file_operations r_heartbeat_fops = {
@@ -598,6 +600,7 @@ static const struct file_operations r_heartbeat_fops = { .release = r_heartbeat_file_close, .read = r_heartbeat_file_read, .write = r_heartbeat_file_write, + .llseek = generic_file_llseek, };static const struct file_operations remote_settings_fops = {
@@ -605,6 +608,7 @@ static const struct file_operations remote_settings_fops = { .release = remote_settings_file_close, .read = remote_settings_file_read, .write = remote_settings_file_write, + .llseek = generic_file_llseek, };
Signature · 1 line
1.7.1
Arnd Bergmann
maintainerPATCH 11/18 oprofile: make event buffer nonseekable
In reply to Arnd BergmannThe event buffer cannot deal with seeks, so
we should forbid that outright.
--- drivers/oprofile/event_buffer.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/oprofile/event_buffer.c +2 -1
@@ -135,7 +135,7 @@ static int event_buffer_open(struct inode *inode, struct file *file)* echo 1 >/dev/oprofile/enable */ -return 0 ; +return nonseekable_open (inode, file); fail:dcookie_unregister (file->private_data);
@@ -205,4 +205,5 @@ const struct file_operations event_buffer_fops = { .open = event_buffer_open, .release = event_buffer_release, .read = event_buffer_read, + .llseek = no_llseek, };
Signature · 1 line
1.7.1
Re: [PATCH 11/18] oprofile: make event buffer nonseekable
Quoted 6 lines · Arnd Bergmann
The event buffer cannot deal with seeks, so
we should forbid that outright.Signed-off-by Arnd Bergmann <[email protected]>Cc Robert Richter <[email protected]>
Thanks Arnd,
-Robert
Signature · 2 lines
Advanced Micro Devices, Inc. Operating System Research Center
Re: [PATCH 11/18] oprofile: make event buffer nonseekable
In reply to Arnd BergmannQuoted 6 lines · Arnd Bergmann
The event buffer cannot deal with seeks, so
we should forbid that outright.Signed-off-by Arnd Bergmann <[email protected]>Cc Robert Richter <[email protected]>
Applied to:
git://git.kernel.org/pub/scm/linux/kernel/git/rric/oprofile.git core
Thanks Arnd.
-Robert
Signature · 2 lines
Advanced Micro Devices, Inc. Operating System Research Center
Arnd Bergmann
maintainerPATCH 12/18 raw: use explicit llseek file operations
In reply to Arnd BergmannThe raw_fops may need to seek, so there should be an explicit reference to default_llseek. raw_ctl_fops does not contain a read or write method, so we use noop_llseek to ignore seeking requests without an error.
--- drivers/char/raw.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/char/raw.c +2 -0
@@ -258,6 +258,7 @@ static const struct file_operations raw_fops = { .open = raw_open, .release = raw_release, .unlocked_ioctl = raw_ioctl, + .llseek = default_llseek, .owner = THIS_MODULE, };
@@ -265,6 +266,7 @@ static const struct file_operations raw_ctl_fops = { .unlocked_ioctl = raw_ctl_ioctl, .open = raw_open, .owner = THIS_MODULE, + .llseek = noop_llseek, };static struct cdev raw_cdev;
Signature · 1 line
1.7.1
Frederic Weisbecker
AppliedRe: [PATCH 12/18] raw: use explicit llseek file operations
Quoted 7 lines · Arnd Bergmann
The
raw_fopsmay need to seek, so there should be an explicit reference todefault_llseek.raw_ctl_fopsdoes not contain a read or write method, so we usenoop_llseekto ignore seeking requests without an error.Signed-off-by Arnd Bergmann <[email protected]>
Applied in a new branch: bkl/llseek, I will propose it for -next soon.
Thanks.
Arnd Bergmann
maintainerPATCH 13/18 ima: use generic_file_llseek for securityfs
In reply to Arnd BergmannThe default for llseek will change to no_llseek, so securityfs users need to add explicit .llseek assignments. Since we're dealing with regular files from a VFS perspective, use generic_file_llseek.
--- security/integrity/ima/ima_fs.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-)
security/integrity/ima/ima_fs.c +6 -3
@@ -45,7 +45,8 @@ static ssize_t ima_show_htable_violations(struct file *filp, }static const struct file_operations ima_htable_violations_ops = { - .read = ima_show_htable_violations + .read = ima_show_htable_violations, + .llseek = generic_file_llseek, }; static ssize_t ima_show_measurements_count(struct file *filp,
@@ -57,7 +58,8 @@ static ssize_t ima_show_measurements_count(struct file *filp, }static const struct file_operations ima_measurements_count_ops = { - .read = ima_show_measurements_count + .read = ima_show_measurements_count, + .llseek = generic_file_llseek, };/* returns pointer to hlist_node */
@@ -319,7 +321,8 @@ static int ima_release_policy(struct inode *inode, struct file *file)static const struct file_operations ima_measure_policy_ops = { .open = ima_open_policy, .write = ima_write_policy, - .release = ima_release_policy + .release = ima_release_policy, + .llseek = generic_file_llseek, };int __init ima_fs_init (void )
Signature · 1 line
1.7.1
Re: [PATCH 13/18] ima: use generic_file_llseek for securityfs
Quoted 9 lines · Arnd Bergmann
The default for llseek will change to
no_llseek, so securityfs users need to add explicit .llseek assignments. Since we're dealing with regular files from a VFS perspective, usegeneric_file_llseek.Signed-off-by Arnd Bergmann <[email protected]>Cc Mimi Zohar <[email protected]>Cc James Morris <[email protected]>
As both the 'violations' and 'runtime_measurement_counts' are single values and 'policy' doesn't support read, this patch doesn't hurt, but adding .llseek is probably unnecessary.
thanks,
Mimi
Quoted 38 lines
--- security/integrity/ima/ima_fs.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-)security/integrity/ima/ima_fs.c +6
-3@@ -45,7 +45,8 @@ static ssize_t ima_show_htable_violations(struct file *filp, }static const struct file_operations ima_htable_violations_ops = { - .read = ima_show_htable_violations + .read = ima_show_htable_violations, + .llseek = generic_file_llseek, }; static ssize_t ima_show_measurements_count(struct file *filp,@@ -57,7 +58,8 @@ static ssize_t ima_show_measurements_count(struct file *filp, }static const struct file_operations ima_measurements_count_ops = { - .read = ima_show_measurements_count + .read = ima_show_measurements_count, + .llseek = generic_file_llseek, };/* returns pointer to hlist_node */ @@ -319,7 +321,8 @@ static int ima_release_policy(struct inode *inode, struct file *file)static const struct file_operations ima_measure_policy_ops = { .open = ima_open_policy, .write = ima_write_policy, - .release = ima_release_policy + .release = ima_release_policy, + .llseek = generic_file_llseek, };int __init ima_fs_init (void )
Arnd Bergmann
maintainerRe: [PATCH 13/18] ima: use generic_file_llseek for securityfs
Quoted 9 lines · Mimi Zohar
Quoted 4 lines · Arnd Bergmann
The default for llseek will change to
no_llseek, so securityfs users need to add explicit .llseek assignments. Since we're dealing with regular files from a VFS perspective, usegeneric_file_llseek.As both the 'violations' and '
runtime_measurement_counts' are single values and 'policy' doesn't support read, this patch doesn't hurt, but adding .llseek is probably unnecessary.
Ok, thanks for the confirmation.
Are you applying the patch in your tree, or should I keep it in my series?
Note that while it may not be necessary to add these specific .llseek operations, the reason I'm doing it is because I want to provably have a .llseek operation in every file_operation in the kernel before the default gets changed.
Arnd
Re: [PATCH 13/18] ima: use generic_file_llseek for securityfs
Quoted 7 lines · Arnd Bergmann
Quoted 6 lines · Mimi Zohar
Quoted 4 lines · Arnd Bergmann
The default for llseek will change to
no_llseek, so securityfs users need to add explicit .llseek assignments. Since we're dealing with regular files from a VFS perspective, usegeneric_file_llseek.
Quoted 8 lines
Quoted 3 lines
As both the 'violations' and '
runtime_measurement_counts' are single values and 'policy' doesn't support read, this patch doesn't hurt, but adding .llseek is probably unnecessary.Ok, thanks for the confirmation.
Are you applying the patch in your tree, or should I keep it in my series?
I'll leave that up to James.
Quoted 6 lines
Note that while it may not be necessary to add these specific .llseek operations, the reason I'm doing it is because I want to provably have a .llseek operation in every
file_operationin the kernel before the default gets changed.Arnd
Thanks for the clarification.
Mimi
James Morris
maintainerRe: [PATCH 13/18] ima: use generic_file_llseek for securityfs
Quoted 12 lines · Mimi Zohar
Quoted 11 lines · Arnd Bergmann
Quoted 9 lines · Mimi Zohar
Quoted 4 lines · Arnd Bergmann
The default for llseek will change to
no_llseek, so securityfs users need to add explicit .llseek assignments. Since we're dealing with regular files from a VFS perspective, usegeneric_file_llseek.As both the 'violations' and '
runtime_measurement_counts' are single values and 'policy' doesn't support read, this patch doesn't hurt, but adding .llseek is probably unnecessary.
Quoted 6 lines
Quoted 4 lines
Ok, thanks for the confirmation.
Are you applying the patch in your tree, or should I keep it in my series?
I'll leave that up to James.
I can take the patches, depends on what Arnd thinks is best.
Quoted 12 lines
Quoted 7 lines
Note that while it may not be necessary to add these specific .llseek operations, the reason I'm doing it is because I want to provably have a .llseek operation in every
file_operationin the kernel before the default gets changed.Arnd
Thanks for the clarification.
Mimi
Signature · 2 lines
James Morris <[email protected]>
Arnd Bergmann
maintainerRe: [PATCH 13/18] ima: use generic_file_llseek for securityfs
Quoted 5 lines · James Morris
Quoted 2 lines · Mimi Zohar
I'll leave that up to James.
I can take the patches, depends on what Arnd thinks is best.
I'd prefer you to take it. I'll work out with Frederic what we do with the remaining patches, but ideally all maintainer should just take their bits from this series, there are no interdependencies except for the last two patches.
Arnd
James Morris
maintainerRe: [PATCH 13/18] ima: use generic_file_llseek for securityfs
In reply to Arnd BergmannQuoted 5 lines · Arnd Bergmann
The default for llseek will change to
no_llseek, so securityfs users need to add explicit .llseek assignments. Since we're dealing with regular files from a VFS perspective, usegeneric_file_llseek.
Quoted 7 lines
Signed-off-by Arnd Bergmann <[email protected]>Cc Mimi Zohar <[email protected]>Cc James Morris <[email protected]>--- security/integrity/ima/ima_fs.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-)
Applied togit://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6#next
Signature · 2 lines
James Morris <[email protected]>
Arnd Bergmann
maintainerPATCH 14/18 irda/irnet: use noop_llseek
In reply to Arnd BergmannThere may be applications trying to seek on the irnet character device, so we should use noop_llseek to avoid returning an error when the default llseek changes to no_llseek.
--- net/irda/irnet/irnet_ppp.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
net/irda/irnet/irnet_ppp.h +1 -0
@@ -104,6 +104,7 @@ static const struct file_operations irnet_device_fops = .unlocked_ioctl = dev_irnet_ioctl, .open = dev_irnet_open, .release = dev_irnet_close + .llseek = noop_llseek,/* Also : llseek, readdir, mmap, flush, fsync, fasync, lock, readv, writev */ };
Signature · 1 line
1.7.1
Arnd Bergmann
maintainerPATCH 15/18 viotape: use noop_llseek
In reply to Arnd BergmannSome applications try to seek on tape devices and fail if they return an error. Since we want to change the default llseek action to no_llseek, viotape needs to be changed to use noop_llseek explicitly.
--- drivers/char/viotape.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/char/viotape.c +1 -0
@@ -804,6 +804,7 @@ const struct file_operations viotap_fops = { .unlocked_ioctl = viotap_unlocked_ioctl, .open = viotap_open, .release = viotap_release, + .llseek = noop_llseek, };/* Handle interrupt events for tape */
Signature · 1 line
1.7.1
Frederic Weisbecker
AppliedRe: [PATCH 15/18] viotape: use noop_llseek
Quoted 7 lines · Arnd Bergmann
Some applications try to seek on tape devices and fail if they return an error. Since we want to change the default llseek action to
no_llseek, viotape needs to be changed to usenoop_llseekexplicitly.Signed-off-by Arnd Bergmann <[email protected]>
Applied, thanks.
Arnd Bergmann
maintainerPATCH 16/18 llseek: automatically add .llseek fop
In reply to Arnd BergmannAll file_operations should get a .llseek operation so we can make nonseekable_open the default for future file operations without a .llseek pointer.
The three cases that we can automatically detect are no_llseek, seq_lseek and default_llseek. For cases where we can we can automatically prove that the file offset is always ignored, we use noop_llseek, which maintains the current behavior of not returning an error from a seek.
New drivers should normally not use noop_llseek but instead use no_llseek and call nonseekable_open at open time. Existing drivers can be converted to do the same when the maintainer knows for certain that no user code relies on calling seek on the device file.
The generated code is often incorrectly indented and right now contains comments that clarify for each added line why a specific variant was chosen. In the version that gets submitted upstream, the comments will be gone and I will manually fix the indentation, because there does not seem to be a way to do that using coccinelle.
Some amount of new code is currently sitting in linux-next that should get the same modifications, which I will do at the end of the merge window.
This specific posted version of the patch only covers first few files in order to avoid spamming everybody's inbox. I think you still get the point. The diffstat is complete, and the full patch is available in the 'llseek' branch ofgit://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl.git
Many thanks to Julia Lawall for helping me learn to write a semantic patch that does all this.
===== begin semantic patch =====
// This adds an llseek= method to all file operations, // as a preparation for making no_llseek the default. //
// The rules are
// - use no_llseek explicitly if we do nonseekable_open // - use seq_lseek for sequential files
// - use default_llseek if we know we access f_pos // - use noop_llseek if we know we don't access f_pos,
// but we still want to allow users to call lseek
//
@ open1 exists @
identifier nested_open;
@@nested_open(...)
{
<+...nonseekable_open(...)
...+>
}
@ open exists@
identifier open_f;
identifier i, f;
identifier open1.nested_open;
@@
int open_f(struct inode *i, struct file *f) {
<+...
(nonseekable_open(...)
|nested_open(...)
)
...+>
}
@ read disable optional_qualifier exists @ identifier read_f;
identifier f, p, s, off;
type ssize_t, size_t, loff_t;
expression E;
identifier func;
@@ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off) {
<+...
(
*off = E
|
*off += E
|
func(..., off, ...)
|
E = *off
)
...+>
}
@ read_no_fpos disable optional_qualifier exists @ identifier read_f;
identifier f, p, s, off;
type ssize_t, size_t, loff_t;
@@ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off) {
... when != off
}
@ write @
identifier write_f;
identifier f, p, s, off;
type ssize_t, size_t, loff_t;
expression E;
identifier func;
@@ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off) {
<+...
(
*off = E
|
*off += E
|
func(..., off, ...)
|
E = *off
)
...+>
}
@ write_no_fpos @
identifier write_f;
identifier f, p, s, off;
type ssize_t, size_t, loff_t;
@@ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off) {
... when != off
}
@ fops0 @
identifier fops;
@@
struct file_operations fops = {
...
};
@ has_llseek depends on fops0 @
identifier fops0.fops;
identifier llseek_f;
@@
struct file_operations fops = {
...
.llseek = llseek_f,
...
};
@ has_read depends on fops0 @
identifier fops0.fops;
identifier read_f;
@@
struct file_operations fops = {
...
.read = read_f,
...
};
@ has_write depends on fops0 @
identifier fops0.fops;
identifier write_f;
@@
struct file_operations fops = {
...
.write = write_f,
...
};
@ has_open depends on fops0 @
identifier fops0.fops;
identifier open_f;
@@
struct file_operations fops = {
...
.open = open_f,
...
};
// use no_llseek if we call nonseekable_open //////////////////////////////////////////// @ nonseekable1 depends on !has_llseek && has_open @ identifier fops0.fops;
identifier nso ~= "nonseekable_open";
@@
struct file_operations fops = {
... .open = nso, ...
+.llseek = no_llseek, /* nonseekable */
};
@ nonseekable2 depends on !has_llseek @ identifier fops0.fops;
identifier open.open_f;
@@
struct file_operations fops = {
... .open = open_f, ...
+.llseek = no_llseek, /* open uses nonseekable */ };
// use seq_lseek for sequential files ///////////////////////////////////// @ seq depends on !has_llseek @ identifier fops0.fops;
identifier sr ~= "seq_read";
@@
struct file_operations fops = {
... .read = sr, ...
+.llseek = seq_lseek, /* we have seq_read */ };
// use default_llseek if there is a readdir ///////////////////////////////////////////
@ fops1 depends on !has_llseek && !nonseekable1 && !nonseekable2 && !seq @ identifier fops0.fops;
identifier readdir_e;
@@
// any other fop is used that changes pos
struct file_operations fops = {
... .readdir = readdir_e, ...
+.llseek = default_llseek, /* readdir is present */
};
// use default_llseek if at least one of read/write touches f_pos /////////////////////////////////////////////////////////////////
@ fops2 depends on !fops1 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @ identifier fops0.fops;
identifier read.read_f;
@@
// read fops use offset
struct file_operations fops = {
... .read = read_f, ...
+.llseek = default_llseek, /* read accesses f_pos */
};
@ fops3 depends on !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @ identifier fops0.fops;
identifier write.write_f;
@@
// write fops use offset
struct file_operations fops = {
... .write = write_f, ...
+ .llseek = default_llseek, /* write accesses f_pos */
};
// Use noop_llseek if neither read nor write accesses f_pos ///////////////////////////////////////////////////////////
@ fops4 depends on !fops1 && !fops2 && !fops3 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @ identifier fops0.fops;
identifier read_no_fpos.read_f;
identifier write_no_fpos.write_f;
@@
// write fops use offset
struct file_operations fops = {
...
.write = write_f,
.read = read_f,
...
+.llseek = noop_llseek, /* read and write both use no f_pos */
};
@ depends on has_write && !has_read && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @ identifier fops0.fops;
identifier write_no_fpos.write_f;
@@
struct file_operations fops = {
... .write = write_f, ...
+.llseek = noop_llseek, /* write uses no f_pos */
};
@ depends on has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @ identifier fops0.fops;
identifier read_no_fpos.read_f;
@@
struct file_operations fops = {
... .read = read_f, ...
+.llseek = noop_llseek, /* read uses no f_pos */
};
@ depends on !has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @ identifier fops0.fops;
@@
struct file_operations fops = {
...
+.llseek = noop_llseek, /* no read or write fn */
};
===== End semantic patch =====
--- arch/arm/kernel/etm.c | 1 + arch/arm/mach-msm/last_radio_log.c | 3 +- arch/arm/mach-msm/smd_debug.c | 1 + arch/arm/plat-mxc/audmux-v2.c | 1 + arch/avr32/boards/mimc200/fram.c | 1 + arch/blackfin/kernel/kgdb_test.c | 1 + arch/blackfin/mach-bf561/coreb.c | 1 + arch/cris/arch-v10/drivers/ds1302.c | 1 + arch/cris/arch-v10/drivers/gpio.c | 1 + arch/cris/arch-v10/drivers/i2c.c | 1 + arch/cris/arch-v10/drivers/pcf8563.c | 1 + arch/cris/arch-v10/drivers/sync_serial.c | 3 +- arch/cris/arch-v32/drivers/cryptocop.c | 3 +- arch/cris/arch-v32/drivers/i2c.c | 1 + arch/cris/arch-v32/drivers/mach-a3/gpio.c | 1 + arch/cris/arch-v32/drivers/mach-fs/gpio.c | 1 + arch/cris/arch-v32/drivers/pcf8563.c | 1 + arch/cris/arch-v32/drivers/sync_serial.c | 3 +- arch/cris/kernel/profile.c | 1 + arch/ia64/kernel/salinfo.c | 2 + arch/ia64/sn/kernel/sn2/sn_hwperf.c | 1 + arch/m68k/bvme6000/rtc.c | 1 + arch/m68k/mvme16x/rtc.c | 1 + arch/mips/kernel/rtlx.c | 3 +- arch/mips/kernel/vpe.c | 3 +- arch/mips/sibyte/common/sb_tbprof.c | 1 + arch/powerpc/kernel/lparcfg.c | 1 + arch/powerpc/kernel/rtas_flash.c | 3 ++ arch/powerpc/kernel/rtasd.c | 1 + arch/powerpc/platforms/iseries/mf.c | 1 + arch/powerpc/platforms/pseries/reconfig.c | 3 +- arch/powerpc/platforms/pseries/scanlog.c | 1 + arch/s390/crypto/prng.c | 1 + arch/s390/hypfs/hypfs_diag.c | 1 + arch/s390/hypfs/hypfs_vm.c | 1 + arch/s390/hypfs/inode.c | 1 + arch/s390/kernel/debug.c | 1 + arch/sh/boards/mach-landisk/gio.c | 1 + arch/sparc/kernel/apc.c | 1 + arch/sparc/kernel/mdesc.c | 1 + arch/um/drivers/harddog_kern.c | 1 + arch/um/drivers/mconsole_kern.c | 1 + arch/um/drivers/mmapper_kern.c | 1 + arch/um/drivers/random.c | 1 + arch/x86/kernel/apm_32.c | 1 + arch/x86/kernel/cpu/mcheck/mce-severity.c | 1 + arch/x86/kernel/cpu/mcheck/mce.c | 1 + arch/x86/kernel/kdebugfs.c | 1 + arch/x86/kernel/microcode_core.c | 1 + arch/x86/xen/debugfs.c | 1 + block/bsg.c | 1 + drivers/acpi/debug.c | 1 + drivers/acpi/event.c | 1 + drivers/acpi/system.c | 2 + drivers/block/DAC960.c | 3 +- drivers/block/aoe/aoechr.c | 1 + drivers/block/paride/pg.c | 1 + drivers/block/paride/pt.c | 1 + drivers/block/pktcdvd.c | 1 + drivers/bluetooth/btmrvl_debugfs.c | 10 +++++++ drivers/bluetooth/hci_vhci.c | 1 + drivers/char/apm-emulation.c | 1 + drivers/char/bfin-otp.c | 1 + drivers/char/briq_panel.c | 1 + drivers/char/bsr.c | 1 + drivers/char/cs5535_gpio.c | 3 +- drivers/char/ds1302.c | 1 + drivers/char/ds1620.c | 1 + drivers/char/dsp56k.c | 1 + drivers/char/dtlk.c | 1 + drivers/char/genrtc.c | 1 + drivers/char/hw_random/core.c | 1 + drivers/char/ip2/ip2main.c | 1 + drivers/char/ipmi/ipmi_devintf.c | 1 + drivers/char/ipmi/ipmi_watchdog.c | 1 + drivers/char/istallion.c | 1 + drivers/char/lp.c | 1 + drivers/char/mem.c | 3 ++ drivers/char/misc.c | 1 + drivers/char/mmtimer.c | 1 + drivers/char/mspec.c | 9 ++++-- drivers/char/mwave/mwavedd.c | 3 +- drivers/char/nwbutton.c | 1 + drivers/char/pc8736x_gpio.c | 1 + drivers/char/pcmcia/cm4000_cs.c | 1 + drivers/char/pcmcia/cm4040_cs.c | 1 + drivers/char/random.c | 2 + drivers/char/rio/rio_linux.c | 1 + drivers/char/scx200_gpio.c | 1 + drivers/char/snsc.c | 1 + drivers/char/stallion.c | 1 + drivers/char/sx.c | 1 + drivers/char/sysrq.c | 1 + drivers/char/tb0219.c | 1 + drivers/char/tlclk.c | 1 + drivers/char/toshiba.c | 1 + drivers/char/uv_mmtimer.c | 1 + drivers/char/virtio_console.c | 3 ++ drivers/char/xilinx_hwicap/xilinx_hwicap.c | 1 + drivers/dma/coh901318.c | 1 + drivers/gpu/drm/drm_drv.c | 3 +- drivers/gpu/drm/i810/i810_dma.c | 1 + drivers/gpu/drm/i830/i830_dma.c | 1 + drivers/gpu/drm/i915/i915_debugfs.c | 1 + drivers/gpu/vga/vgaarb.c | 1 + drivers/hid/hid-debug.c | 1 + drivers/hid/hid-roccat.c | 1 + drivers/hid/hidraw.c | 1 + drivers/hid/usbhid/hiddev.c | 1 + drivers/hwmon/asus_atk0110.c | 1 + drivers/ide/ide-tape.c | 1 + drivers/idle/i7300_idle.c | 1 + drivers/infiniband/hw/cxgb4/device.c | 1 + drivers/infiniband/hw/ipath/ipath_diag.c | 4 ++- drivers/infiniband/hw/ipath/ipath_file_ops.c | 3 +- drivers/infiniband/hw/ipath/ipath_fs.c | 3 ++ drivers/infiniband/hw/qib/qib_diag.c | 4 ++- drivers/infiniband/hw/qib/qib_file_ops.c | 3 +- drivers/infiniband/hw/qib/qib_fs.c | 1 + drivers/input/evdev.c | 3 +- drivers/input/input.c | 1 + drivers/input/joydev.c | 1 + drivers/input/misc/uinput.c | 1 + drivers/input/mousedev.c | 1 + drivers/input/serio/serio_raw.c | 1 + drivers/isdn/mISDN/timerdev.c | 1 + drivers/lguest/lguest_user.c | 1 + drivers/macintosh/ans-lcd.c | 1 + drivers/macintosh/via-pmu.c | 1 + drivers/md/dm-ioctl.c | 1 + drivers/media/IR/imon.c | 6 +++- drivers/media/dvb/bt8xx/dst_ca.c | 3 +- drivers/media/dvb/dvb-core/dmxdev.c | 2 + drivers/media/dvb/dvb-core/dvb_ca_en50221.c | 1 + drivers/media/dvb/dvb-core/dvb_frontend.c | 3 +- drivers/media/dvb/dvb-core/dvb_net.c | 1 + drivers/media/dvb/dvb-core/dvbdev.c | 1 + drivers/media/dvb/firewire/firedtv-ci.c | 1 + drivers/media/dvb/ttpci/av7110.c | 1 + drivers/media/dvb/ttpci/av7110_av.c | 2 + drivers/media/dvb/ttpci/av7110_ca.c | 1 + drivers/media/dvb/ttpci/av7110_ir.c | 1 + drivers/mfd/ab3100-core.c | 1 + drivers/misc/hpilo.c | 1 + drivers/misc/phantom.c | 1 + drivers/misc/sgi-gru/grufile.c | 1 + drivers/mmc/core/debugfs.c | 1 + drivers/mtd/ubi/cdev.c | 1 + drivers/net/cxgb4/cxgb4_main.c | 1 + drivers/net/ppp_generic.c | 3 +- drivers/net/wimax/i2400m/debugfs.c | 2 + drivers/net/wireless/airo.c | 24 ++++++++++++------ drivers/net/wireless/ath/ath5k/debug.c | 6 ++++ drivers/net/wireless/ath/ath9k/debug.c | 33 ++++++++++++++++-------- drivers/net/wireless/ath/ath9k/htc_drv_main.c | 9 ++++-- drivers/net/wireless/iwlwifi/iwl-3945-rs.c | 1 + drivers/net/wireless/iwlwifi/iwl-agn-rs.c | 3 ++ drivers/net/wireless/iwmc3200wifi/debugfs.c | 4 +++ drivers/net/wireless/iwmc3200wifi/sdio.c | 1 + drivers/net/wireless/libertas/debugfs.c | 1 + drivers/net/wireless/ray_cs.c | 2 + drivers/net/wireless/rt2x00/rt2x00debug.c | 4 +++ drivers/net/wireless/wl12xx/wl1251_debugfs.c | 2 + drivers/net/wireless/wl12xx/wl1271_debugfs.c | 4 ++- drivers/oprofile/oprofile_files.c | 8 +++++- drivers/oprofile/oprofilefs.c | 3 ++ drivers/pci/pcie/aer/aer_inject.c | 1 + drivers/pcmcia/pcmcia_ioctl.c | 1 + drivers/platform/x86/sony-laptop.c | 1 + drivers/rtc/rtc-m41t80.c | 1 + drivers/s390/block/dasd_eer.c | 1 + drivers/s390/char/fs3270.c | 1 + drivers/s390/char/monreader.c | 1 + drivers/s390/char/monwriter.c | 1 + drivers/s390/char/tape_char.c | 1 + drivers/s390/char/vmcp.c | 1 + drivers/s390/char/vmlogrdr.c | 1 + drivers/s390/char/vmwatchdog.c | 1 + drivers/s390/char/zcore.c | 2 + drivers/s390/cio/chsc_sch.c | 1 + drivers/s390/cio/css.c | 1 + drivers/s390/crypto/zcrypt_api.c | 3 +- drivers/s390/scsi/zfcp_cfdc.c | 3 +- drivers/sbus/char/display7seg.c | 1 + drivers/sbus/char/envctrl.c | 1 + drivers/scsi/3w-9xxx.c | 3 +- drivers/scsi/3w-sas.c | 3 +- drivers/scsi/3w-xxxx.c | 3 +- drivers/scsi/aacraid/linit.c | 1 + drivers/scsi/ch.c | 1 + drivers/scsi/dpt_i2o.c | 1 + drivers/scsi/gdth.c | 1 + drivers/scsi/megaraid.c | 1 + drivers/scsi/megaraid/megaraid_mm.c | 1 + drivers/scsi/megaraid/megaraid_sas.c | 1 + drivers/scsi/mpt2sas/mpt2sas_ctl.c | 1 + drivers/scsi/osd/osd_uld.c | 1 + drivers/scsi/pmcraid.c | 1 + drivers/scsi/qla2xxx/qla_os.c | 1 + drivers/scsi/scsi_tgt_if.c | 1 + drivers/scsi/sg.c | 1 + drivers/spi/dw_spi.c | 1 + drivers/spi/spidev.c | 1 + drivers/staging/batman-adv/device.c | 1 + drivers/staging/comedi/comedi_fops.c | 1 + drivers/staging/crystalhd/crystalhd_lnx.c | 1 + drivers/staging/dream/camera/msm_camera.c | 3 ++ drivers/staging/dream/pmem.c | 2 + drivers/staging/dream/qdsp5/adsp_driver.c | 1 + drivers/staging/dream/qdsp5/audio_aac.c | 1 + drivers/staging/dream/qdsp5/audio_amrnb.c | 1 + drivers/staging/dream/qdsp5/audio_evrc.c | 1 + drivers/staging/dream/qdsp5/audio_in.c | 2 + drivers/staging/dream/qdsp5/audio_mp3.c | 1 + drivers/staging/dream/qdsp5/audio_out.c | 2 + drivers/staging/dream/qdsp5/audio_qcelp.c | 1 + drivers/staging/dream/qdsp5/evlog.h | 1 + drivers/staging/dream/qdsp5/snd.c | 1 + drivers/staging/dt3155/dt3155_drv.c | 3 +- drivers/staging/frontier/alphatrack.c | 1 + drivers/staging/frontier/tranzport.c | 1 + drivers/staging/iio/industrialio-core.c | 1 + drivers/staging/iio/industrialio-ring.c | 1 + drivers/staging/memrar/memrar_handler.c | 1 + drivers/staging/panel/panel.c | 1 + drivers/staging/sep/sep_driver.c | 1 + drivers/telephony/ixj.c | 3 +- drivers/telephony/phonedev.c | 1 + drivers/uio/uio.c | 1 + drivers/usb/class/cdc-wdm.c | 3 +- drivers/usb/class/usblp.c | 1 + drivers/usb/class/usbtmc.c | 1 + drivers/usb/core/file.c | 1 + drivers/usb/gadget/f_hid.c | 1 + drivers/usb/gadget/printer.c | 3 +- drivers/usb/host/ehci-dbg.c | 3 ++ drivers/usb/host/ohci-dbg.c | 3 ++ drivers/usb/image/mdc800.c | 1 + drivers/usb/misc/adutux.c | 1 + drivers/usb/misc/idmouse.c | 1 + drivers/usb/misc/iowarrior.c | 1 + drivers/usb/misc/ldusb.c | 1 + drivers/usb/misc/rio500.c | 1 + drivers/usb/misc/usblcd.c | 1 + drivers/usb/usb-skeleton.c | 1 + drivers/vhost/net.c | 1 + drivers/video/fbmem.c | 1 + drivers/video/mbx/mbxdebugfs.c | 6 ++++ drivers/watchdog/ar7_wdt.c | 1 + drivers/watchdog/cpwd.c | 1 + drivers/watchdog/ep93xx_wdt.c | 1 + drivers/watchdog/omap_wdt.c | 1 + drivers/xen/evtchn.c | 1 + drivers/xen/xenfs/super.c | 1 + drivers/xen/xenfs/xenbus.c | 1 + fs/afs/mntpt.c | 1 + fs/autofs4/dev-ioctl.c | 1 + fs/binfmt_misc.c | 3 ++ fs/btrfs/super.c | 1 + fs/cachefiles/daemon.c | 1 + fs/char_dev.c | 1 + fs/coda/pioctl.c | 1 + fs/coda/psdev.c | 1 + fs/debugfs/file.c | 3 ++ fs/dlm/debug_fs.c | 3 +- fs/dlm/plock.c | 3 +- fs/dlm/user.c | 3 ++ fs/ecryptfs/file.c | 1 + fs/ecryptfs/miscdev.c | 1 + fs/eventfd.c | 1 + fs/eventpoll.c | 3 +- fs/fifo.c | 1 + fs/fuse/control.c | 4 +++ fs/fuse/cuse.c | 1 + fs/gfs2/file.c | 2 + fs/hppfs/hppfs.c | 1 + fs/hugetlbfs/inode.c | 1 + fs/logfs/dir.c | 1 + fs/nfsd/nfsctl.c | 1 + fs/no-block.c | 1 + fs/notify/inotify/inotify_user.c | 1 + fs/ntfs/file.c | 3 +- fs/ocfs2/dlmfs/dlmfs.c | 1 + fs/ocfs2/stack_user.c | 1 + fs/proc/base.c | 7 +++++ fs/proc/proc_sysctl.c | 1 + fs/proc/root.c | 1 + fs/proc/task_mmu.c | 1 + fs/romfs/super.c | 1 + fs/signalfd.c | 1 + fs/squashfs/dir.c | 3 +- fs/timerfd.c | 1 + fs/ubifs/debug.c | 1 + ipc/mqueue.c | 1 + ipc/shm.c | 2 + kernel/configs.c | 1 + kernel/gcov/fs.c | 1 + kernel/kprobes.c | 1 + kernel/pm_qos_params.c | 1 + kernel/profile.c | 1 + kernel/trace/blktrace.c | 2 + kernel/trace/ftrace.c | 2 + kernel/trace/ring_buffer.c | 1 + kernel/trace/trace_events.c | 7 +++++ kernel/trace/trace_ksym.c | 1 + kernel/trace/trace_stack.c | 1 + kernel/trace/trace_sysprof.c | 1 + lib/dma-debug.c | 1 + net/atm/proc.c | 1 + net/dccp/probe.c | 1 + net/ipv4/tcp_probe.c | 1 + net/mac80211/debugfs.c | 19 ++++++++++---- net/mac80211/rate.c | 1 + net/mac80211/rc80211_minstrel_debugfs.c | 1 + net/mac80211/rc80211_pid_debugfs.c | 1 + net/netfilter/xt_recent.c | 1 + net/nonet.c | 1 + net/rfkill/core.c | 1 + net/sctp/probe.c | 1 + net/socket.c | 1 + net/sunrpc/cache.c | 2 + net/wireless/debugfs.c | 1 + samples/tracepoints/tracepoint-sample.c | 1 + security/inode.c | 1 + security/smack/smackfs.c | 5 ++++ security/tomoyo/common.c | 1 + sound/core/seq/oss/seq_oss.c | 1 + sound/core/sound.c | 3 +- sound/oss/au1550_ac97.c | 2 + sound/oss/msnd_pinnacle.c | 1 + sound/oss/sh_dac_audio.c | 1 + sound/soc/soc-core.c | 1 + sound/soc/soc-dapm.c | 1 + sound/sound_core.c | 1 + virt/kvm/kvm_main.c | 3 ++ 335 files changed, 528 insertions(+), 69 deletions(-)
arch/arm/kernel/etm.c +1 -0
@@ -314,6 +314,7 @@ static const struct file_operations etb_fops = { .read = etb_read, .open = etb_open, .release = etb_release, + .llseek = no_llseek,/* open uses nonseekable */ };static struct miscdevice etb_miscdev = {
arch/arm/mach-msm/last_radio_log.c +2 -1
@@ -48,7 +48,8 @@ static ssize_t last_radio_log_read(struct file *file, char __user *buf, }static struct file_operations last_radio_log_fops = { - .read = last_radio_log_read + .read = last_radio_log_read, + .llseek = default_llseek,/* read accesses f_pos */ };void msm_init_last_radio_log (struct module *owner)
arch/arm/mach-msm/smd_debug.c +1 -0
@@ -212,6 +212,7 @@ static int debug_open(struct inode *inode, struct file *file)static const struct file_operations debug_ops = { .read = debug_read, .open = debug_open, + .llseek = default_llseek,/* read accesses f_pos */ }; static void debug_create(const char *name, mode_t mode,
arch/arm/plat-mxc/audmux-v2.c +1 -0
@@ -141,6 +141,7 @@ static ssize_t audmux_read_file(struct file *file, char __user *user_buf,static const struct file_operations audmux_debugfs_fops = { .open = audmux_open_file, .read = audmux_read_file, + .llseek = default_llseek,/* read accesses f_pos */ };static void audmux_debugfs_init (void )
arch/avr32/boards/mimc200/fram.c +1 -0
@@ -41,6 +41,7 @@ static int fram_mmap(struct file *filp, struct vm_area_struct *vma)static const struct file_operations fram_fops = { .owner =THIS_MODULE , .mmap = fram_mmap, + .llseek = noop_llseek,/* no read or write fn */ };#define FRAM_MINOR 0
arch/blackfin/kernel/kgdb_test.c +1 -0
@@ -88,6 +88,7 @@ static const struct file_operations kgdb_test_proc_fops = { .owner = THIS_MODULE, .read = kgdb_test_proc_read, .write = kgdb_test_proc_write, + .llseek = noop_llseek,/* read and write both use no f_pos */ };static int __init kgdbtest_init (void )
arch/blackfin/mach-bf561/coreb.c +1 -0
@@ -51,6 +51,7 @@ coreb_ioctl(struct file *file, unsigned int cmd, unsigned long arg)static const struct file_operations coreb_fops = { .owner =THIS_MODULE , .unlocked_ioctl = coreb_ioctl, + .llseek = noop_llseek,/* no read or write fn */ };static struct miscdevice coreb_dev = {
arch/cris/arch-v10/drivers/ds1302.c +1 -0
@@ -387,6 +387,7 @@ print_rtc_status(void)static const struct file_operations rtc_fops = { .owner =THIS_MODULE , .unlocked_ioctl = rtc_unlocked_ioctl, + .llseek = noop_llseek,/* no read or write fn */ };/* Probe for the chip by writing something to its RAM and try reading it back. */
arch/cris/arch-v10/drivers/gpio.c +1 -0
@@ -719,6 +719,7 @@ static const struct file_operations gpio_fops = { .write = gpio_write, .open = gpio_open, .release = gpio_release, + .llseek = noop_llseek,/* write uses no f_pos */ }; static void ioif_watcher(const unsigned int gpio_in_available,
arch/cris/arch-v10/drivers/i2c.c +1 -0
@@ -622,6 +622,7 @@ static const struct file_operations i2c_fops = { .ioctl = i2c_ioctl, .open = i2c_open, .release = i2c_release, + .llseek = noop_llseek,/* no read or write fn */ };int __init
arch/cris/arch-v10/drivers/pcf8563.c +1 -0
@@ -64,6 +64,7 @@ static int voltage_low;static const struct file_operations pcf8563_fops = { .owner =THIS_MODULE , .unlocked_ioctl = pcf8563_unlocked_ioctl, + .llseek = noop_llseek,/* no read or write fn */ };unsigned char
arch/cris/arch-v10/drivers/sync_serial.c +2 -1
@@ -250,7 +250,8 @@ static const struct file_operations sync_serial_fops = { .poll = sync_serial_poll, .ioctl = sync_serial_ioctl, .open = sync_serial_open, - .release = sync_serial_release + .release = sync_serial_release, + .llseek = noop_llseek,/* read and write both use no f_pos */ };static int __init etrax_sync_serial_init (void )
arch/cris/arch-v32/drivers/cryptocop.c +2 -1
@@ -282,7 +282,8 @@ const struct file_operations cryptocop_fops = { .owner = THIS_MODULE, .open = cryptocop_open, .release = cryptocop_release, - .ioctl = cryptocop_ioctl + .ioctl = cryptocop_ioctl, + .llseek = noop_llseek,/* no read or write fn */ };
arch/cris/arch-v32/drivers/i2c.c +1 -0
@@ -698,6 +698,7 @@ static const struct file_operations i2c_fops = { .unlocked_ioctl = i2c_ioctl, .open = i2c_open, .release = i2c_release, + .llseek = noop_llseek,/* no read or write fn */ };static int __init i2c_init (void )
arch/cris/arch-v32/drivers/mach-a3/gpio.c +1 -0
@@ -883,6 +883,7 @@ static const struct file_operations gpio_fops = { .write = gpio_write, .open = gpio_open, .release = gpio_release, + .llseek = noop_llseek,/* write uses no f_pos */ };#ifdef CONFIG_ETRAX_VIRTUAL_GPIO
Re: [PATCH 16/18] llseek: automatically add .llseek fop
Quoted 14 lines · Arnd Bergmann
All
file_operationsshould get a .llseek operation so we can makenonseekable_openthe default for future file operations without a .llseek pointer.The three cases that we can automatically detect are
no_llseek,seq_lseekanddefault_llseek. For cases where we can we can automatically prove that the file offset is always ignored, we usenoop_llseek, which maintains the current behavior of not returning an error from a seek.
Quoted 7 lines
New drivers should normally not use
noop_llseekbut instead useno_llseekand callnonseekable_openat open time. Existing drivers can be converted to do the same when the maintainer knows for certain that no user code relies on calling seek on the device file.
can we skip the transition for devices that we already know ?
Quoted 8 lines
arch/blackfin/kernel/kgdb_test.c +0
-0static const struct
file_operationskgdb_test_proc_fops= {
+ .llseek = noop_llseek,/* read and write both use nof_pos*/arch/blackfin/mach-bf561/coreb.c +0
-0static const struct
file_operationscoreb_fops= {
+ .llseek = noop_llseek,/* no read or write fn */
neither of these drivers are seekable, so attempts to do so should be an error ...
Quoted 2 lines
drivers/char/bfin-otp.c
+ .llseek = default_llseek,/* read accessesf_pos*/
lseeking should work fine with bfin-otp, so this change is OK -mike
Arnd Bergmann
maintainerRe: [PATCH 16/18] llseek: automatically add .llseek fop
Quoted 9 lines · On Wednesday 07 July 2010 23:55:25 Mike Frysinger wrote:
Quoted 7 lines
New drivers should normally not use
noop_llseekbut instead useno_llseekand callnonseekable_openat open time. Existing drivers can be converted to do the same when the maintainer knows for certain that no user code relies on calling seek on the device file.can we skip the transition for devices that we already know ?
Yes, we could do that for the cases that call nonseekable_open either by putting it into file_operations or by calling it from their own open() function in the same file. These are the two cases where the semantic patch currently adds no_llseek.
The reason I added the explicit no_llseek was so I could tell the difference between those file operations that use nonseekable_open and those that spatch could for some reason not identify as belonging into any of the categories.
Quoted 11 lines
arch/blackfin/mach-bf561/coreb.c coreb_ioctl(struct file *file, unsigned int cmd, unsigned long arg) · line 54
Quoted 8 lines
arch/blackfin/kernel/kgdb_test.c +0
-0static const struct
file_operationskgdb_test_proc_fops= {arch/blackfin/kernel/kgdb_test.c +1
-0+ .llseek = noop_llseek,/* read and write both use no f_pos */arch/blackfin/mach-bf561/coreb.c +1
-0static const struct file_operations coreb_fops = { + .llseek = noop_llseek,/* no read or write fn */ neither of these drivers are seekable, so attempts to do so should be an error ...
Ok, then you should add ".open = nonseekable_open," to the file operations and put that change into a tree that gets pulled into linux-next. The semantic patch will do the right thing then, whatever we decide.
Arnd
Re: [PATCH 16/18] llseek: automatically add .llseek fop
In reply to Arnd BergmannQuoted 826 lines · Arnd Bergmann
All
file_operationsshould get a .llseek operation so we can makenonseekable_openthe default for future file operations without a .llseek pointer.The three cases that we can automatically detect are
no_llseek,seq_lseekanddefault_llseek. For cases where we can we can automatically prove that the file offset is always ignored, we usenoop_llseek, which maintains the current behavior of not returning an error from a seek.New drivers should normally not use
noop_llseekbut instead useno_llseekand callnonseekable_openat open time. Existing drivers can be converted to do the same when the maintainer knows for certain that no user code relies on calling seek on the device file.The generated code is often incorrectly indented and right now contains comments that clarify for each added line why a specific variant was chosen. In the version that gets submitted upstream, the comments will be gone and I will manually fix the indentation, because there does not seem to be a way to do that using coccinelle.
Some amount of new code is currently sitting in linux-next that should get the same modifications, which I will do at the end of the merge window.
This specific posted version of the patch only covers first few files in order to avoid spamming everybody's inbox. I think you still get the point. The diffstat is complete, and the full patch is available in the 'llseek' branch of
git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl.gitMany thanks to Julia Lawall for helping me learn to write a semantic patch that does all this.
===== begin semantic patch =====
// This adds an llseek= method to all file operations, // as a preparation for makingno_llseekthe default. //
// The rules are
// - useno_llseekexplicitly if we dononseekable_open// - useseq_lseekfor sequential files
// - usedefault_llseekif we know we accessf_pos// - usenoop_llseekif we know we don't accessf_pos,
// but we still want to allow users to call lseek
//
@ open1 exists @
identifiernested_open;
@@nested_open(...)
{
<+...nonseekable_open(...)
...+>
}@ open exists@
identifieropen_f;
identifier i, f;
identifier open1.nested_open;
@@
intopen_f(struct inode *i, struct file *f){
<+...
(nonseekable_open(...)
|nested_open(...)
)
...+>
}@ read disable
optional_qualifierexists @ identifierread_f;
identifier f, p, s, off;
typessize_t,size_t,loff_t;
expression E;
identifier func;
@@ssize_tread_f(struct file *f, char *p, size_t s, loff_t *off){
<+...
(
*off = E
|
*off += E
|
func(..., off, ...)
|
E = *off
)
...+>
}@
read_no_fposdisableoptional_qualifierexists @ identifierread_f;
identifier f, p, s, off;
typessize_t,size_t,loff_t;
@@ssize_tread_f(struct file *f, char *p, size_t s, loff_t *off){
... when != off
}@ write @
identifierwrite_f;
identifier f, p, s, off;
typessize_t,size_t,loff_t;
expression E;
identifier func;
@@ssize_twrite_f(struct file *f, const char *p, size_t s, loff_t *off){
<+...
(
*off = E
|
*off += E
|
func(..., off, ...)
|
E = *off
)
...+>
}@
write_no_fpos@
identifierwrite_f;
identifier f, p, s, off;
typessize_t,size_t,loff_t;
@@ssize_twrite_f(struct file *f, const char *p, size_t s, loff_t *off){
... when != off
}@ fops0 @
identifier fops;
@@
structfile_operationsfops = {
...
};@
has_llseekdepends on fops0 @
identifier fops0.fops;
identifierllseek_f;
@@
structfile_operationsfops = {
...
.llseek =llseek_f,
...
};@
has_readdepends on fops0 @
identifier fops0.fops;
identifierread_f;
@@
structfile_operationsfops = {
...
.read =read_f,
...
};@
has_writedepends on fops0 @
identifier fops0.fops;
identifierwrite_f;
@@
structfile_operationsfops = {
...
.write =write_f,
...
};@
has_opendepends on fops0 @
identifier fops0.fops;
identifieropen_f;
@@
structfile_operationsfops = {
...
.open =open_f,
...
};// use
no_llseekif we callnonseekable_open//////////////////////////////////////////// @ nonseekable1 depends on !has_llseek &&has_open@ identifier fops0.fops;
identifier nso ~= "nonseekable_open";
@@
structfile_operationsfops = {
... .open = nso, ...
+.llseek =no_llseek, /* nonseekable */
};@ nonseekable2 depends on !has_llseek @ identifier fops0.fops;
identifier open.open_f;
@@
structfile_operationsfops = {
... .open =open_f, ...
+.llseek =no_llseek, /* open uses nonseekable */ };// use
seq_lseekfor sequential files /////////////////////////////////////
@ seq depends on !has_llseek @ identifier fops0.fops;
identifier sr ~= "seq_read";
@@
structfile_operationsfops = {
... .read = sr, ...
+.llseek =seq_lseek, /* we haveseq_read*/ };// use
default_llseekif there is a readdir ///////////////////////////////////////////
@ fops1 depends on !has_llseek && !nonseekable1 && !nonseekable2 && !seq @ identifier fops0.fops;
identifierreaddir_e;
@@
// any other fop is used that changes pos
structfile_operationsfops = {
... .readdir =readdir_e, ...
+.llseek =default_llseek, /* readdir is present */
};// use
default_llseekif at least one of read/write touchesf_pos/////////////////////////////////////////////////////////////////
@ fops2 depends on !fops1 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @ identifier fops0.fops;
identifier read.read_f;
@@
// read fops use offset
structfile_operationsfops = {
... .read =read_f, ...
+.llseek =default_llseek, /* read accessesf_pos*/
};@ fops3 depends on !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @ identifier fops0.fops;
identifier write.write_f;
@@
// write fops use offset
structfile_operationsfops = {
... .write =write_f, ...(quoted diff) +1
-0+ .llseek = default_llseek, /* write accesses f_pos */};
// Use
noop_llseekif neither read nor write accessesf_pos///////////////////////////////////////////////////////////@ fops4 depends on !fops1 && !fops2 && !fops3 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @ identifier fops0.fops;
identifier read_no_fpos.read_f;
identifier write_no_fpos.write_f;
@@
// write fops use offset
structfile_operationsfops = {
...
.write =write_f,
.read =read_f,
...
+.llseek =noop_llseek, /* read and write both use nof_pos*/
};@ depends on
has_write&& !has_read && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @ identifier fops0.fops;
identifier write_no_fpos.write_f;
@@
structfile_operationsfops = {
... .write =write_f, ...
+.llseek =noop_llseek, /* write uses nof_pos*/
};@ depends on
has_read&& !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @ identifier fops0.fops;
identifier read_no_fpos.read_f;
@@
structfile_operationsfops = {
... .read =read_f, ...
+.llseek =noop_llseek, /* read uses nof_pos*/
};@ depends on !has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @ identifier fops0.fops;
@@
structfile_operationsfops = {
...
+.llseek =noop_llseek, /* no read or write fn */
};
===== End semantic patch =====Signed-off-by Arnd Bergmann <[email protected]>Cc Julia Lawall <[email protected]>Cc Christoph Hellwig <[email protected]>--- arch/arm/kernel/etm.c | 1 + arch/arm/mach-msm/last_radio_log.c | 3 +- arch/arm/mach-msm/smd_debug.c | 1 + arch/arm/plat-mxc/audmux-v2.c | 1 + arch/avr32/boards/mimc200/fram.c | 1 + arch/blackfin/kernel/kgdb_test.c | 1 + arch/blackfin/mach-bf561/coreb.c | 1 + arch/cris/arch-v10/drivers/ds1302.c | 1 + arch/cris/arch-v10/drivers/gpio.c | 1 + arch/cris/arch-v10/drivers/i2c.c | 1 + arch/cris/arch-v10/drivers/pcf8563.c | 1 + arch/cris/arch-v10/drivers/sync_serial.c | 3 +- arch/cris/arch-v32/drivers/cryptocop.c | 3 +- arch/cris/arch-v32/drivers/i2c.c | 1 + arch/cris/arch-v32/drivers/mach-a3/gpio.c | 1 + arch/cris/arch-v32/drivers/mach-fs/gpio.c | 1 + arch/cris/arch-v32/drivers/pcf8563.c | 1 + arch/cris/arch-v32/drivers/sync_serial.c | 3 +- arch/cris/kernel/profile.c | 1 + arch/ia64/kernel/salinfo.c | 2 + arch/ia64/sn/kernel/sn2/sn_hwperf.c | 1 + arch/m68k/bvme6000/rtc.c | 1 + arch/m68k/mvme16x/rtc.c | 1 + arch/mips/kernel/rtlx.c | 3 +- arch/mips/kernel/vpe.c | 3 +- arch/mips/sibyte/common/sb_tbprof.c | 1 + arch/powerpc/kernel/lparcfg.c | 1 + arch/powerpc/kernel/rtas_flash.c | 3 ++ arch/powerpc/kernel/rtasd.c | 1 + arch/powerpc/platforms/iseries/mf.c | 1 + arch/powerpc/platforms/pseries/reconfig.c | 3 +- arch/powerpc/platforms/pseries/scanlog.c | 1 + arch/s390/crypto/prng.c | 1 + arch/s390/hypfs/hypfs_diag.c | 1 + arch/s390/hypfs/hypfs_vm.c | 1 + arch/s390/hypfs/inode.c | 1 + arch/s390/kernel/debug.c | 1 + arch/sh/boards/mach-landisk/gio.c | 1 + arch/sparc/kernel/apc.c | 1 + arch/sparc/kernel/mdesc.c | 1 + arch/um/drivers/harddog_kern.c | 1 + arch/um/drivers/mconsole_kern.c | 1 + arch/um/drivers/mmapper_kern.c | 1 + arch/um/drivers/random.c | 1 + arch/x86/kernel/apm_32.c | 1 + arch/x86/kernel/cpu/mcheck/mce-severity.c | 1 + arch/x86/kernel/cpu/mcheck/mce.c | 1 + arch/x86/kernel/kdebugfs.c | 1 + arch/x86/kernel/microcode_core.c | 1 + arch/x86/xen/debugfs.c | 1 + block/bsg.c | 1 + drivers/acpi/debug.c | 1 + drivers/acpi/event.c | 1 + drivers/acpi/system.c | 2 + drivers/block/DAC960.c | 3 +- drivers/block/aoe/aoechr.c | 1 + drivers/block/paride/pg.c | 1 + drivers/block/paride/pt.c | 1 + drivers/block/pktcdvd.c | 1 + drivers/bluetooth/btmrvl_debugfs.c | 10 +++++++ drivers/bluetooth/hci_vhci.c | 1 + drivers/char/apm-emulation.c | 1 + drivers/char/bfin-otp.c | 1 + drivers/char/briq_panel.c | 1 + drivers/char/bsr.c | 1 + drivers/char/cs5535_gpio.c | 3 +- drivers/char/ds1302.c | 1 + drivers/char/ds1620.c | 1 + drivers/char/dsp56k.c | 1 + drivers/char/dtlk.c | 1 + drivers/char/genrtc.c | 1 + drivers/char/hw_random/core.c | 1 + drivers/char/ip2/ip2main.c | 1 + drivers/char/ipmi/ipmi_devintf.c | 1 + drivers/char/ipmi/ipmi_watchdog.c | 1 + drivers/char/istallion.c | 1 + drivers/char/lp.c | 1 + drivers/char/mem.c | 3 ++ drivers/char/misc.c | 1 + drivers/char/mmtimer.c | 1 + drivers/char/mspec.c | 9 ++++-- drivers/char/mwave/mwavedd.c | 3 +- drivers/char/nwbutton.c | 1 + drivers/char/pc8736x_gpio.c | 1 + drivers/char/pcmcia/cm4000_cs.c | 1 + drivers/char/pcmcia/cm4040_cs.c | 1 + drivers/char/random.c | 2 + drivers/char/rio/rio_linux.c | 1 + drivers/char/scx200_gpio.c | 1 + drivers/char/snsc.c | 1 + drivers/char/stallion.c | 1 + drivers/char/sx.c | 1 + drivers/char/sysrq.c | 1 + drivers/char/tb0219.c | 1 + drivers/char/tlclk.c | 1 + drivers/char/toshiba.c | 1 + drivers/char/uv_mmtimer.c | 1 + drivers/char/virtio_console.c | 3 ++ drivers/char/xilinx_hwicap/xilinx_hwicap.c | 1 + drivers/dma/coh901318.c | 1 + drivers/gpu/drm/drm_drv.c | 3 +- drivers/gpu/drm/i810/i810_dma.c | 1 + drivers/gpu/drm/i830/i830_dma.c | 1 + drivers/gpu/drm/i915/i915_debugfs.c | 1 + drivers/gpu/vga/vgaarb.c | 1 + drivers/hid/hid-debug.c | 1 + drivers/hid/hid-roccat.c | 1 + drivers/hid/hidraw.c | 1 + drivers/hid/usbhid/hiddev.c | 1 + drivers/hwmon/asus_atk0110.c | 1 + drivers/ide/ide-tape.c | 1 + drivers/idle/i7300_idle.c | 1 + drivers/infiniband/hw/cxgb4/device.c | 1 + drivers/infiniband/hw/ipath/ipath_diag.c | 4 ++- drivers/infiniband/hw/ipath/ipath_file_ops.c | 3 +- drivers/infiniband/hw/ipath/ipath_fs.c | 3 ++ drivers/infiniband/hw/qib/qib_diag.c | 4 ++- drivers/infiniband/hw/qib/qib_file_ops.c | 3 +- drivers/infiniband/hw/qib/qib_fs.c | 1 + drivers/input/evdev.c | 3 +- drivers/input/input.c | 1 + drivers/input/joydev.c | 1 + drivers/input/misc/uinput.c | 1 + drivers/input/mousedev.c | 1 + drivers/input/serio/serio_raw.c | 1 + drivers/isdn/mISDN/timerdev.c | 1 + drivers/lguest/lguest_user.c | 1 + drivers/macintosh/ans-lcd.c | 1 + drivers/macintosh/via-pmu.c | 1 + drivers/md/dm-ioctl.c | 1 + drivers/media/IR/imon.c | 6 +++- drivers/media/dvb/bt8xx/dst_ca.c | 3 +- drivers/media/dvb/dvb-core/dmxdev.c | 2 + drivers/media/dvb/dvb-core/dvb_ca_en50221.c | 1 + drivers/media/dvb/dvb-core/dvb_frontend.c | 3 +- drivers/media/dvb/dvb-core/dvb_net.c | 1 + drivers/media/dvb/dvb-core/dvbdev.c | 1 + drivers/media/dvb/firewire/firedtv-ci.c | 1 + drivers/media/dvb/ttpci/av7110.c | 1 + drivers/media/dvb/ttpci/av7110_av.c | 2 + drivers/media/dvb/ttpci/av7110_ca.c | 1 + drivers/media/dvb/ttpci/av7110_ir.c | 1 + drivers/mfd/ab3100-core.c | 1 + drivers/misc/hpilo.c | 1 + drivers/misc/phantom.c | 1 + drivers/misc/sgi-gru/grufile.c | 1 + drivers/mmc/core/debugfs.c | 1 + drivers/mtd/ubi/cdev.c | 1 + drivers/net/cxgb4/cxgb4_main.c | 1 + drivers/net/ppp_generic.c | 3 +- drivers/net/wimax/i2400m/debugfs.c | 2 + drivers/net/wireless/airo.c | 24 ++++++++++++------ drivers/net/wireless/ath/ath5k/debug.c | 6 ++++ drivers/net/wireless/ath/ath9k/debug.c | 33 ++++++++++++++++-------- drivers/net/wireless/ath/ath9k/htc_drv_main.c | 9 ++++-- drivers/net/wireless/iwlwifi/iwl-3945-rs.c | 1 + drivers/net/wireless/iwlwifi/iwl-agn-rs.c | 3 ++ drivers/net/wireless/iwmc3200wifi/debugfs.c | 4 +++ drivers/net/wireless/iwmc3200wifi/sdio.c | 1 + drivers/net/wireless/libertas/debugfs.c | 1 + drivers/net/wireless/ray_cs.c | 2 + drivers/net/wireless/rt2x00/rt2x00debug.c | 4 +++ drivers/net/wireless/wl12xx/wl1251_debugfs.c | 2 + drivers/net/wireless/wl12xx/wl1271_debugfs.c | 4 ++- drivers/oprofile/oprofile_files.c | 8 +++++- drivers/oprofile/oprofilefs.c | 3 ++ drivers/pci/pcie/aer/aer_inject.c | 1 + drivers/pcmcia/pcmcia_ioctl.c | 1 + drivers/platform/x86/sony-laptop.c | 1 + drivers/rtc/rtc-m41t80.c | 1 + drivers/s390/block/dasd_eer.c | 1 + drivers/s390/char/fs3270.c | 1 + drivers/s390/char/monreader.c | 1 + drivers/s390/char/monwriter.c | 1 + drivers/s390/char/tape_char.c | 1 + drivers/s390/char/vmcp.c | 1 + drivers/s390/char/vmlogrdr.c | 1 + drivers/s390/char/vmwatchdog.c | 1 + drivers/s390/char/zcore.c | 2 + drivers/s390/cio/chsc_sch.c | 1 + drivers/s390/cio/css.c | 1 + drivers/s390/crypto/zcrypt_api.c | 3 +- drivers/s390/scsi/zfcp_cfdc.c | 3 +- drivers/sbus/char/display7seg.c | 1 + drivers/sbus/char/envctrl.c | 1 + drivers/scsi/3w-9xxx.c | 3 +- drivers/scsi/3w-sas.c | 3 +- drivers/scsi/3w-xxxx.c | 3 +- drivers/scsi/aacraid/linit.c | 1 + drivers/scsi/ch.c | 1 + drivers/scsi/dpt_i2o.c | 1 + drivers/scsi/gdth.c | 1 + drivers/scsi/megaraid.c | 1 + drivers/scsi/megaraid/megaraid_mm.c | 1 + drivers/scsi/megaraid/megaraid_sas.c | 1 + drivers/scsi/mpt2sas/mpt2sas_ctl.c | 1 + drivers/scsi/osd/osd_uld.c | 1 + drivers/scsi/pmcraid.c | 1 + drivers/scsi/qla2xxx/qla_os.c | 1 + drivers/scsi/scsi_tgt_if.c | 1 + drivers/scsi/sg.c | 1 + drivers/spi/dw_spi.c | 1 + drivers/spi/spidev.c | 1 + drivers/staging/batman-adv/device.c | 1 + drivers/staging/comedi/comedi_fops.c | 1 + drivers/staging/crystalhd/crystalhd_lnx.c | 1 + drivers/staging/dream/camera/msm_camera.c | 3 ++ drivers/staging/dream/pmem.c | 2 + drivers/staging/dream/qdsp5/adsp_driver.c | 1 + drivers/staging/dream/qdsp5/audio_aac.c | 1 + drivers/staging/dream/qdsp5/audio_amrnb.c | 1 + drivers/staging/dream/qdsp5/audio_evrc.c | 1 + drivers/staging/dream/qdsp5/audio_in.c | 2 + drivers/staging/dream/qdsp5/audio_mp3.c | 1 + drivers/staging/dream/qdsp5/audio_out.c | 2 + drivers/staging/dream/qdsp5/audio_qcelp.c | 1 + drivers/staging/dream/qdsp5/evlog.h | 1 + drivers/staging/dream/qdsp5/snd.c | 1 + drivers/staging/dt3155/dt3155_drv.c | 3 +- drivers/staging/frontier/alphatrack.c | 1 + drivers/staging/frontier/tranzport.c | 1 + drivers/staging/iio/industrialio-core.c | 1 + drivers/staging/iio/industrialio-ring.c | 1 + drivers/staging/memrar/memrar_handler.c | 1 + drivers/staging/panel/panel.c | 1 + drivers/staging/sep/sep_driver.c | 1 + drivers/telephony/ixj.c | 3 +- drivers/telephony/phonedev.c | 1 + drivers/uio/uio.c | 1 + drivers/usb/class/cdc-wdm.c | 3 +- drivers/usb/class/usblp.c | 1 + drivers/usb/class/usbtmc.c | 1 + drivers/usb/core/file.c | 1 + drivers/usb/gadget/f_hid.c | 1 + drivers/usb/gadget/printer.c | 3 +- drivers/usb/host/ehci-dbg.c | 3 ++ drivers/usb/host/ohci-dbg.c | 3 ++ drivers/usb/image/mdc800.c | 1 + drivers/usb/misc/adutux.c | 1 + drivers/usb/misc/idmouse.c | 1 + drivers/usb/misc/iowarrior.c | 1 + drivers/usb/misc/ldusb.c | 1 + drivers/usb/misc/rio500.c | 1 + drivers/usb/misc/usblcd.c | 1 + drivers/usb/usb-skeleton.c | 1 + drivers/vhost/net.c | 1 + drivers/video/fbmem.c | 1 + drivers/video/mbx/mbxdebugfs.c | 6 ++++ drivers/watchdog/ar7_wdt.c | 1 + drivers/watchdog/cpwd.c | 1 + drivers/watchdog/ep93xx_wdt.c | 1 + drivers/watchdog/omap_wdt.c | 1 + drivers/xen/evtchn.c | 1 + drivers/xen/xenfs/super.c | 1 + drivers/xen/xenfs/xenbus.c | 1 + fs/afs/mntpt.c | 1 + fs/autofs4/dev-ioctl.c | 1 + fs/binfmt_misc.c | 3 ++ fs/btrfs/super.c | 1 + fs/cachefiles/daemon.c | 1 + fs/char_dev.c | 1 + fs/coda/pioctl.c | 1 + fs/coda/psdev.c | 1 + fs/debugfs/file.c | 3 ++ fs/dlm/debug_fs.c | 3 +- fs/dlm/plock.c | 3 +- fs/dlm/user.c | 3 ++ fs/ecryptfs/file.c | 1 + fs/ecryptfs/miscdev.c | 1 + fs/eventfd.c | 1 + fs/eventpoll.c | 3 +- fs/fifo.c | 1 + fs/fuse/control.c | 4 +++ fs/fuse/cuse.c | 1 + fs/gfs2/file.c | 2 + fs/hppfs/hppfs.c | 1 + fs/hugetlbfs/inode.c | 1 + fs/logfs/dir.c | 1 + fs/nfsd/nfsctl.c | 1 + fs/no-block.c | 1 + fs/notify/inotify/inotify_user.c | 1 + fs/ntfs/file.c | 3 +- fs/ocfs2/dlmfs/dlmfs.c | 1 + fs/ocfs2/stack_user.c | 1 + fs/proc/base.c | 7 +++++ fs/proc/proc_sysctl.c | 1 + fs/proc/root.c | 1 + fs/proc/task_mmu.c | 1 + fs/romfs/super.c | 1 + fs/signalfd.c | 1 + fs/squashfs/dir.c | 3 +- fs/timerfd.c | 1 + fs/ubifs/debug.c | 1 + ipc/mqueue.c | 1 + ipc/shm.c | 2 + kernel/configs.c | 1 + kernel/gcov/fs.c | 1 + kernel/kprobes.c | 1 + kernel/pm_qos_params.c | 1 + kernel/profile.c | 1 + kernel/trace/blktrace.c | 2 + kernel/trace/ftrace.c | 2 + kernel/trace/ring_buffer.c | 1 + kernel/trace/trace_events.c | 7 +++++ kernel/trace/trace_ksym.c | 1 + kernel/trace/trace_stack.c | 1 + kernel/trace/trace_sysprof.c | 1 + lib/dma-debug.c | 1 + net/atm/proc.c | 1 + net/dccp/probe.c | 1 + net/ipv4/tcp_probe.c | 1 + net/mac80211/debugfs.c | 19 ++++++++++---- net/mac80211/rate.c | 1 + net/mac80211/rc80211_minstrel_debugfs.c | 1 + net/mac80211/rc80211_pid_debugfs.c | 1 + net/netfilter/xt_recent.c | 1 + net/nonet.c | 1 + net/rfkill/core.c | 1 + net/sctp/probe.c | 1 + net/socket.c | 1 + net/sunrpc/cache.c | 2 + net/wireless/debugfs.c | 1 + samples/tracepoints/tracepoint-sample.c | 1 + security/inode.c | 1 + security/smack/smackfs.c | 5 ++++ security/tomoyo/common.c | 1 + sound/core/seq/oss/seq_oss.c | 1 + sound/core/sound.c | 3 +- sound/oss/au1550_ac97.c | 2 + sound/oss/msnd_pinnacle.c | 1 + sound/oss/sh_dac_audio.c | 1 + sound/soc/soc-core.c | 1 + sound/soc/soc-dapm.c | 1 + sound/sound_core.c | 1 + virt/kvm/kvm_main.c | 3 ++ 335 files changed, 528 insertions(+), 69 deletions(-)arch/arm/kernel/etm.c +1
-0@@ -314,6 +314,7 @@ static const struct file_operations etb_fops = { .read = etb_read, .open = etb_open, .release = etb_release, + .llseek = no_llseek,/* open uses nonseekable */ };static struct miscdevice etb_miscdev = {arch/arm/mach-msm/last_radio_log.c +2
-1@@ -48,7 +48,8 @@ static ssize_t last_radio_log_read(struct file *file, char __user *buf, }static struct file_operations last_radio_log_fops = { - .read = last_radio_log_read + .read = last_radio_log_read, + .llseek = default_llseek,/* read accesses f_pos */ };void msm_init_last_radio_log (struct module *owner)arch/arm/mach-msm/smd_debug.c +1
-0@@ -212,6 +212,7 @@ static int debug_open(struct inode *inode, struct file *file)static const struct file_operations debug_ops = { .read = debug_read, .open = debug_open, + .llseek = default_llseek,/* read accesses f_pos */ }; static void debug_create(const char *name, mode_t mode,arch/arm/plat-mxc/audmux-v2.c +1
-0@@ -141,6 +141,7 @@ static ssize_t audmux_read_file(struct file *file, char __user *user_buf,static const struct file_operations audmux_debugfs_fops = { .open = audmux_open_file, .read = audmux_read_file, + .llseek = default_llseek,/* read accesses f_pos */ };static void audmux_debugfs_init (void )arch/avr32/boards/mimc200/fram.c +1
-0@@ -41,6 +41,7 @@ static int fram_mmap(struct file *filp, struct vm_area_struct *vma)static const struct file_operations fram_fops = { .owner =THIS_MODULE , .mmap = fram_mmap, + .llseek = noop_llseek,/* no read or write fn */ };#define FRAM_MINOR 0arch/blackfin/kernel/kgdb_test.c +1
-0@@ -88,6 +88,7 @@ static const struct file_operations kgdb_test_proc_fops = { .owner = THIS_MODULE, .read = kgdb_test_proc_read, .write = kgdb_test_proc_write, + .llseek = noop_llseek,/* read and write both use no f_pos */ };static int __init kgdbtest_init (void )arch/blackfin/mach-bf561/coreb.c +1
-0@@ -51,6 +51,7 @@ coreb_ioctl(struct file *file, unsigned int cmd, unsigned long arg)static const struct file_operations coreb_fops = { .owner =THIS_MODULE , .unlocked_ioctl = coreb_ioctl, + .llseek = noop_llseek,/* no read or write fn */ };static struct miscdevice coreb_dev = {arch/cris/arch-v10/drivers/ds1302.c +1
-0@@ -387,6 +387,7 @@ print_rtc_status(void)static const struct file_operations rtc_fops = { .owner =THIS_MODULE , .unlocked_ioctl = rtc_unlocked_ioctl, + .llseek = noop_llseek,/* no read or write fn */ };/* Probe for the chip by writing something to its RAM and try reading it back. */ arch/cris/arch-v10/drivers/gpio.c +1
-0@@ -719,6 +719,7 @@ static const struct file_operations gpio_fops = { .write = gpio_write, .open = gpio_open, .release = gpio_release, + .llseek = noop_llseek,/* write uses no f_pos */ }; static void ioif_watcher(const unsigned int gpio_in_available,arch/cris/arch-v10/drivers/i2c.c +1
-0@@ -622,6 +622,7 @@ static const struct file_operations i2c_fops = { .ioctl = i2c_ioctl, .open = i2c_open, .release = i2c_release, + .llseek = noop_llseek,/* no read or write fn */ };int __init arch/cris/arch-v10/drivers/pcf8563.c +1
-0@@ -64,6 +64,7 @@ static int voltage_low;static const struct file_operations pcf8563_fops = { .owner =THIS_MODULE , .unlocked_ioctl = pcf8563_unlocked_ioctl, + .llseek = noop_llseek,/* no read or write fn */ };unsigned char arch/cris/arch-v10/drivers/sync_serial.c +2
-1@@ -250,7 +250,8 @@ static const struct file_operations sync_serial_fops = { .poll = sync_serial_poll, .ioctl = sync_serial_ioctl, .open = sync_serial_open, - .release = sync_serial_release + .release = sync_serial_release, + .llseek = noop_llseek,/* read and write both use no f_pos */ };static int __init etrax_sync_serial_init (void )arch/cris/arch-v32/drivers/cryptocop.c +2
-1@@ -282,7 +282,8 @@ const struct file_operations cryptocop_fops = { .owner = THIS_MODULE, .open = cryptocop_open, .release = cryptocop_release, - .ioctl = cryptocop_ioctl + .ioctl = cryptocop_ioctl, + .llseek = noop_llseek,/* no read or write fn */ };arch/cris/arch-v32/drivers/i2c.c +1
-0@@ -698,6 +698,7 @@ static const struct file_operations i2c_fops = { .unlocked_ioctl = i2c_ioctl, .open = i2c_open, .release = i2c_release, + .llseek = noop_llseek,/* no read or write fn */ };static int __init i2c_init (void )arch/cris/arch-v32/drivers/mach-a3/gpio.c +0
-0
arch/cris/arch-v32/drivers/mach-a3/gpio.c static const struct file_operations gpio_fops = { · line 889
Quoted 7 lines
arch/cris/arch-v32/drivers/mach-a3/gpio.c +1
-0@@ -883,6 +883,7 @@ static const struct file_operations gpio_fops = { .write = gpio_write, .open = gpio_open, .release = gpio_release, + .llseek = noop_llseek,/* write uses no f_pos */ };#ifdef CONFIG_ETRAX_VIRTUAL_GPIO
I only got up to here in the email. (See ml sig below) Do you have this on git or better gitweb somewhere?
Boaz
Quoted 6 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Arnd Bergmann
maintainerRe: [PATCH 16/18] llseek: automatically add .llseek fop
Quoted 10 lines · Boaz Harrosh
Quoted 9 lines · Arnd Bergmann
This specific posted version of the patch only covers first few files in order to avoid spamming everybody's inbox. I think you still get the point. The diffstat is complete, and the full patch is available in the 'llseek' branch of
git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl.git
Quoted 4 lines
<snip>
I only got up to here in the email. (See ml sig below) Do you have this on git or better gitweb somewhere?
Yes. I was afraid people might reply the patch and quote the entire 500kb email without cutting the bits they haven't actually read ;-)
FWIW, you can get the whole patch from
http://git.kernel.org/?p=linux/kernel/git/arnd/bkl.git;a=patch;h=dc731e01d2a08eb66ae08c226c97aa0cb8cf7b7f
Arnd
Re: [PATCH 16/18] llseek: automatically add .llseek fop
Quoted 11 lines · Arnd Bergmann
Quoted 10 lines · Boaz Harrosh
Quoted 9 lines · Arnd Bergmann
This specific posted version of the patch only covers first few files in order to avoid spamming everybody's inbox. I think you still get the point. The diffstat is complete, and the full patch is available in the 'llseek' branch of
git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl.git
Yes sorry, I've just seen that you did say.
Quoted 5 lines
Quoted 4 lines
<snip>
I only got up to here in the email. (See ml sig below) Do you have this on git or better gitweb somewhere?
Quoted 7 lines
Yes. I was afraid people might reply the patch and quote the entire 500kb email without cutting the bits they haven't actually read ;-)
FWIW, you can get the whole patch from
http://git.kernel.org/?p=linux/kernel/git/arnd/bkl.git;a=patch;h=dc731e01d2a08eb66ae08c226c97aa0cb8cf7b7f
Grate thanks. Ack for the OSD stuff (of course)
Quoted 2 lines
Arnd
Boaz
Arnd Bergmann
maintainerPATCH 17/18 vfs: don't use BKL in default_llseek
In reply to Arnd BergmannThere are currently 191 users of default_llseek. Nine of these are in device drivers that use the big kernel lock. None of these ever touch file->f_pos outside of llseek or file_pos_write.
Consequently, we never rely on the BKL in the default_llseek function and can replace that with i_mutex, which is also used in generic_file_llseek.
--- fs/read_write.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
fs/read_write.c +2 -2
@@ -124,7 +124,7 @@ loff_t default_llseek(struct file *file, loff_t offset, int origin) {loff_t retval; -lock_kernel (); +mutex_lock (&file->f_dentry->d_inode->i_mutex);switch (origin) {case SEEK_END : offset +=i_size_read (file->f_path.dentry->d_inode);
@@ -145,7 +145,7 @@ loff_t default_llseek(struct file *file, loff_t offset, int origin) retval = offset; } out: -unlock_kernel (); +mutex_unlock (&file->f_dentry->d_inode->i_mutex);return retval; }EXPORT_SYMBOL (default_llseek);
Signature · 1 line
1.7.1
Arnd Bergmann
maintainerPATCH 18/18 vfs: make no_llseek the default
In reply to Arnd BergmannAll file operations now have an explicit .llseek operation pointer, so we can change the default action for future code.
This makes changes the default from default_llseek to no_llseek, which always returns -ESPIPE if a user tries to seek on a file without a .llseek operation.
The name of the default_llseek function remains unchanged, if anyone thinks we should change it, please speak up.
--- fs/read_write.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
fs/read_write.c +0 -1
@@ -156,7 +156,6 @@ loff_t vfs_llseek(struct file *file, loff_t offset, int origin) fn = no_llseek;if (file->f_mode &FMODE_LSEEK ) { - fn = default_llseek;if (file->f_op && file->f_op->llseek) fn = file->f_op->llseek; }
Signature · 1 line
1.7.1
Tetsuo Handa
maintainerRe: [PATCH 18/18] vfs: make no_llseek the default
Hello.
Quoted 3 lines · Arnd Bergmann
All file operations now have an explicit .llseek
operation pointer, so we can change the default
action for future code.
I saw patch for SELinux and IMA, but not for TOMOYO. TOMOYO has
static const struct file_operations tomoyo_operations
without .llseek operation pointer.
TOMOYO does not deal offset pointer. Thus seek operation makes no sense. But returning -ESPIPE for seek operation might break some applications. What should I do for TOMOYO?
Regards.
Arnd Bergmann
maintainerRe: [PATCH 18/18] vfs: make no_llseek the default
Quoted 10 lines · Tetsuo Handa
Hello.
Quoted 3 lines · Arnd Bergmann
All file operations now have an explicit .llseek
operation pointer, so we can change the default
action for future code.I saw patch for SELinux and IMA, but not for TOMOYO. TOMOYO has
Quoted 7 lines
static const struct
file_operationstomoyo_operationswithout .llseek operation pointer.
TOMOYO does not deal offset pointer. Thus seek operation makes no sense. But returning
-ESPIPEfor seek operation might break some applications. What should I do for TOMOYO?
The semantic patch (16/18 in this series) had detected that case, so I did not have to manually create a patch as for selinux and ima.
The behaviour you want is noop_llseek, which is what gets used when the semantic patch is applied. If you wish, you can do the patch yourself and add .llseek = noop_llseek to the file operations in your tree.
Arnd
Tetsuo Handa
maintainerRe: [PATCH 18/18] vfs: make no_llseek the default
Quoted 4 lines · Arnd Bergmann
The behaviour you want is
noop_llseek, which is what gets used when the semantic patch is applied. If you wish, you can do the patch yourself and add .llseek =noop_llseekto the file operations in your tree.
I see. [PATCH 16/18] ( http://lkml.org/lkml/2010/7/7/258 ) contains a line
security/tomoyo/common.c | 1 +
but no change in the patch. Patch was too large? Anyway, that part is no longer in security/tomoyo/common.c and is now security/tomoyo/securityfs_if.c . James, please apply below patch.
----------
Quoted 1 line
From
d0fdb09cdc8ef46151d330a9fc285de86306fa65Mon Sep 17 00:00:00 2001
From: Tetsuo Handa <[email protected]>
Date: Thu, 8 Jul 2010 21:38:05 +0900
Subject: [PATCH] TOMOYO: Explicitly set file_operations->llseek pointer.
TOMOYO does not deal offset pointer. Thus seek operation makes no sense. Changing default seek operation from default_llseek() to no_llseek() might break some applications. Thus, explicitly set noop_llseek().
--- security/tomoyo/securityfs_if.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
security/tomoyo/securityfs_if.c +1 -0
@@ -95,6 +95,7 @@ static const struct file_operations tomoyo_operations = { .poll = tomoyo_poll, .read = tomoyo_read, .write = tomoyo_write, + .llseek = noop_llseek, };/**
Signature · 1 line
1.6.1
Arnd Bergmann
maintainerRe: [PATCH 18/18] vfs: make no_llseek the default
Quoted 5 lines · Tetsuo Handa
I see. [PATCH 16/18] ( http://lkml.org/lkml/2010/7/7/258 ) contains a line
security/tomoyo/common.c | 1 +but no change in the patch. Patch was too large?
Yes, the total patch is almost 200kb, which I considered too large. I explained this in the changelog.
In retrospect, I probably should have sent it all anyway, because the changelog is already very long and a few other people did not realize this either because they did only read the patch but not the changelog.
As I mentioned to Boaz Harrosh, the full patch is available on
http://git.kernel.org/?p=linux/kernel/git/arnd/bkl.git;a=patch;h=dc731e01d2a08eb66ae08c226c97aa0cb8cf7b7f
and I'll send it out completely if I send out the series again.
I first want to make sure we have consensus on the semantic patch though. In particular, I want to be sure everyone agrees on the following questions:
- should we kill default_llseek in favour of a more generic generic_file_llseek that also covers special files?
- if not, should default_llseek get renamed to something else?
- should I bother adding .llseek=no_llseek if we make that the default in the next step anyway?
- should I drop all the automatically generated comments?
- Do I need to split this patch up into per-maintainer chunks and send them through the individual trees, or do we just apply the semantic patch treewide at the end of the merge window?
Arnd
James Morris
maintainerRe: [PATCH 18/18] vfs: make no_llseek the default
In reply to Tetsuo HandaQuoted 11 lines · Tetsuo Handa
Quoted 1 line
From
d0fdb09cdc8ef46151d330a9fc285de86306fa65Mon Sep 17 00:00:00 2001From: Tetsuo Handa <[email protected]>
Date: Thu, 8 Jul 2010 21:38:05 +0900
Subject: [PATCH] TOMOYO: Explicitly setfile_operations->llseekpointer.TOMOYO does not deal offset pointer. Thus seek operation makes no sense. Changing default seek operation from
default_llseek()tono_llseek()might break some applications. Thus, explicitly setnoop_llseek().Signed-off-by Tetsuo Handa <[email protected]>
Applied togit://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6#next
Signature · 2 lines
James Morris <[email protected]>