* [patches] patch-2.2.2-nonx86,patch-2.2.2-filter
@ 1999-02-24 2:17 Daniel J. Frasnelli
1999-02-24 3:12 ` 2.2.2ac1 needs to come with a warning label :-) Daniel J. Frasnelli
1999-02-24 5:10 ` [patches] patch-2.2.2-nonx86,patch-2.2.2-filter Robert Bowles
0 siblings, 2 replies; 10+ messages in thread
From: Daniel J. Frasnelli @ 1999-02-24 2:17 UTC (permalink / raw)
To: axp-list; +Cc: ppetrakis, blyon
[-- Attachment #1: Type: text/plain, Size: 1087 bytes --]
So I pointed my browser over to www.alphalinux.org earlier today,
and found this little item near the top:
* February 23rd 1999
The good news is that kernel 2.2.2 has been released. The bad news
is that it does not compile on Alpha.
Ah, how sad it was indeed.
Maybe the two attached patches will brighten your day. The first patch
(nonx86) should take care of those nasty x86 semaphores like __down_trylock,
and the second (filter) should take care of, well, broken filter code.
I've had 2.2.2 running for approximately 7+ hours total today, so
the patch appears to be safe.
Note that it is not a comprehensive solution. The final "fix"
for this problem will be bringing semaphores on axp up to where x86 is
right now. We're working on that as well, but in the meantime this
should allow building of 2.2.2.
I've tested this on my Alpha, but it should work for any non-x86
platform. I am currently compiling the 2.2.2ac1 kernel with the
non-x86 patch applied, so I assume the patch fixes that one as well.
Enjoy,
Daniel
--
[-- Attachment #2: patch-2.2.2-nonx86 --]
[-- Type: text/plain, Size: 3835 bytes --]
--- pristine/kernel/ksyms.c Tue Feb 23 18:45:45 1999
+++ linux-2.2.2-axp/kernel/ksyms.c Tue Feb 23 20:21:28 1999
@@ -322,8 +322,6 @@
EXPORT_SYMBOL(sprintf);
EXPORT_SYMBOL(vsprintf);
EXPORT_SYMBOL(kdevname);
-EXPORT_SYMBOL(bdevname);
-EXPORT_SYMBOL(cdevname);
EXPORT_SYMBOL(simple_strtoul);
EXPORT_SYMBOL(system_utsname); /* UTS data */
EXPORT_SYMBOL(uts_sem); /* UTS semaphore */
@@ -372,7 +370,6 @@
EXPORT_SYMBOL(event);
EXPORT_SYMBOL(__down);
EXPORT_SYMBOL(__down_interruptible);
-EXPORT_SYMBOL(__down_trylock);
EXPORT_SYMBOL(__up);
EXPORT_SYMBOL(brw_page);
--- pristine/kernel/sched.c Tue Feb 23 18:45:45 1999
+++ linux-2.2.2-axp/kernel/sched.c Tue Feb 23 20:16:35 1999
@@ -36,7 +36,6 @@
#include <asm/uaccess.h>
#include <asm/pgtable.h>
#include <asm/mmu_context.h>
-#include <asm/semaphore-helper.h>
#include <linux/timex.h>
@@ -464,17 +463,8 @@
unsigned long flags;
spin_lock_irqsave(&timerlist_lock, flags);
- if (timer->prev)
- goto bug;
internal_add_timer(timer);
-out:
spin_unlock_irqrestore(&timerlist_lock, flags);
- return;
-
-bug:
- printk("bug: kernel timer added twice at %p.\n",
- __builtin_return_address(0));
- goto out;
}
static inline int detach_timer(struct timer_list *timer)
@@ -873,28 +863,30 @@
struct task_struct *tsk = current; \
struct wait_queue wait = { tsk, NULL };
-#define DOWN_HEAD(task_state) \
- \
- \
- tsk->state = (task_state); \
- add_wait_queue(&sem->wait, &wait); \
- \
- /* \
- * Ok, we're set up. sem->count is known to be less than zero \
- * so we must wait. \
- * \
- * We can let go the lock for purposes of waiting. \
- * We re-acquire it after awaking so as to protect \
- * all semaphore operations. \
- * \
- * If "up()" is called before we call waking_non_zero() then \
- * we will catch it right away. If it is called later then \
- * we will have to go through a wakeup cycle to catch it. \
- * \
- * Multiple waiters contend for the semaphore lock to see \
- * who gets to gate through and who has to wait some more. \
- */ \
- for (;;) {
+#define DOWN_HEAD(task_state) \
+ \
+ \
+ tsk->state = (task_state); \
+ add_wait_queue(&sem->wait, &wait); \
+ \
+ /* \
+ * Ok, we're set up. sem->count is known to be less than zero \
+ * so we must wait. \
+ * \
+ * We can let go the lock for purposes of waiting. \
+ * We re-acquire it after awaking so as to protect \
+ * all semaphore operations. \
+ * \
+ * If "up()" is called before we call waking_non_zero() then \
+ * we will catch it right away. If it is called later then \
+ * we will have to go through a wakeup cycle to catch it. \
+ * \
+ * Multiple waiters contend for the semaphore lock to see \
+ * who gets to gate through and who has to wait some more. \
+ */ \
+ for (;;) { \
+ if (waking_non_zero(sem, tsk)) /* are we waking up? */ \
+ break; /* yes, exit loop */
#define DOWN_TAIL(task_state) \
tsk->state = (task_state); \
@@ -906,8 +898,6 @@
{
DOWN_VAR
DOWN_HEAD(TASK_UNINTERRUPTIBLE)
- if (waking_non_zero(sem))
- break;
schedule();
DOWN_TAIL(TASK_UNINTERRUPTIBLE)
}
@@ -917,23 +907,15 @@
DOWN_VAR
int ret = 0;
DOWN_HEAD(TASK_INTERRUPTIBLE)
-
- ret = waking_non_zero_interruptible(sem, tsk);
- if (ret)
+ if (signal_pending(tsk))
{
- if (ret == 1)
- /* ret != 0 only if we get interrupted -arca */
- ret = 0;
+ ret = -EINTR; /* interrupted */
+ atomic_inc(&sem->count); /* give up on down operation */
break;
}
schedule();
DOWN_TAIL(TASK_INTERRUPTIBLE)
return ret;
-}
-
-int __down_trylock(struct semaphore * sem)
-{
- return waking_non_zero_trylock(sem);
}
#define SLEEP_ON_VAR \
[-- Attachment #3: patch-2.2.2-filter --]
[-- Type: text/plain, Size: 12254 bytes --]
--- pristine/net/core/filter.c Tue Feb 23 18:45:45 1999
+++ linux-2.2.2-axp/net/core/filter.c Tue Feb 23 20:16:35 1999
@@ -11,8 +11,6 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
- *
- * Andi Kleen - Fix a few bad bugs and races.
*/
#include <linux/config.h>
@@ -38,22 +36,6 @@
#include <asm/uaccess.h>
#include <linux/filter.h>
-/* No hurry in this branch */
-
-static u8 *load_pointer(struct sk_buff *skb, int k)
-{
- u8 *ptr = NULL;
-
- if (k>=SKF_NET_OFF)
- ptr = skb->nh.raw + k - SKF_NET_OFF;
- else if (k>=SKF_LL_OFF)
- ptr = skb->mac.raw + k - SKF_LL_OFF;
-
- if (ptr<skb->head && ptr < skb->tail)
- return ptr;
- return NULL;
-}
-
/*
* Decode and apply filter instructions to the skb->data.
* Return length to keep, 0 for none. skb is the data we are
@@ -61,19 +43,15 @@
* len is the number of filter blocks in the array.
*/
-int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen)
+int sk_run_filter(unsigned char *data, int len, struct sock_filter *filter, int flen)
{
- unsigned char *data = skb->data;
- /* len is UNSIGNED. Byte wide insns relies only on implicit
- type casts to prevent reading arbitrary memory locations.
- */
- unsigned int len = skb->len;
struct sock_filter *fentry; /* We walk down these */
u32 A = 0; /* Accumulator */
u32 X = 0; /* Index Register */
u32 mem[BPF_MEMWORDS]; /* Scratch Memory Store */
int k;
int pc;
+ int *t;
/*
* Process array of filter instructions.
@@ -82,75 +60,53 @@
for(pc = 0; pc < flen; pc++)
{
fentry = &filter[pc];
+ if(fentry->code & BPF_X)
+ t=&X;
+ else
+ t=&fentry->k;
switch(fentry->code)
{
case BPF_ALU|BPF_ADD|BPF_X:
- A += X;
- continue;
-
case BPF_ALU|BPF_ADD|BPF_K:
- A += fentry->k;
+ A += *t;
continue;
case BPF_ALU|BPF_SUB|BPF_X:
- A -= X;
- continue;
-
case BPF_ALU|BPF_SUB|BPF_K:
- A -= fentry->k;
+ A -= *t;
continue;
case BPF_ALU|BPF_MUL|BPF_X:
- A *= X;
- continue;
-
case BPF_ALU|BPF_MUL|BPF_K:
- A *= X;
+ A *= *t;
continue;
case BPF_ALU|BPF_DIV|BPF_X:
- if(X == 0)
- return (0);
- A /= X;
- continue;
-
case BPF_ALU|BPF_DIV|BPF_K:
- if(fentry->k == 0)
+ if(*t == 0)
return (0);
- A /= fentry->k;
+ A /= *t;
continue;
case BPF_ALU|BPF_AND|BPF_X:
- A &= X;
- continue;
-
case BPF_ALU|BPF_AND|BPF_K:
- A &= fentry->k;
+ A &= *t;
continue;
case BPF_ALU|BPF_OR|BPF_X:
- A |= X;
- continue;
-
case BPF_ALU|BPF_OR|BPF_K:
- A |= fentry->k;
+ A |= *t;
continue;
case BPF_ALU|BPF_LSH|BPF_X:
- A <<= X;
- continue;
-
case BPF_ALU|BPF_LSH|BPF_K:
- A <<= fentry->k;
+ A <<= *t;
continue;
case BPF_ALU|BPF_RSH|BPF_X:
- A >>= X;
- continue;
-
case BPF_ALU|BPF_RSH|BPF_K:
- A >>= fentry->k;
+ A >>= *t;
continue;
case BPF_ALU|BPF_NEG:
@@ -192,62 +148,26 @@
case BPF_JMP|BPF_JSET|BPF_X:
pc += (A & X) ? fentry->jt : fentry->jf;
continue;
-
case BPF_LD|BPF_W|BPF_ABS:
k = fentry->k;
-load_w:
- if(k+sizeof(u32) <= len) {
- A = ntohl(*(u32*)&data[k]);
- continue;
- }
- if (k<0) {
- u8 *ptr;
-
- if (k>=SKF_AD_OFF)
- break;
- if ((ptr = load_pointer(skb, k)) != NULL) {
- A = ntohl(*(u32*)ptr);
- continue;
- }
- }
- return 0;
+ if(k + sizeof(long) > len)
+ return (0);
+ A = ntohl(*(long*)&data[k]);
+ continue;
case BPF_LD|BPF_H|BPF_ABS:
k = fentry->k;
-load_h:
- if(k + sizeof(u16) <= len) {
- A = ntohs(*(u16*)&data[k]);
- continue;
- }
- if (k<0) {
- u8 *ptr;
-
- if (k>=SKF_AD_OFF)
- break;
- if ((ptr = load_pointer(skb, k)) != NULL) {
- A = ntohs(*(u16*)ptr);
- continue;
- }
- }
- return 0;
+ if(k + sizeof(short) > len)
+ return (0);
+ A = ntohs(*(short*)&data[k]);
+ continue;
case BPF_LD|BPF_B|BPF_ABS:
k = fentry->k;
-load_b:
- if(k < len) {
- A = data[k];
- continue;
- }
- if (k<0) {
- u8 *ptr;
-
- if (k>=SKF_AD_OFF)
- break;
- if ((ptr = load_pointer(skb, k)) != NULL) {
- A = *ptr;
- continue;
- }
- }
+ if(k >= len)
+ return (0);
+ A = data[k];
+ continue;
case BPF_LD|BPF_W|BPF_LEN:
A = len;
@@ -257,23 +177,35 @@
X = len;
continue;
- case BPF_LD|BPF_W|BPF_IND:
+ case BPF_LD|BPF_W|BPF_IND:
k = X + fentry->k;
- goto load_w;
+ if(k + sizeof(u32) > len)
+ return (0);
+ A = ntohl(*(u32 *)&data[k]);
+ continue;
case BPF_LD|BPF_H|BPF_IND:
k = X + fentry->k;
- goto load_h;
+ if(k + sizeof(u16) > len)
+ return (0);
+ A = ntohs(*(u16*)&data[k]);
+ continue;
case BPF_LD|BPF_B|BPF_IND:
k = X + fentry->k;
- goto load_b;
+ if(k >= len)
+ return (0);
+ A = data[k];
+ continue;
case BPF_LDX|BPF_B|BPF_MSH:
+ /*
+ * Hack for BPF to handle TOS etc
+ */
k = fentry->k;
if(k >= len)
return (0);
- X = (data[k] & 0xf) << 2;
+ X = (data[fentry->k] & 0xf) << 2;
continue;
case BPF_LD|BPF_IMM:
@@ -284,7 +216,7 @@
X = fentry->k;
continue;
- case BPF_LD|BPF_MEM:
+ case BPF_LD|BPF_MEM:
A = mem[fentry->k];
continue;
@@ -314,29 +246,15 @@
mem[fentry->k] = X;
continue;
+
+
default:
/* Invalid instruction counts as RET */
return (0);
}
-
- /* Handle ancillary data, which are impossible
- (or very difficult) to get parsing packet contents.
- */
- switch (k-SKF_AD_OFF) {
- case SKF_AD_PROTOCOL:
- A = htons(skb->protocol);
- continue;
- case SKF_AD_PKTTYPE:
- A = skb->pkt_type;
- continue;
- case SKF_AD_IFINDEX:
- A = skb->dev->ifindex;
- continue;
- default:
- return 0;
- }
}
+ printk(KERN_ERR "Filter ruleset ran off the end.\n");
return (0);
}
@@ -361,17 +279,13 @@
ftest = &filter[pc];
if(BPF_CLASS(ftest->code) == BPF_JMP)
- {
+ {
/*
* But they mustn't jump off the end.
*/
if(BPF_OP(ftest->code) == BPF_JA)
{
- /* Note, the large ftest->k might cause
- loops. Compare this with conditional
- jumps below, where offsets are limited. --ANK (981016)
- */
- if (ftest->k >= (unsigned)(flen-pc-1))
+ if(pc + ftest->k + 1>= (unsigned)flen)
return (-EINVAL);
}
else
@@ -388,18 +302,17 @@
* Check that memory operations use valid addresses.
*/
- if (ftest->k >= BPF_MEMWORDS)
+ if(ftest->k <0 || ftest->k >= BPF_MEMWORDS)
{
/*
* But it might not be a memory operation...
*/
- switch (ftest->code) {
- case BPF_ST:
- case BPF_STX:
- case BPF_LD|BPF_MEM:
- case BPF_LDX|BPF_MEM:
+
+ if (BPF_CLASS(ftest->code) == BPF_ST)
return -EINVAL;
- }
+ if((BPF_CLASS(ftest->code) == BPF_LD) &&
+ (BPF_MODE(ftest->code) == BPF_MEM))
+ return (-EINVAL);
}
}
@@ -419,35 +332,34 @@
int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk)
{
- struct sk_filter *fp;
- unsigned int fsize = sizeof(struct sock_filter) * fprog->len;
+ struct sock_filter *fp, *old_filter;
+ int fsize = sizeof(struct sock_filter) * fprog->len;
int err;
/* Make sure new filter is there and in the right amounts. */
- if (fprog->filter == NULL || fprog->len > BPF_MAXINSNS)
+ if(fprog->filter == NULL || fprog->len == 0 || fsize > BPF_MAXINSNS)
return (-EINVAL);
- fp = (struct sk_filter *)sock_kmalloc(sk, fsize+sizeof(*fp), GFP_KERNEL);
- if(fp == NULL)
- return (-ENOMEM);
-
- if (copy_from_user(fp->insns, fprog->filter, fsize)) {
- sock_kfree_s(sk, fp, fsize+sizeof(*fp));
- return -EFAULT;
- }
+ if((err = sk_chk_filter(fprog->filter, fprog->len))==0)
+ {
+ /* If existing filter, remove it first */
+ if(sk->filter)
+ {
+ old_filter = sk->filter_data;
+ kfree_s(old_filter, (sizeof(old_filter) * sk->filter));
+ sk->filter_data = NULL;
+ }
- atomic_set(&fp->refcnt, 1);
- fp->len = fprog->len;
+ fp = (struct sock_filter *)kmalloc(fsize, GFP_KERNEL);
+ if(fp == NULL)
+ return (-ENOMEM);
- if ((err = sk_chk_filter(fp->insns, fp->len))==0) {
- struct sk_filter *old_fp = sk->filter;
- sk->filter = fp;
- wmb();
- fp = old_fp;
- }
+ memset(fp,0,sizeof(*fp));
+ memcpy(fp, fprog->filter, fsize); /* Copy instructions */
- if (fp)
- sk_filter_release(sk, fp);
+ sk->filter = fprog->len; /* Number of filter blocks */
+ sk->filter_data = fp; /* Filter instructions */
+ }
return (err);
}
--- pristine/net/core/sock.c Tue Feb 23 18:45:45 1999
+++ linux-2.2.2-axp/net/core/sock.c Tue Feb 23 20:16:35 1999
@@ -155,6 +155,10 @@
int err;
struct linger ling;
int ret = 0;
+
+#ifdef CONFIG_FILTER
+ struct sock_fprog fprog;
+#endif
/*
* Options without arguments
@@ -252,13 +256,12 @@
case SO_PRIORITY:
if (val >= 0 && val <= 7)
- {
- if(val==7 && !capable(CAP_NET_ADMIN))
- return -EPERM;
sk->priority = val;
- }
+ else
+ return(-EINVAL);
break;
+
case SO_LINGER:
if(optlen<sizeof(ling))
return -EINVAL; /* 1003.1g */
@@ -307,12 +310,10 @@
if (optlen > IFNAMSIZ)
optlen = IFNAMSIZ;
if (copy_from_user(devname, optval, optlen))
- return -EFAULT;
-
+ return -EFAULT;
+
/* Remove any cached route for this socket. */
- lock_sock(sk);
dst_release(xchg(&sk->dst_cache, NULL));
- release_sock(sk);
if (devname[0] == '\0') {
sk->bound_dev_if = 0;
@@ -330,32 +331,30 @@
#ifdef CONFIG_FILTER
case SO_ATTACH_FILTER:
- ret = -EINVAL;
- if (optlen == sizeof(struct sock_fprog)) {
- struct sock_fprog fprog;
+ if(optlen < sizeof(struct sock_fprog))
+ return -EINVAL;
+ if(copy_from_user(&fprog, optval, sizeof(fprog)))
+ {
ret = -EFAULT;
- if (copy_from_user(&fprog, optval, sizeof(fprog)))
- break;
-
- ret = sk_attach_filter(&fprog, sk);
+ break;
}
+
+ ret = sk_attach_filter(&fprog, sk);
break;
case SO_DETACH_FILTER:
- if(sk->filter) {
- struct sk_filter *filter;
-
- filter = sk->filter;
-
- sk->filter = NULL;
- wmb();
-
- if (filter)
- sk_filter_release(sk, filter);
+ if(sk->filter)
+ {
+ fprog.filter = sk->filter_data;
+ kfree_s(fprog.filter, (sizeof(fprog.filter) * sk->filter));
+ sk->filter_data = NULL;
+ sk->filter = 0;
return 0;
}
- return -ENOENT;
+ else
+ return -EINVAL;
+ break;
#endif
/* We implement the SO_SNDLOWAT etc to
not be settable (1003.1g 5.3) */
@@ -504,16 +503,6 @@
{
if (sk->destruct)
sk->destruct(sk);
-
-#ifdef CONFIG_FILTER
- if (sk->filter) {
- sk_filter_release(sk, sk->filter);
- sk->filter = NULL;
- }
-#endif
-
- if (atomic_read(&sk->omem_alloc))
- printk(KERN_DEBUG "sk_free: optmem leakage (%d bytes) detected.\n", atomic_read(&sk->omem_alloc));
kmem_cache_free(sk_cachep, sk);
}
--- pristine/net/ipv4/tcp_ipv4.c Tue Feb 23 18:45:46 1999
+++ linux-2.2.2-axp/net/ipv4/tcp_ipv4.c Tue Feb 23 20:16:35 1999
@@ -1323,10 +1323,6 @@
newsk->pair = NULL;
skb_queue_head_init(&newsk->back_log);
skb_queue_head_init(&newsk->error_queue);
-#ifdef CONFIG_FILTER
- if (newsk->filter)
- sk_filter_charge(newsk, newsk->filter);
-#endif
/* Now setup tcp_opt */
newtp = &(newsk->tp_pinfo.af_tcp);
@@ -1557,10 +1553,12 @@
int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb)
{
-
#ifdef CONFIG_FILTER
- if (sk->filter && sk_filter(skb, sk->filter))
- goto discard;
+ if (sk->filter)
+ {
+ if (sk_filter(skb, sk->filter_data, sk->filter))
+ goto discard;
+ }
#endif /* CONFIG_FILTER */
/*
^ permalink raw reply [flat|nested] 10+ messages in thread* 2.2.2ac1 needs to come with a warning label :-)
1999-02-24 2:17 [patches] patch-2.2.2-nonx86,patch-2.2.2-filter Daniel J. Frasnelli
@ 1999-02-24 3:12 ` Daniel J. Frasnelli
1999-02-24 3:26 ` Peter Petrakis
1999-02-24 5:10 ` [patches] patch-2.2.2-nonx86,patch-2.2.2-filter Robert Bowles
1 sibling, 1 reply; 10+ messages in thread
From: Daniel J. Frasnelli @ 1999-02-24 3:12 UTC (permalink / raw)
To: axp-list
Yes, 2.2.2ac1 built and booted just fine on my Miata using the
-nonx86 patch.
Maybe I'm just blazingly stupid or something, but I did not
realize that the sound drivers in ac1 are not the same as in 2.2.2.
I'm sitting there with headphones on, tea in hand, freshly booted
2.2.2ac1, and fire up mikmod. My eardrums nearly blew out and my keyboard
almost drank a full mug of hot tea.
It appears that the ESS1688 driver in ac1 does not fully support
the chipset - it only recognizes it as a generic 8-bit Sound Blaster.
To compound that problem, it looks like the default volume setting
is maximum.
Treat sound under 2.2.2ac1 'con cuidado' for the time being. Just my
humble opinion.
Daniel
--
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 2.2.2ac1 needs to come with a warning label :-)
1999-02-24 3:12 ` 2.2.2ac1 needs to come with a warning label :-) Daniel J. Frasnelli
@ 1999-02-24 3:26 ` Peter Petrakis
1999-02-24 3:50 ` Daniel J. Frasnelli
0 siblings, 1 reply; 10+ messages in thread
From: Peter Petrakis @ 1999-02-24 3:26 UTC (permalink / raw)
To: axp-list
> Maybe I'm just blazingly stupid or something, but I did not
> realize that the sound drivers in ac1 are not the same as in 2.2.2.
Gee I wonder what gave you that idea :) oh wait...
> I'm sitting there with headphones on, tea in hand, freshly booted
> 2.2.2ac1, and fire up mikmod. My eardrums nearly blew out and my keyboard
> almost drank a full mug of hot tea.
Yup, i'd say you'd were have'n a problem with them there sound drivers.
> It appears that the ESS1688 driver in ac1 does not fully support
> the chipset - it only recognizes it as a generic 8-bit Sound Blaster.
> To compound that problem, it looks like the default volume setting
> is maximum.
try swaping the sound drivers from pre5 into it, maybe that'll fix it.
Peter
--
www.alphalinux.org
Peter Petrakis Warrior/Engineer ppetrakis@alphalinux.org
http://math.stcc.mass.edu/petrakis
"<BLAM!!> Who the hell are you!? Name's Ash <click clock> Housewares..."
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 2.2.2ac1 needs to come with a warning label :-)
1999-02-24 3:26 ` Peter Petrakis
@ 1999-02-24 3:50 ` Daniel J. Frasnelli
0 siblings, 0 replies; 10+ messages in thread
From: Daniel J. Frasnelli @ 1999-02-24 3:50 UTC (permalink / raw)
To: axp-list
> try swaping the sound drivers from pre5 into it, maybe that'll fix it.
Well, I started out by diff'ing lines that had something to do with
the ESS1688 against the drivers in 2.2.2, but did not get very far.
All sorts of new and improved things in ac1's sound driver.
So, I just moved drivers/sound/ to a backup directory and copied 2.2.2's
drivers/sound/ in the former's place. Compiles straight, works great.
Guess fixing ESS1688 support in the proper ac1 tree goes on my todo list.
Daniel
--
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [patches] patch-2.2.2-nonx86,patch-2.2.2-filter
1999-02-24 2:17 [patches] patch-2.2.2-nonx86,patch-2.2.2-filter Daniel J. Frasnelli
1999-02-24 3:12 ` 2.2.2ac1 needs to come with a warning label :-) Daniel J. Frasnelli
@ 1999-02-24 5:10 ` Robert Bowles
1999-02-24 5:51 ` [patches] :) Robert Bowles
1999-02-24 6:26 ` [patches] patch-2.2.2-nonx86,patch-2.2.2-filter Michal Jaegermann
1 sibling, 2 replies; 10+ messages in thread
From: Robert Bowles @ 1999-02-24 5:10 UTC (permalink / raw)
To: axp-list; +Cc: dfrasnel
[-- Attachment #1: Type: text/plain, Size: 1957 bytes --]
Thanks again for the pointers.
I think I got a "roll-forward" patch partly thrown together...
Changes/Observations
- Socket Filtering Code
This alone should be a showstopper.
I don't see where this could work on any platform.
'struct sk_filter' is referenced but not defined _anywhere_.
The only solution is to build w/o socket filtering code.
- Semaphore Code
All seems well, except for the whole new
'__down_trylock() / waking_non_zero_trylock()' bit.
Attached is a patch that does compile without too much weirdness.
On the plus side, no rollbacks of x86 code. (someone test this)
On the minus, I'm not certain about the semaphore code...
On the minus, socket filtering is broken.
Good Luck,
Bob
--
I found my brain and it hurts.
On Tue, Feb 23, 1999 at 09:17:16PM -0500, Daniel J. Frasnelli wrote:
> So I pointed my browser over to www.alphalinux.org earlier today,
> and found this little item near the top:
> * February 23rd 1999
> The good news is that kernel 2.2.2 has been released. The bad news
> is that it does not compile on Alpha.
>
> Ah, how sad it was indeed.
> Maybe the two attached patches will brighten your day. The first patch
> (nonx86) should take care of those nasty x86 semaphores like __down_trylock,
> and the second (filter) should take care of, well, broken filter code.
> I've had 2.2.2 running for approximately 7+ hours total today, so
> the patch appears to be safe.
> Note that it is not a comprehensive solution. The final "fix"
> for this problem will be bringing semaphores on axp up to where x86 is
> right now. We're working on that as well, but in the meantime this
> should allow building of 2.2.2.
> I've tested this on my Alpha, but it should work for any non-x86
> platform. I am currently compiling the 2.2.2ac1 kernel with the
> non-x86 patch applied, so I assume the patch fixes that one as well.
>
> Enjoy,
> Daniel
> --
<- snip ->
[-- Attachment #2: axp-patch-2.2.2-rb0 --]
[-- Type: text/plain, Size: 3902 bytes --]
diff -u --recursive linux-2.2.2-dist/include/asm-alpha/semaphore.h linux-2.2.2/include/asm-alpha/semaphore.h
--- linux-2.2.2-dist/include/asm-alpha/semaphore.h Fri Jan 22 05:27:21 1999
+++ linux-2.2.2/include/asm-alpha/semaphore.h Tue Feb 23 23:37:40 1999
@@ -42,6 +42,10 @@
extern void __down(struct semaphore * sem);
extern int __down_interruptible(struct semaphore * sem);
+#ifndef __alpha__
+extern int __down_trylock(struct semaphore * sem);
+#endif
+
extern void __up(struct semaphore * sem);
/* All three have custom assembly linkages. */
diff -u --recursive linux-2.2.2-dist/include/linux/filter.h linux-2.2.2/include/linux/filter.h
--- linux-2.2.2-dist/include/linux/filter.h Sun Dec 21 20:41:24 1997
+++ linux-2.2.2/include/linux/filter.h Tue Feb 23 23:08:05 1999
@@ -100,7 +100,14 @@
#define BPF_MEMWORDS 16
#ifdef __KERNEL__
+/* doing this for an axp-fix, but this seems right period
+ * as per net/core/filter.c
+ */
+#if 1
+extern int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen);
+#else
extern int sk_run_filter(unsigned char *data, int len, struct sock_filter *filter, int flen);
+#endif
extern int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk);
#endif /* __KERNEL__ */
diff -u --recursive linux-2.2.2-dist/include/net/sock.h linux-2.2.2/include/net/sock.h
--- linux-2.2.2-dist/include/net/sock.h Mon Feb 22 23:22:47 1999
+++ linux-2.2.2/include/net/sock.h Tue Feb 23 23:38:56 1999
@@ -793,7 +793,7 @@
{
int pkt_len;
- pkt_len = sk_run_filter(skb, filter->insns, filter->len);
+ pkt_len = sk_run_filter(skb, &(filter->insns), filter->len);
if(!pkt_len)
return 1; /* Toss Packet */
else
@@ -801,6 +801,10 @@
return 0;
}
+
+#ifdef __alpha__
+#define sk_filter_len(filt) filt->len
+#endif
extern __inline__ void sk_filter_release(struct sock *sk, struct sk_filter *fp)
{
diff -u --recursive linux-2.2.2-dist/kernel/ksyms.c linux-2.2.2/kernel/ksyms.c
--- linux-2.2.2-dist/kernel/ksyms.c Tue Feb 23 22:27:42 1999
+++ linux-2.2.2/kernel/ksyms.c Tue Feb 23 23:37:09 1999
@@ -61,7 +61,7 @@
extern void free_dma(unsigned int dmanr);
extern spinlock_t dma_spin_lock;
-#ifdef CONFIG_MODVERSIONS
+#ifdef MODVERSIONS
const struct module_symbol __export_Using_Versions
__attribute__((section("__ksymtab"))) = {
1 /* Version version */, "Using_Versions"
@@ -322,8 +322,10 @@
EXPORT_SYMBOL(sprintf);
EXPORT_SYMBOL(vsprintf);
EXPORT_SYMBOL(kdevname);
+#ifndef __alpha__
EXPORT_SYMBOL(bdevname);
EXPORT_SYMBOL(cdevname);
+#endif
EXPORT_SYMBOL(simple_strtoul);
EXPORT_SYMBOL(system_utsname); /* UTS data */
EXPORT_SYMBOL(uts_sem); /* UTS semaphore */
@@ -372,7 +370,9 @@
EXPORT_SYMBOL(event);
EXPORT_SYMBOL(__down);
EXPORT_SYMBOL(__down_interruptible);
+#ifndef __alpha__
EXPORT_SYMBOL(__down_trylock);
+#endif
EXPORT_SYMBOL(__up);
EXPORT_SYMBOL(brw_page);
diff -u --recursive linux-2.2.2-dist/kernel/sched.c linux-2.2.2/kernel/sched.c
--- linux-2.2.2-dist/kernel/sched.c Tue Feb 23 07:12:51 1999
+++ linux-2.2.2/kernel/sched.c Tue Feb 23 23:36:47 1999
@@ -36,7 +36,9 @@
#include <asm/uaccess.h>
#include <asm/pgtable.h>
#include <asm/mmu_context.h>
+#ifndef __alpha__
#include <asm/semaphore-helper.h>
+#endif
#include <linux/timex.h>
@@ -906,7 +908,11 @@
{
DOWN_VAR
DOWN_HEAD(TASK_UNINTERRUPTIBLE)
+#ifdef __alpha__
+ if (waking_non_zero(sem,tsk))
+#else
if (waking_non_zero(sem))
+#endif
break;
schedule();
DOWN_TAIL(TASK_UNINTERRUPTIBLE)
@@ -918,7 +924,9 @@
int ret = 0;
DOWN_HEAD(TASK_INTERRUPTIBLE)
+#ifndef __alpha__
ret = waking_non_zero_interruptible(sem, tsk);
+#endif
if (ret)
{
if (ret == 1)
@@ -931,10 +939,12 @@
return ret;
}
+#ifndef __alpha__
int __down_trylock(struct semaphore * sem)
{
return waking_non_zero_trylock(sem);
}
+#endif
#define SLEEP_ON_VAR \
unsigned long flags; \
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [patches] :)
1999-02-24 5:10 ` [patches] patch-2.2.2-nonx86,patch-2.2.2-filter Robert Bowles
@ 1999-02-24 5:51 ` Robert Bowles
1999-02-24 6:09 ` 2.2.2ac2 (Re: [patches] :)) Daniel J. Frasnelli
1999-02-24 6:26 ` [patches] patch-2.2.2-nonx86,patch-2.2.2-filter Michal Jaegermann
1 sibling, 1 reply; 10+ messages in thread
From: Robert Bowles @ 1999-02-24 5:51 UTC (permalink / raw)
To: axp-list
Running it with the patch right now... :)
Thanks again to Daniel for isolating the "offending sections".
As for the socket filtering, I stumbled across this
message on the LKML. The theory here seems to hold water...
(think I'll cram it in tomorrow, time permitting)
Dr. Werner Fink (werner@suse.de) Tue, 23 Feb 1999 15:54:09 +0100
> [2.2.2] The difference between sk_filter and sock_filter?
>
> Hi,
>
> there is trouble with the option CONFIG_FILTER. The structure
> sk_filter used with patch 2.2.2 isn't defined in any header. Only the
> struct sock_filter is given in include/linux/filter.h.
> It looks like sk_filter and sock_filter are different structures because
> the sk_run_filter call in include/net/sock.h uses the entries insns and
> len of that new structure. That means something like
>
> struct sk_filter {
> unsigned short len;
> atomic_t refcnt;
> struct sock_filter *insns;
> }
>
> Besides this the change of sk_run_filter() in net/core/filter.c
> wasn't ported to include/linux/filter.h.
> The (inlined) function sk_filter_len() is missed (calculate the
> real length out of the numbers of blocks used??).
> And some macros are missed: SKF_NET_OFF, SKF_LL_OFF, SKF_AD_OFF,
> SKF_AD_PROTOCOL, SKF_AD_PKTTYPE, and SKF_AD_IFINDEX.
>
> Werner
Looks like Alpha isn't the only arch with problems.
--
^ permalink raw reply [flat|nested] 10+ messages in thread* 2.2.2ac2 (Re: [patches] :))
1999-02-24 5:51 ` [patches] :) Robert Bowles
@ 1999-02-24 6:09 ` Daniel J. Frasnelli
1999-02-24 6:37 ` Michal Jaegermann
0 siblings, 1 reply; 10+ messages in thread
From: Daniel J. Frasnelli @ 1999-02-24 6:09 UTC (permalink / raw)
To: rbowles; +Cc: axp-list
Rob,
Thanks for your patch. I suggested the simple #ifdef __alpha__
solution to Alan Cox earlier today (yesterday? Oy, it's late) - chances
are he'll adopt that in ac3, ac4, or as he said on linux-kernel, "whenever".
The compile just bombed out, but I'll have to examine it later.. kinda
lethargic at the moment. Andrea Arcangeli also has a patch against
2.2.2 that is supposed to fix the semaphore woes:
http://e-mind.com/~andrea/linux.shtml.
Did anyone else catch Linus' linux-kernel post regarding
the breaking of compilation on non-x86 platforms? His basic philosophy is
that if recursive semaphores were going to be added, it is better to
do it all in one swell foop (grin) and cause major breakage up front
rather than be subtle about it. Can't say I disagree, although I wish
we could have had some warning between pre4 (working) and pre5 (not working).
While I'm on the subject, 2.2.2-ac2 does not compile because
of changes made in drivers/cdrom/cdrom.c. I'll hack with it at a reasonable
hour later today.
Best regards,
Daniel
--
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 2.2.2ac2 (Re: [patches] :))
1999-02-24 6:09 ` 2.2.2ac2 (Re: [patches] :)) Daniel J. Frasnelli
@ 1999-02-24 6:37 ` Michal Jaegermann
1999-02-24 6:47 ` Daniel J. Frasnelli
0 siblings, 1 reply; 10+ messages in thread
From: Michal Jaegermann @ 1999-02-24 6:37 UTC (permalink / raw)
To: axp-list
Daniel J. Frasnelli wrote:
>
> Did anyone else catch Linus' linux-kernel post regarding
> the breaking of compilation on non-x86 platforms? His basic philosophy is
> that if recursive semaphores were going to be added, it is better to
> do it all in one swell foop (grin) and cause major breakage up front
> rather than be subtle about it.
Daniel,
watch out! Recursive semaphores were *** removed ***. They were added
just in time for 2.2.0, to guard against a problem discovered right
before release , and caused a lot of teeth gnashing, unhappines and
assorted breakage in various drivers. Now the original problem was
solved in another way and "recursive semaphores", which is a strange
concept on its own, are out.
Backing out recent changes is only a "band-aid" solution which should
not stay. This is NOT a desired fix.
Michal
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: 2.2.2ac2 (Re: [patches] :))
1999-02-24 6:37 ` Michal Jaegermann
@ 1999-02-24 6:47 ` Daniel J. Frasnelli
0 siblings, 0 replies; 10+ messages in thread
From: Daniel J. Frasnelli @ 1999-02-24 6:47 UTC (permalink / raw)
To: axp-list
> watch out! Recursive semaphores were *** removed ***. They were added
> just in time for 2.2.0, to guard against a problem discovered right
> before release , and caused a lot of teeth gnashing, unhappines and
> assorted breakage in various drivers. Now the original problem was
> solved in another way and "recursive semaphores", which is a strange
> concept on its own, are out.
Quite right, my mistake. The visual cortex seems to fade out around
midnight with me. If I didn't have a paper to finish up, I'd be fast
asleep certainly.
> Backing out recent changes is only a "band-aid" solution which should
> not stay. This is NOT a desired fix.
Completely agree with you. Dave Miller is implementing
"proper" semaphores under sparc64 at the moment. I'm waiting for
him to get back with me about a vger tree question before tackling
the permanent solution. I pointed out several times that the
patches are not meant to be a permanent fixture; they exist for the sole
purpose of allowing developers to run the latest kernel while working
on the larger problems. A person at Cygnus is supposed to help with
the project, but I've not gotten in contact with him yet.
Regards,
Daniel
--
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [patches] patch-2.2.2-nonx86,patch-2.2.2-filter
1999-02-24 5:10 ` [patches] patch-2.2.2-nonx86,patch-2.2.2-filter Robert Bowles
1999-02-24 5:51 ` [patches] :) Robert Bowles
@ 1999-02-24 6:26 ` Michal Jaegermann
1 sibling, 0 replies; 10+ messages in thread
From: Michal Jaegermann @ 1999-02-24 6:26 UTC (permalink / raw)
To: rbowles; +Cc: axp-list
Robert Bowles wrote:
>
> Changes/Observations
> - Socket Filtering Code
> This alone should be a showstopper.
> I don't see where this could work on any platform.
> 'struct sk_filter' is referenced but not defined _anywhere_.
> The only solution is to build w/o socket filtering code.
Patch for that was already postes five or six times (maybe more,
I lost count) on linux-kernel list. Half of an original patch
was lost in a shuffle. 2.2.2-ac1 has this few lines already applied.
> - Semaphore Code
> All seems well, except for the whole new
> '__down_trylock() / waking_non_zero_trylock()' bit.
This bit is for the moment "Intel only". Linus says that he
did that on purpose to force the issue and get people to bring
other platforms in sync instead of causing some subtle breakage.
Daniel J. Frasnelli posted a temporary patch for that already;
both on axp-list and on linux-kernel list. And also actually
a few times.
It is quite likely that the patch causes this "subtle breakage" mentioned
above as it backs off __down_trylock() and some races may show up -
infrequently. I am running 2.2.2-ac1 patched that way right now.
Cross your fingers. :-)
> On the minus, socket filtering is broken.
Yes, I did compile with socket filtering on - just to be sure.
But this is 'ac1' and not "pure" 2.2.2.
Michal
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~1999-02-24 6:48 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-02-24 2:17 [patches] patch-2.2.2-nonx86,patch-2.2.2-filter Daniel J. Frasnelli
1999-02-24 3:12 ` 2.2.2ac1 needs to come with a warning label :-) Daniel J. Frasnelli
1999-02-24 3:26 ` Peter Petrakis
1999-02-24 3:50 ` Daniel J. Frasnelli
1999-02-24 5:10 ` [patches] patch-2.2.2-nonx86,patch-2.2.2-filter Robert Bowles
1999-02-24 5:51 ` [patches] :) Robert Bowles
1999-02-24 6:09 ` 2.2.2ac2 (Re: [patches] :)) Daniel J. Frasnelli
1999-02-24 6:37 ` Michal Jaegermann
1999-02-24 6:47 ` Daniel J. Frasnelli
1999-02-24 6:26 ` [patches] patch-2.2.2-nonx86,patch-2.2.2-filter Michal Jaegermann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox