Re: [PATCH] arch: s390: Remove duplicate struct ccw1 declaration
Thank you for the patch. Acked-by: Vineeth Vijayan Heiko/Vasily will pick this up and will be part of the s390-tree patchset. On 3/30/21 12:56 PM, Wan Jiabing wrote: struct ccw1 is declared twice. One has been declared at 21st line. Remove the duplicate. Signed-off-by: Wan Jiabing --- arch/s390/include/asm/ccwdev.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/arch/s390/include/asm/ccwdev.h b/arch/s390/include/asm/ccwdev.h index 778247bb1d61..d4e90f2ba77e 100644 --- a/arch/s390/include/asm/ccwdev.h +++ b/arch/s390/include/asm/ccwdev.h @@ -152,9 +152,6 @@ extern struct ccw_device *get_ccwdev_by_busid(struct ccw_driver *cdrv, * when new devices for its type pop up */ extern int ccw_driver_register (struct ccw_driver *driver); extern void ccw_driver_unregister (struct ccw_driver *driver); - -struct ccw1; - extern int ccw_device_set_options_mask(struct ccw_device *, unsigned long); extern int ccw_device_set_options(struct ccw_device *, unsigned long); extern void ccw_device_clear_options(struct ccw_device *, unsigned long);
Re: [PATCH -next 2/2] s390/cio: use DECLARE_WAIT_QUEUE_HEAD() for wait_queue
For both the patches, Acked-by: Vineeth Vijayan I will correct the description, and Heiko/Vasily will pick this up and will be part of the s390-tree patchset. On 3/29/21 11:40 AM, Shixin Liu wrote: wait_queue_head_t can be initialized automatically with DECLARE_WAIT_QUEUE_HEAD() rather than explicitly calling init_waitqueue_head(). A minor checkpatch WARNING. I will modify this. Signed-off-by: Shixin Liu --- drivers/s390/cio/css.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c index f01ef6325039..a974943c27da 100644 --- a/drivers/s390/cio/css.c +++ b/drivers/s390/cio/css.c @@ -652,13 +652,12 @@ static void css_sch_todo(struct work_struct *work) static struct idset *slow_subchannel_set; static DEFINE_SPINLOCK(slow_subchannel_lock); -static wait_queue_head_t css_eval_wq; +static DECLARE_WAIT_QUEUE_HEAD(css_eval_wq); static atomic_t css_eval_scheduled; static int __init slow_subchannel_init(void) { atomic_set(_eval_scheduled, 0); - init_waitqueue_head(_eval_wq); slow_subchannel_set = idset_sch_new(); if (!slow_subchannel_set) { CIO_MSG_EVENT(0, "could not allocate slow subchannel set\n");
Re: [PATCH -next 1/2] s390/cio: use DEFINE_SPINLOCK() for spinlock
Thank you. Acked-by: Vineeth Vijayan On 3/29/21 11:40 AM, Shixin Liu wrote: spinlock can be initialized automatically with DEFINE_SPINLOCK() rather than explicitly calling spin_lock_init(). static spinlock Signed-off-by: Shixin Liu --- drivers/s390/cio/css.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c index 253ab4e7a415..f01ef6325039 100644 --- a/drivers/s390/cio/css.c +++ b/drivers/s390/cio/css.c @@ -651,13 +651,12 @@ static void css_sch_todo(struct work_struct *work) } static struct idset *slow_subchannel_set; -static spinlock_t slow_subchannel_lock; +static DEFINE_SPINLOCK(slow_subchannel_lock); static wait_queue_head_t css_eval_wq; static atomic_t css_eval_scheduled; static int __init slow_subchannel_init(void) { - spin_lock_init(_subchannel_lock); atomic_set(_eval_scheduled, 0); init_waitqueue_head(_eval_wq); slow_subchannel_set = idset_sch_new();
Re: [abaci-bug...@linux.alibaba.com: [PATCH] s390: Simplify the calculation of variables]
Date: Tue, 26 Jan 2021 17:09:12 +0800 From: Jiapeng Zhong To: h...@linux.ibm.com Cc: , Jiapeng Zhong Subject: [PATCH] s390: Simplify the calculation of variables Message-Id: <1611652152-58139-1-git-send-email-abaci-bug...@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 Fix the following coccicheck warnings: ./arch/s390/include/asm/scsw.h:528:48-50: WARNING !A || A && B is equivalent to !A || B. Reported-by: Abaci Robot Signed-off-by: Jiapeng Zhong --- arch/s390/include/asm/scsw.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/s390/include/asm/scsw.h b/arch/s390/include/asm/scsw.h index c00f7b0..a7c3ccf 100644 --- a/arch/s390/include/asm/scsw.h +++ b/arch/s390/include/asm/scsw.h @@ -525,8 +525,7 @@ static inline int scsw_cmd_is_valid_pno(union scsw *scsw) return (scsw->cmd.fctl != 0) && (scsw->cmd.stctl & SCSW_STCTL_STATUS_PEND) && (!(scsw->cmd.stctl & SCSW_STCTL_INTER_STATUS) || -((scsw->cmd.stctl & SCSW_STCTL_INTER_STATUS) && - (scsw->cmd.actl & SCSW_ACTL_SUSPENDED))); + (scsw->cmd.actl & SCSW_ACTL_SUSPENDED)); } /** Thank you. Reviewed-by: Vineeth Vijayan this will go via next s390-tree upstream-release. Regards Vineeth Vijayan.
Re: [PATCH] s390: cio: fix use-after-free in ccw_device_destroy_console
Thank you.With a very minor modification in the commit-message, Reviewed-by: Vineeth Vijayan I will push this and Vasliy/Heiko will take this up for the next s390-tree upstream-release. On 12/1/20 7:31 AM, Qinglang Miao wrote: put_device calls release function which do kfree() inside. So following use of sch would cause use-after-free bugs. Fix these by simply adjusting the position of put_device. Modified the commit-message as below. Just for the clarification. -- Use of sch->dev reference after the put_device() call could trigger the use-after-free bugs. Fix this by simply adjusting the position of put_device. -- Fixes: 37db8985b211 ("s390/cio: add basic protected virtualization support") Reported-by: Hulk Robot Suggested-by: Cornelia Huck Signed-off-by: Qinglang Miao --- This patch is indeed a v2 of older one. Considering that the patch's name has changed, I think a normal prefix 'PATCH' is better. drivers/s390/cio/device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index b29fe8d50..33280ca18 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c @@ -1664,10 +1664,10 @@ void __init ccw_device_destroy_console(struct ccw_device *cdev) struct io_subchannel_private *io_priv = to_io_private(sch); set_io_private(sch, NULL); - put_device(>dev); - put_device(>dev); dma_free_coherent(>dev, sizeof(*io_priv->dma_area), io_priv->dma_area, io_priv->dma_area_dma); + put_device(>dev); + put_device(>dev); kfree(io_priv); }
Re: [PATCH v4 04/27] s390: fix kernel-doc markups
Heiko/Vasily will pick this up and will be part of the s390-tree patchset. Regards Vineeth On 11/16/20 11:38 AM, Vineeth Vijayan wrote: Thank you very much for the fix. Reviewed-by: Vineeth Vijayan On 11/16/20 11:18 AM, Mauro Carvalho Chehab wrote: fix one typo: ccw driver -> ccw_driver and one function rename. Signed-off-by: Mauro Carvalho Chehab --- arch/s390/include/asm/ccwdev.h | 2 +- arch/s390/include/asm/cio.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/s390/include/asm/ccwdev.h b/arch/s390/include/asm/ccwdev.h index bf605e1fcf6a..0495ac635ed5 100644 --- a/arch/s390/include/asm/ccwdev.h +++ b/arch/s390/include/asm/ccwdev.h @@ -100,41 +100,41 @@ struct ccw_device { */ #define PE_NONE 0x0 #define PE_PATH_GONE 0x1 /* A path is no longer available. */ #define PE_PATH_AVAILABLE 0x2 /* A path has become available and was successfully verified. */ #define PE_PATHGROUP_ESTABLISHED 0x4 /* A pathgroup was reset and had to be established again. */ #define PE_PATH_FCES_EVENT 0x8 /* The FCES Status of a path has * changed. */ /* * Possible CIO actions triggered by the unit check handler. */ enum uc_todo { UC_TODO_RETRY, UC_TODO_RETRY_ON_NEW_PATH, UC_TODO_STOP }; /** - * struct ccw driver - device driver for channel attached devices + * struct ccw_driver - device driver for channel attached devices * @ids: ids supported by this driver * @probe: function called on probe * @remove: function called on remove * @set_online: called when setting device online * @set_offline: called when setting device offline * @notify: notify driver of device state changes * @path_event: notify driver of channel path events * @shutdown: called at device shutdown * @prepare: prepare for pm state transition * @complete: undo work done in @prepare * @freeze: callback for freezing during hibernation snapshotting * @thaw: undo work done in @freeze * @restore: callback for restoring after hibernation * @uc_handler: callback for unit check handler * @driver: embedded device driver structure * @int_class: interruption class to use for accounting interrupts */ struct ccw_driver { struct ccw_device_id *ids; int (*probe) (struct ccw_device *); diff --git a/arch/s390/include/asm/cio.h b/arch/s390/include/asm/cio.h index e36cb67d2441..ac02df906cae 100644 --- a/arch/s390/include/asm/cio.h +++ b/arch/s390/include/asm/cio.h @@ -312,41 +312,41 @@ struct node_descriptor { /* Device did not respond in time. */ #define CIO_BOXED 0x0010 /** * struct ccw_dev_id - unique identifier for ccw devices * @ssid: subchannel set id * @devno: device number * * This structure is not directly based on any hardware structure. The * hardware identifies a device by its device number and its subchannel, * which is in turn identified by its id. In order to get a unique identifier * for ccw devices across subchannel sets, @struct ccw_dev_id has been * introduced. */ struct ccw_dev_id { u8 ssid; u16 devno; }; /** - * ccw_device_id_is_equal() - compare two ccw_dev_ids + * ccw_dev_id_is_equal() - compare two ccw_dev_ids * @dev_id1: a ccw_dev_id * @dev_id2: another ccw_dev_id * Returns: * %1 if the two structures are equal field-by-field, * %0 if not. * Context: * any */ static inline int ccw_dev_id_is_equal(struct ccw_dev_id *dev_id1, struct ccw_dev_id *dev_id2) { if ((dev_id1->ssid == dev_id2->ssid) && (dev_id1->devno == dev_id2->devno)) return 1; return 0; } /** * pathmask_to_pos() - find the position of the left-most bit in a pathmask * @mask: pathmask with at least one bit set
Re: [PATCH v4 04/27] s390: fix kernel-doc markups
Thank you very much for the fix. Reviewed-by: Vineeth Vijayan On 11/16/20 11:18 AM, Mauro Carvalho Chehab wrote: fix one typo: ccw driver -> ccw_driver and one function rename. Signed-off-by: Mauro Carvalho Chehab --- arch/s390/include/asm/ccwdev.h | 2 +- arch/s390/include/asm/cio.h| 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/s390/include/asm/ccwdev.h b/arch/s390/include/asm/ccwdev.h index bf605e1fcf6a..0495ac635ed5 100644 --- a/arch/s390/include/asm/ccwdev.h +++ b/arch/s390/include/asm/ccwdev.h @@ -100,41 +100,41 @@ struct ccw_device { */ #define PE_NONE 0x0 #define PE_PATH_GONE 0x1 /* A path is no longer available. */ #define PE_PATH_AVAILABLE 0x2 /* A path has become available and was successfully verified. */ #define PE_PATHGROUP_ESTABLISHED 0x4 /* A pathgroup was reset and had to be established again. */ #define PE_PATH_FCES_EVENT0x8 /* The FCES Status of a path has * changed. */ /* * Possible CIO actions triggered by the unit check handler. */ enum uc_todo { UC_TODO_RETRY, UC_TODO_RETRY_ON_NEW_PATH, UC_TODO_STOP }; /** - * struct ccw driver - device driver for channel attached devices + * struct ccw_driver - device driver for channel attached devices * @ids: ids supported by this driver * @probe: function called on probe * @remove: function called on remove * @set_online: called when setting device online * @set_offline: called when setting device offline * @notify: notify driver of device state changes * @path_event: notify driver of channel path events * @shutdown: called at device shutdown * @prepare: prepare for pm state transition * @complete: undo work done in @prepare * @freeze: callback for freezing during hibernation snapshotting * @thaw: undo work done in @freeze * @restore: callback for restoring after hibernation * @uc_handler: callback for unit check handler * @driver: embedded device driver structure * @int_class: interruption class to use for accounting interrupts */ struct ccw_driver { struct ccw_device_id *ids; int (*probe) (struct ccw_device *); diff --git a/arch/s390/include/asm/cio.h b/arch/s390/include/asm/cio.h index e36cb67d2441..ac02df906cae 100644 --- a/arch/s390/include/asm/cio.h +++ b/arch/s390/include/asm/cio.h @@ -312,41 +312,41 @@ struct node_descriptor { /* Device did not respond in time. */ #define CIO_BOXED 0x0010 /** * struct ccw_dev_id - unique identifier for ccw devices * @ssid: subchannel set id * @devno: device number * * This structure is not directly based on any hardware structure. The * hardware identifies a device by its device number and its subchannel, * which is in turn identified by its id. In order to get a unique identifier * for ccw devices across subchannel sets, @struct ccw_dev_id has been * introduced. */ struct ccw_dev_id { u8 ssid; u16 devno; }; /** - * ccw_device_id_is_equal() - compare two ccw_dev_ids + * ccw_dev_id_is_equal() - compare two ccw_dev_ids * @dev_id1: a ccw_dev_id * @dev_id2: another ccw_dev_id * Returns: * %1 if the two structures are equal field-by-field, * %0 if not. * Context: * any */ static inline int ccw_dev_id_is_equal(struct ccw_dev_id *dev_id1, struct ccw_dev_id *dev_id2) { if ((dev_id1->ssid == dev_id2->ssid) && (dev_id1->devno == dev_id2->devno)) return 1; return 0; } /** * pathmask_to_pos() - find the position of the left-most bit in a pathmask * @mask: pathmask with at least one bit set
Re: [PATCH -next] s390/cio: Remove unused inline functionidset_sch_get_first
Thank you. This patch will be part of the s390's next patch submission. Reviewed-by: Vineeth Vijayan Regards, Vineeth On Fri, 2020-05-08 at 22:06 +0800, YueHaibing wrote: > commit 8ebd51a705c5 ("s390/cio: idset.c: remove some unused > functions") > left behind this, remove it > > Signed-off-by: YueHaibing > --- > drivers/s390/cio/idset.c | 12 > 1 file changed, 12 deletions(-) > > diff --git a/drivers/s390/cio/idset.c b/drivers/s390/cio/idset.c > index 77d0ea7b381b..45f9c0736be4 100644 > --- a/drivers/s390/cio/idset.c > +++ b/drivers/s390/cio/idset.c > @@ -59,18 +59,6 @@ static inline int idset_contains(struct idset *set, > int ssid, int id) > return test_bit(ssid * set->num_id + id, set->bitmap); > } > > -static inline int idset_get_first(struct idset *set, int *ssid, int > *id) > -{ > - int bitnum; > - > - bitnum = find_first_bit(set->bitmap, set->num_ssid * set- > >num_id); > - if (bitnum >= set->num_ssid * set->num_id) > - return 0; > - *ssid = bitnum / set->num_id; > - *id = bitnum % set->num_id; > - return 1; > -} > - > struct idset *idset_sch_new(void) > { > return idset_new(max_ssid + 1, __MAX_SUBCHANNEL + 1);
Re: [PATCH] [powerpc] Fix Text randomization
On Mon, Nov 17, 2014 at 12:23 PM, Michael Ellerman wrote: > On Fri, 2014-11-14 at 14:42 +0530, Vineeth Vijayan wrote: >> Now there is no way to disable TEXT randomization on a PPC32/PPC64 >> machine. Text randomization happens even in the case of "echo 0 > >> /proc/sys/kernel/randomize_va_space" >> >> This happens due to the incorrect definition of ELF_ET_DYN_BASE >> at arch/powerpc/include/asm/elf.h >> >> The function randomize_et_dyn is redundant and is removed. > > The patch looks OK, but for the change log I was thinking something more like > this: > > > powerpc: Use generic PIE randomization > Ok. Thats better. Do you want me to send a new patch with updated change log as mentioned ? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] [powerpc] Fix Text randomization
On Mon, Nov 17, 2014 at 12:23 PM, Michael Ellerman m...@ellerman.id.au wrote: On Fri, 2014-11-14 at 14:42 +0530, Vineeth Vijayan wrote: Now there is no way to disable TEXT randomization on a PPC32/PPC64 machine. Text randomization happens even in the case of echo 0 /proc/sys/kernel/randomize_va_space This happens due to the incorrect definition of ELF_ET_DYN_BASE at arch/powerpc/include/asm/elf.h The function randomize_et_dyn is redundant and is removed. The patch looks OK, but for the change log I was thinking something more like this: powerpc: Use generic PIE randomization Ok. Thats better. Do you want me to send a new patch with updated change log as mentioned ? -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] [powerpc] Fix Text randomization
Now there is no way to disable TEXT randomization on a PPC32/PPC64 machine. Text randomization happens even in the case of "echo 0 > /proc/sys/kernel/randomize_va_space" This happens due to the incorrect definition of ELF_ET_DYN_BASE at arch/powerpc/include/asm/elf.h The function randomize_et_dyn is redundant and is removed. Signed-off-by: Vineeth Vijayan --- arch/powerpc/Kconfig |1 + arch/powerpc/include/asm/elf.h |3 +-- arch/powerpc/kernel/process.c |9 - 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 88eace4..868a3c4 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -88,6 +88,7 @@ config PPC select ARCH_MIGHT_HAVE_PC_PARPORT select ARCH_MIGHT_HAVE_PC_SERIO select BINFMT_ELF + select ARCH_BINFMT_ELF_RANDOMIZE_PIE select OF select OF_EARLY_FLATTREE select OF_RESERVED_MEM diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h index 888d8f3..3793675 100644 --- a/arch/powerpc/include/asm/elf.h +++ b/arch/powerpc/include/asm/elf.h @@ -28,8 +28,7 @@ the loader. We need to make sure that it is out of the way of the program that it will "exec", and that there is sufficient room for the brk. */ -extern unsigned long randomize_et_dyn(unsigned long base); -#define ELF_ET_DYN_BASE(randomize_et_dyn(0x2000)) +#define ELF_ET_DYN_BASE(0x2000) #define ELF_CORE_EFLAGS (is_elf2_task() ? 2 : 0) diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index 923cd2d..e50467e 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c @@ -1665,12 +1665,3 @@ unsigned long arch_randomize_brk(struct mm_struct *mm) return ret; } -unsigned long randomize_et_dyn(unsigned long base) -{ - unsigned long ret = PAGE_ALIGN(base + brk_rnd()); - - if (ret < base) - return base; - - return ret; -} -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: powerpc: Fix Text randomization
On Fri, Nov 14, 2014 at 11:50 AM, Michael Ellerman wrote: > On Fri, 2014-11-14 at 11:03 +0530, Vineeth Vijayan wrote: >> ping ! >> >> any update on this ? As i understand, only powerpc and s390 uses the >> randomize_et_dyn call; for all other architecture this is an obsolete >> function call. > > I asked: > >> >> I'm not clear on what has changed to break this? > Disabling PIE randomization was added in the commit a3defbe5c337dbc6da911f8cc49ae3cc3b49b453 (binfmt_elf: fix PIE execution with randomization disabled). The randomization is decided as per the randomize_va_space sysctl flag. As i understand, the randomization of the base address is implemented at elf_map and not from the arch/<>/include/asm/elf.h Now, for powerpc, there's no support to disable the PIE randomization, even after we disable the same form randomize_va_space sysctl.This patch gives the support to disable PIE randomization in case it is disabled from this sysctl. > And you didn't tell me. > >> this call for another patch where randomize_et_dyn is removed. > > Patches welcome :) > i will follow up with the patch. > cheers > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: powerpc: Fix Text randomization
On Fri, Nov 14, 2014 at 11:50 AM, Michael Ellerman m...@ellerman.id.au wrote: On Fri, 2014-11-14 at 11:03 +0530, Vineeth Vijayan wrote: ping ! any update on this ? As i understand, only powerpc and s390 uses the randomize_et_dyn call; for all other architecture this is an obsolete function call. I asked: I'm not clear on what has changed to break this? Disabling PIE randomization was added in the commit a3defbe5c337dbc6da911f8cc49ae3cc3b49b453 (binfmt_elf: fix PIE execution with randomization disabled). The randomization is decided as per the randomize_va_space sysctl flag. As i understand, the randomization of the base address is implemented at elf_map and not from the arch//include/asm/elf.h Now, for powerpc, there's no support to disable the PIE randomization, even after we disable the same form randomize_va_space sysctl.This patch gives the support to disable PIE randomization in case it is disabled from this sysctl. And you didn't tell me. this call for another patch where randomize_et_dyn is removed. Patches welcome :) i will follow up with the patch. cheers -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] [powerpc] Fix Text randomization
Now there is no way to disable TEXT randomization on a PPC32/PPC64 machine. Text randomization happens even in the case of echo 0 /proc/sys/kernel/randomize_va_space This happens due to the incorrect definition of ELF_ET_DYN_BASE at arch/powerpc/include/asm/elf.h The function randomize_et_dyn is redundant and is removed. Signed-off-by: Vineeth Vijayan vvija...@mvista.com --- arch/powerpc/Kconfig |1 + arch/powerpc/include/asm/elf.h |3 +-- arch/powerpc/kernel/process.c |9 - 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 88eace4..868a3c4 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -88,6 +88,7 @@ config PPC select ARCH_MIGHT_HAVE_PC_PARPORT select ARCH_MIGHT_HAVE_PC_SERIO select BINFMT_ELF + select ARCH_BINFMT_ELF_RANDOMIZE_PIE select OF select OF_EARLY_FLATTREE select OF_RESERVED_MEM diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h index 888d8f3..3793675 100644 --- a/arch/powerpc/include/asm/elf.h +++ b/arch/powerpc/include/asm/elf.h @@ -28,8 +28,7 @@ the loader. We need to make sure that it is out of the way of the program that it will exec, and that there is sufficient room for the brk. */ -extern unsigned long randomize_et_dyn(unsigned long base); -#define ELF_ET_DYN_BASE(randomize_et_dyn(0x2000)) +#define ELF_ET_DYN_BASE(0x2000) #define ELF_CORE_EFLAGS (is_elf2_task() ? 2 : 0) diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index 923cd2d..e50467e 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c @@ -1665,12 +1665,3 @@ unsigned long arch_randomize_brk(struct mm_struct *mm) return ret; } -unsigned long randomize_et_dyn(unsigned long base) -{ - unsigned long ret = PAGE_ALIGN(base + brk_rnd()); - - if (ret base) - return base; - - return ret; -} -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: powerpc: Fix Text randomization
ping ! any update on this ? As i understand, only powerpc and s390 uses the randomize_et_dyn call; for all other architecture this is an obsolete function call. this call for another patch where randomize_et_dyn is removed. On Wed, Oct 15, 2014 at 12:08 PM, Vineeth Vijayan wrote: > On Wed, Oct 15, 2014 at 7:38 AM, Michael Ellerman wrote: >> On Fri, 2014-10-10 at 05:45:26 UTC, Vineeth Vijayan wrote: >>> Right now there is no way to disable TEXT randomization on a PPC32 >>> machine. text randomization happens even in the case of "echo 0 > >>> /proc/sys/kernel/randomize_va_space" >> >> Yeah it seems to happen on ppc64 too. >> >>> This happens due to the incorrect definition of ELF_ET_DYN_BASE at >>> arch/powerpc/include/asm/elf.h >> >> What is incorrect about it? We are not the only arch that does that. >> > > I think we are one of the arch which does it. > The same has been tested on x86 and arm, where ELF_ET_DYN_BASE doesn’t > use randomize_et_dyn call, and it works properly as per the user-space > definition of randomization; > > (i.e when at "echo 0 > /proc/sys/kernel/randomize_va_space", TEXT > randomization should not happen.) > >> I'm not clear on what has changed to break this? >> >> cheers -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: powerpc: Fix Text randomization
ping ! any update on this ? As i understand, only powerpc and s390 uses the randomize_et_dyn call; for all other architecture this is an obsolete function call. this call for another patch where randomize_et_dyn is removed. On Wed, Oct 15, 2014 at 12:08 PM, Vineeth Vijayan vvija...@mvista.com wrote: On Wed, Oct 15, 2014 at 7:38 AM, Michael Ellerman m...@ellerman.id.au wrote: On Fri, 2014-10-10 at 05:45:26 UTC, Vineeth Vijayan wrote: Right now there is no way to disable TEXT randomization on a PPC32 machine. text randomization happens even in the case of echo 0 /proc/sys/kernel/randomize_va_space Yeah it seems to happen on ppc64 too. This happens due to the incorrect definition of ELF_ET_DYN_BASE at arch/powerpc/include/asm/elf.h What is incorrect about it? We are not the only arch that does that. I think we are one of the arch which does it. The same has been tested on x86 and arm, where ELF_ET_DYN_BASE doesn’t use randomize_et_dyn call, and it works properly as per the user-space definition of randomization; (i.e when at echo 0 /proc/sys/kernel/randomize_va_space, TEXT randomization should not happen.) I'm not clear on what has changed to break this? cheers -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: powerpc: Fix Text randomization
On Wed, Oct 15, 2014 at 7:38 AM, Michael Ellerman wrote: > On Fri, 2014-10-10 at 05:45:26 UTC, Vineeth Vijayan wrote: >> Right now there is no way to disable TEXT randomization on a PPC32 >> machine. text randomization happens even in the case of "echo 0 > >> /proc/sys/kernel/randomize_va_space" > > Yeah it seems to happen on ppc64 too. > >> This happens due to the incorrect definition of ELF_ET_DYN_BASE at >> arch/powerpc/include/asm/elf.h > > What is incorrect about it? We are not the only arch that does that. > I think we are one of the arch which does it. The same has been tested on x86 and arm, where ELF_ET_DYN_BASE doesn’t use randomize_et_dyn call, and it works properly as per the user-space definition of randomization; (i.e when at "echo 0 > /proc/sys/kernel/randomize_va_space", TEXT randomization should not happen.) > I'm not clear on what has changed to break this? > > cheers -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: powerpc: Fix Text randomization
On Wed, Oct 15, 2014 at 7:38 AM, Michael Ellerman m...@ellerman.id.au wrote: On Fri, 2014-10-10 at 05:45:26 UTC, Vineeth Vijayan wrote: Right now there is no way to disable TEXT randomization on a PPC32 machine. text randomization happens even in the case of echo 0 /proc/sys/kernel/randomize_va_space Yeah it seems to happen on ppc64 too. This happens due to the incorrect definition of ELF_ET_DYN_BASE at arch/powerpc/include/asm/elf.h What is incorrect about it? We are not the only arch that does that. I think we are one of the arch which does it. The same has been tested on x86 and arm, where ELF_ET_DYN_BASE doesn’t use randomize_et_dyn call, and it works properly as per the user-space definition of randomization; (i.e when at echo 0 /proc/sys/kernel/randomize_va_space, TEXT randomization should not happen.) I'm not clear on what has changed to break this? cheers -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] powerpc: Fix Text randomization
Right now there is no way to disable TEXT randomization on a PPC32 machine. text randomization happens even in the case of "echo 0 > /proc/sys/kernel/randomize_va_space" This happens due to the incorrect definition of ELF_ET_DYN_BASE at arch/powerpc/include/asm/elf.h Signed-off-by: Vineeth Vijayan --- Test details: #include int main(int argc,char *argv) { printf("main = %p\n",main); return 0; } Compile the same as position-independent executable Results without Patch: p5040ds:~# gcc test.c -o test -fPIE -pie p5040ds:~# echo 2 > /proc/sys/kernel/randomize_va_space p5040ds:~# ./test main = 0xb7e9681c p5040ds:~# ./test main = 0xb7aba81c p5040ds:~# ./test main = 0xb7fac81c p5040ds:~# ./test main = 0xb7f4c81c p5040ds:~# echo 0 > /proc/sys/kernel/randomize_va_space p5040ds:~# ./test main = 0x2010281c p5040ds:~# ./test main = 0x2018d81c p5040ds:~# ./test main = 0x206a981c p5040ds:~# ./test main = 0x2036681c Results with Patch: p5040ds:~# gcc test.c -o test -fPIE -pie p5040ds:~# p5040ds:~# echo 2 > /proc/sys/kernel/randomize_va_space p5040ds:~# p5040ds:~# ./test main = 0xb78a581c p5040ds:~# ./test main = 0xb792c81c p5040ds:~# ./test main = 0xb79de81c p5040ds:~# ./test main = 0xb78ae81c p5040ds:~# echo 0 > /proc/sys/kernel/randomize_va_space p5040ds:~# p5040ds:~# ./test main = 0x281c p5040ds:~# ./test main = 0x281c p5040ds:~# ./test main = 0x281c p5040ds:~# ./test main = 0x281c arch/powerpc/Kconfig |1 + arch/powerpc/include/asm/elf.h |2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 4bc7b62..f99ddae 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -88,6 +88,7 @@ config PPC select ARCH_MIGHT_HAVE_PC_PARPORT select ARCH_MIGHT_HAVE_PC_SERIO select BINFMT_ELF + select ARCH_BINFMT_ELF_RANDOMIZE_PIE select OF select OF_EARLY_FLATTREE select OF_RESERVED_MEM diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h index 888d8f3..162813b 100644 --- a/arch/powerpc/include/asm/elf.h +++ b/arch/powerpc/include/asm/elf.h @@ -29,7 +29,7 @@ that it will "exec", and that there is sufficient room for the brk. */ extern unsigned long randomize_et_dyn(unsigned long base); -#define ELF_ET_DYN_BASE(randomize_et_dyn(0x2000)) +#define ELF_ET_DYN_BASE(0x2000) #define ELF_CORE_EFLAGS (is_elf2_task() ? 2 : 0) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] powerpc: Fix Text randomization
Right now there is no way to disable TEXT randomization on a PPC32 machine. text randomization happens even in the case of echo 0 /proc/sys/kernel/randomize_va_space This happens due to the incorrect definition of ELF_ET_DYN_BASE at arch/powerpc/include/asm/elf.h Signed-off-by: Vineeth Vijayan vvija...@mvista.com --- Test details: #include stdio.h int main(int argc,char *argv) { printf(main = %p\n,main); return 0; } Compile the same as position-independent executable Results without Patch: p5040ds:~# gcc test.c -o test -fPIE -pie p5040ds:~# echo 2 /proc/sys/kernel/randomize_va_space p5040ds:~# ./test main = 0xb7e9681c p5040ds:~# ./test main = 0xb7aba81c p5040ds:~# ./test main = 0xb7fac81c p5040ds:~# ./test main = 0xb7f4c81c p5040ds:~# echo 0 /proc/sys/kernel/randomize_va_space p5040ds:~# ./test main = 0x2010281c p5040ds:~# ./test main = 0x2018d81c p5040ds:~# ./test main = 0x206a981c p5040ds:~# ./test main = 0x2036681c Results with Patch: p5040ds:~# gcc test.c -o test -fPIE -pie p5040ds:~# p5040ds:~# echo 2 /proc/sys/kernel/randomize_va_space p5040ds:~# p5040ds:~# ./test main = 0xb78a581c p5040ds:~# ./test main = 0xb792c81c p5040ds:~# ./test main = 0xb79de81c p5040ds:~# ./test main = 0xb78ae81c p5040ds:~# echo 0 /proc/sys/kernel/randomize_va_space p5040ds:~# p5040ds:~# ./test main = 0x281c p5040ds:~# ./test main = 0x281c p5040ds:~# ./test main = 0x281c p5040ds:~# ./test main = 0x281c arch/powerpc/Kconfig |1 + arch/powerpc/include/asm/elf.h |2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 4bc7b62..f99ddae 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -88,6 +88,7 @@ config PPC select ARCH_MIGHT_HAVE_PC_PARPORT select ARCH_MIGHT_HAVE_PC_SERIO select BINFMT_ELF + select ARCH_BINFMT_ELF_RANDOMIZE_PIE select OF select OF_EARLY_FLATTREE select OF_RESERVED_MEM diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h index 888d8f3..162813b 100644 --- a/arch/powerpc/include/asm/elf.h +++ b/arch/powerpc/include/asm/elf.h @@ -29,7 +29,7 @@ that it will exec, and that there is sufficient room for the brk. */ extern unsigned long randomize_et_dyn(unsigned long base); -#define ELF_ET_DYN_BASE(randomize_et_dyn(0x2000)) +#define ELF_ET_DYN_BASE(0x2000) #define ELF_CORE_EFLAGS (is_elf2_task() ? 2 : 0) -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/