Commit 14f9761e authored by Patrick Mochel's avatar Patrick Mochel

Merge digitalimplant.org:/home/mochel/src/linux-2.6-virgin

into digitalimplant.org:/home/mochel/src/linux-2.6-power
parents 9556b782 1bb0fa18
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 8
EXTRAVERSION =-rc1
EXTRAVERSION =-rc2
NAME=Zonked Quokka
# *DOCUMENTATION*
......
......@@ -448,7 +448,11 @@ void __init set_highmem_pages_init(int bad_ppro)
void __init set_max_mapnr_init(void)
{
#ifdef CONFIG_HIGHMEM
highmem_start_page = NODE_DATA(0)->node_zones[ZONE_HIGHMEM].zone_mem_map;
struct zone *high0 = &NODE_DATA(0)->node_zones[ZONE_HIGHMEM];
if (high0->spanned_pages > 0)
highmem_start_page = high0->zone_mem_map;
else
highmem_start_page = pfn_to_page(max_low_pfn+1);
num_physpages = highend_pfn;
#else
num_physpages = max_low_pfn;
......
......@@ -689,7 +689,7 @@ CONFIG_SERIO_SERPORT=y
# Input Device Drivers
#
CONFIG_INPUT_KEYBOARD=y
# CONFIG_KEYBOARD_ATKBD is not set
CONFIG_KEYBOARD_ATKBD=y
# CONFIG_KEYBOARD_SUNKBD is not set
# CONFIG_KEYBOARD_LKKBD is not set
# CONFIG_KEYBOARD_XTKBD is not set
......@@ -724,8 +724,8 @@ CONFIG_SERIAL_8250_NR_UARTS=4
#
# Non-8250 serial port support
#
# CONFIG_SERIAL_CORE is not set
# CONFIG_SERIAL_PMACZILOG is not set
CONFIG_SERIAL_CORE=y
CONFIG_SERIAL_PMACZILOG=y
# CONFIG_SERIAL_PMACZILOG_CONSOLE is not set
CONFIG_UNIX98_PTYS=y
CONFIG_LEGACY_PTYS=y
......
......@@ -659,7 +659,7 @@ static void __init do_boot_cpu (int apicid)
Dprintk("CPU has booted.\n");
} else {
boot_error = 1;
if (*((volatile unsigned char *)phys_to_virt(8192))
if (*((volatile unsigned char *)phys_to_virt(SMP_TRAMPOLINE_BASE))
== 0xA5)
/* trampoline started but...? */
printk("Stuck ??\n");
......@@ -676,9 +676,6 @@ static void __init do_boot_cpu (int apicid)
clear_bit(cpu, &cpu_initialized); /* was set by cpu_init() */
cpucount--;
}
/* mark "stuck" area as not stuck */
*((volatile unsigned *)phys_to_virt(8192)) = 0;
}
cycles_t cacheflush_time;
......
......@@ -1433,6 +1433,7 @@ static int __init pmz_init_port(struct uart_pmac_port *uap)
ioremap(np->addrs[np->n_addrs - 1].address, 0x1000);
if (uap->rx_dma_regs == NULL) {
iounmap((void *)uap->tx_dma_regs);
uap->tx_dma_regs = NULL;
uap->flags &= ~PMACZILOG_FLAG_HAS_DMA;
goto no_dma;
}
......@@ -1490,7 +1491,6 @@ static int __init pmz_init_port(struct uart_pmac_port *uap)
uap->port.ops = &pmz_pops;
uap->port.type = PORT_PMAC_ZILOG;
uap->port.flags = 0;
spin_lock_init(&uap->port.lock);
/* Setup some valid baud rate information in the register
* shadows so we don't write crap there before baud rate is
......@@ -1508,10 +1508,13 @@ static void pmz_dispose_port(struct uart_pmac_port *uap)
{
struct device_node *np;
iounmap((void *)uap->control_reg);
np = uap->node;
iounmap((void *)uap->rx_dma_regs);
iounmap((void *)uap->tx_dma_regs);
iounmap((void *)uap->control_reg);
uap->node = NULL;
of_node_put(np);
memset(uap, 0, sizeof(struct uart_pmac_port));
}
/*
......@@ -1798,7 +1801,7 @@ static int __init pmz_register(void)
* Register this driver with the serial core
*/
rc = uart_register_driver(&pmz_uart_reg);
if (rc != 0)
if (rc)
return rc;
/*
......@@ -1808,10 +1811,19 @@ static int __init pmz_register(void)
struct uart_pmac_port *uport = &pmz_ports[i];
/* NULL node may happen on wallstreet */
if (uport->node != NULL)
uart_add_one_port(&pmz_uart_reg, &uport->port);
rc = uart_add_one_port(&pmz_uart_reg, &uport->port);
if (rc)
goto err_out;
}
return 0;
err_out:
while (i-- > 0) {
struct uart_pmac_port *uport = &pmz_ports[i];
uart_remove_one_port(&pmz_uart_reg, &uport->port);
}
uart_unregister_driver(&pmz_uart_reg);
return rc;
}
static struct of_match pmz_match[] =
......@@ -1841,6 +1853,7 @@ static struct macio_driver pmz_driver =
static int __init init_pmz(void)
{
int rc, i;
printk(KERN_INFO "%s\n", version);
/*
......@@ -1862,7 +1875,16 @@ static int __init init_pmz(void)
/*
* Now we register with the serial layer
*/
pmz_register();
rc = pmz_register();
if (rc) {
printk(KERN_ERR
"pmac_zilog: Error registering serial device, disabling pmac_zilog.\n"
"pmac_zilog: Did another serial driver already claim the minors?\n");
/* effectively "pmz_unprobe()" */
for (i=0; i < pmz_ports_count; i++)
pmz_dispose_port(&pmz_ports[i]);
return rc;
}
/*
* Then we register the macio driver itself
......
......@@ -627,8 +627,10 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs)
executable_stack = EXSTACK_DISABLE_X;
break;
}
#ifdef LEGACY_BINARIES
if (i == elf_ex.e_phnum)
def_flags |= VM_EXEC | VM_MAYEXEC;
current->personality |= READ_IMPLIES_EXEC;
#endif
/* Some simple consistency checks for the interpreter */
if (elf_interpreter) {
......
......@@ -887,8 +887,10 @@ int prepare_binprm(struct linux_binprm *bprm)
if(!(bprm->file->f_vfsmnt->mnt_flags & MNT_NOSUID)) {
/* Set-uid? */
if (mode & S_ISUID)
if (mode & S_ISUID) {
current->personality &= ~PER_CLEAR_ON_SETID;
bprm->e_uid = inode->i_uid;
}
/* Set-gid? */
/*
......@@ -896,8 +898,10 @@ int prepare_binprm(struct linux_binprm *bprm)
* is a candidate for mandatory locking, not a setgid
* executable.
*/
if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP))
if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) {
current->personality &= ~PER_CLEAR_ON_SETID;
bprm->e_gid = inode->i_gid;
}
}
/* fill in binprm security blob */
......
......@@ -117,7 +117,13 @@ typedef struct user_fxsr_struct elf_fpxregset_t;
#define AT_SYSINFO_EHDR 33
#ifdef __KERNEL__
#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
#define SET_PERSONALITY(ex, ibcs2) do { } while (0)
/*
* A legacy binary, when loaded by the ELF loader, will have the
* READ_IMPLIES_EXEC personality flag set automatically:
*/
#define LEGACY_BINARIES
extern int dump_task_regs (struct task_struct *, elf_gregset_t *);
extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *);
......
......@@ -140,8 +140,10 @@ static __inline__ int get_order(unsigned long size)
#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | \
VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
#define VM_DATA_DEFAULT_FLAGS \
(VM_READ | VM_WRITE | \
((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
#endif /* __KERNEL__ */
......
......@@ -30,6 +30,7 @@ extern int abi_fake_utsname;
*/
enum {
MMAP_PAGE_ZERO = 0x0100000,
READ_IMPLIES_EXEC = 0x0400000,
ADDR_LIMIT_32BIT = 0x0800000,
SHORT_INODE = 0x1000000,
WHOLE_SECONDS = 0x2000000,
......@@ -37,6 +38,12 @@ enum {
ADDR_LIMIT_3GB = 0x8000000,
};
/*
* Security-relevant compatibility flags that must be
* cleared upon setuid or setgid exec:
*/
#define PER_CLEAR_ON_SETID (READ_IMPLIES_EXEC)
/*
* Personality types.
*
......
......@@ -1018,20 +1018,17 @@ static int wait_task_zombie(task_t *p, unsigned int __user *stat_addr, struct ru
if (p->real_parent != p->parent) {
__ptrace_unlink(p);
p->state = TASK_ZOMBIE;
/* If this is a detached thread, this is where it goes away. */
if (p->exit_signal == -1) {
/* release_task takes the lock itself. */
write_unlock_irq(&tasklist_lock);
release_task (p);
}
else {
/*
* If this is not a detached task, notify the parent. If it's
* still not detached after that, don't release it now.
*/
if (p->exit_signal != -1) {
do_notify_parent(p, p->exit_signal);
write_unlock_irq(&tasklist_lock);
if (p->exit_signal != -1)
p = NULL;
}
p = NULL;
}
else
write_unlock_irq(&tasklist_lock);
write_unlock_irq(&tasklist_lock);
}
if (p != NULL)
release_task(p);
......
......@@ -750,6 +750,13 @@ unsigned long do_mmap_pgoff(struct file * file, unsigned long addr,
int accountable = 1;
unsigned long charged = 0;
/*
* Does the application expect PROT_READ to imply PROT_EXEC:
*/
if (unlikely((prot & PROT_READ) &&
(current->personality & READ_IMPLIES_EXEC)))
prot |= PROT_EXEC;
if (file) {
if (is_file_hugepages(file))
accountable = 0;
......@@ -792,12 +799,6 @@ unsigned long do_mmap_pgoff(struct file * file, unsigned long addr,
vm_flags = calc_vm_prot_bits(prot) | calc_vm_flag_bits(flags) |
mm->def_flags | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC;
/*
* mm->def_flags might have VM_EXEC set, which PROT_NONE does NOT want.
*/
if (prot == PROT_NONE)
vm_flags &= ~VM_EXEC;
if (flags & MAP_LOCKED) {
if (!capable(CAP_IPC_LOCK))
return -EPERM;
......
......@@ -17,6 +17,7 @@
#include <linux/highmem.h>
#include <linux/security.h>
#include <linux/mempolicy.h>
#include <linux/personality.h>
#include <asm/uaccess.h>
#include <asm/pgtable.h>
......@@ -205,6 +206,12 @@ sys_mprotect(unsigned long start, size_t len, unsigned long prot)
return -EINVAL;
if (end == start)
return 0;
/*
* Does the application expect PROT_READ to imply PROT_EXEC:
*/
if (unlikely((prot & PROT_READ) &&
(current->personality & READ_IMPLIES_EXEC)))
prot |= PROT_EXEC;
vm_flags = calc_vm_prot_bits(prot);
......
......@@ -1894,6 +1894,9 @@ static void selinux_bprm_apply_creds(struct linux_binprm *bprm, int unsafe)
task_unlock(current);
}
/* Clear any possibly unsafe personality bits on exec: */
current->personality &= ~PER_CLEAR_ON_SETID;
/* Close files for which the new task SID is not authorized. */
flush_unauthorized_files(current->files);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment